diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 38b87b2f2a..ddd5c4f2f6 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -27,24 +27,24 @@ If applicable, add screenshots to help explain your problem. (Delete the irrelevant sections) -**Keyman Desktop, Keyman for macOS, Keyman for Linux (please complete the following information):** +**Keyman Desktop, Keyman for macOS, Keyman for Linux:** - OS: [e.g. Windows 7, Windows 10 1803, macOS Mojave, Ubuntu 18.04] - Keyman version: [e.g. 10.0.1206.0] - Target Application: [e.g. Firefox 55] -**iPhone/iPad/Android (please complete the following information):** +**iPhone/iPad/Android:** - Device: [e.g. iPhone 6] - OS: [e.g. iOS 8.1] - Keyman version [e.g. 10.0.111] - Target application: [e.g. Notes, Keyman] -**KeymanWeb (please complete the following information): +**KeymanWeb:** - OS: [e.g. Windows 7, Windows 10 1803, macOS Mojave, Ubuntu 18.04, Android 8.1] - Browser: [e.g. Chrome, Firefox] - KeymanWeb Version: [e.g. 10.0.201] - URL: [e.g. https://example.com/web_keyboard/] -**Keyman Developer (please complete the following information): +**Keyman Developer:** - OS: [e.g. Windows 7, Windows 10 1803] - Keyman Developer version: [e.g. 10.0.1206.0] diff --git a/.github/workflows/auto-merge-keyman-server-pr.yml b/.github/workflows/auto-merge-keyman-server-pr.yml new file mode 100644 index 0000000000..68f9a959e5 --- /dev/null +++ b/.github/workflows/auto-merge-keyman-server-pr.yml @@ -0,0 +1,28 @@ +# +# Automatically merges pull requests opened by keyman-server +# The initial use of this action is to increment the patch +# version of Keyman with resources/build/increment-version.sh. +# That script creates a PR and then this workflow will be +# triggered to approve the PR (from github-actions account), and +# then automerge it. +# +name: Auto Merge PRs from keyman-server +on: + pull_request: + types: [opened] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: auto approve PR from keyman-server + uses: hmarr/auto-approve-action@v2.0.0 + if: github.actor == 'keyman-server' + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + - name: auto merge PR from keyman-server + uses: ridedott/merge-me-action@v1.1.3 + if: github.actor == 'keyman-server' + with: + GITHUB_LOGIN: keyman-server + GITHUB_TOKEN: "${{ secrets.AUTOINC_GITHUB_TOKEN }}" diff --git a/HISTORY.md b/HISTORY.md new file mode 100644 index 0000000000..2a2641024f --- /dev/null +++ b/HISTORY.md @@ -0,0 +1,7 @@ +# Keyman Version History + +## 14.0.1 alpha + +chore: Starting 14.0 release +chore: Consolidate history and versioning + diff --git a/TIER.md b/TIER.md new file mode 100644 index 0000000000..4a58007052 --- /dev/null +++ b/TIER.md @@ -0,0 +1 @@ +alpha diff --git a/VERSION.md b/VERSION.md index 584e765672..8d2e58b40f 100644 --- a/VERSION.md +++ b/VERSION.md @@ -1 +1 @@ -Please see resources/VERSION.md for the current target build version. +14.0.1 \ No newline at end of file diff --git a/android/KMAPro/kMAPro/build.gradle b/android/KMAPro/kMAPro/build.gradle index ec03aeb697..c2fa0009d8 100644 --- a/android/KMAPro/kMAPro/build.gradle +++ b/android/KMAPro/kMAPro/build.gradle @@ -5,6 +5,9 @@ plugins { id 'name.remal.default-plugins' } +ext.rootPath = '../../' +apply from: "$rootPath/version.gradle" + android { compileSdkVersion 29 buildToolsVersion "29.0.2" @@ -30,18 +33,9 @@ android { } } - String env_build_number = System.getenv("BUILD_NUMBER") //assigned by TeamCity, so all caps - String env_build_counter = System.getenv("build_counter") - if (env_build_number != null) { - println "Using build number $env_build_number and counter $env_build_counter from environment" - versionCode env_build_counter as Integer - versionName env_build_number - } else { - String majorMinorVersion = file('$projectDir/../../../../resources/VERSION.md').text.trim() - versionCode 100 - versionName majorMinorVersion + '.0.0' - println "Using build $majorMinorVersion from project VERSION.md" - } + // VERSION_CODE and VERSION_NAME from version.gradle + versionCode VERSION_CODE as Integer + versionName VERSION_NAME } String env_release_store_file = System.getenv("release_store_file") diff --git a/android/KMEA/app/build.gradle b/android/KMEA/app/build.gradle index c124d45721..c15c239190 100644 --- a/android/KMEA/app/build.gradle +++ b/android/KMEA/app/build.gradle @@ -3,6 +3,9 @@ plugins { id 'com.android.library' } +ext.rootPath = '../../' +apply from: "$rootPath/version.gradle" + android { compileSdkVersion 29 buildToolsVersion "29.0.2" @@ -11,18 +14,9 @@ android { minSdkVersion 16 targetSdkVersion 29 - String env_build_number = System.getenv("BUILD_NUMBER") //assigned by TeamCity, so all caps - String env_build_counter = System.getenv("build_counter") - if (env_build_number != null) { - println "Using build number $env_build_number and counter $env_build_counter from environment" - versionCode env_build_counter as Integer - versionName env_build_number - } else { - String majorMinorVersion = file('$projectDir/../../../../resources/VERSION.md').text.trim() - versionCode 100 - versionName majorMinorVersion + '.0.0' - println "Using build $majorMinorVersion from project VERSION.md" - } + // VERSION_CODE and VERSION_NAME from version.gradle + versionCode VERSION_CODE as Integer + versionName VERSION_NAME } buildTypes { diff --git a/android/KMEA/build.sh b/android/KMEA/build.sh index 08da465448..f3c8b997c0 100755 --- a/android/KMEA/build.sh +++ b/android/KMEA/build.sh @@ -6,6 +6,12 @@ # KMEA - Keyman Engine Android # KMW - Keyman Web +## START STANDARD BUILD SCRIPT INCLUDE +# adjust relative paths as necessary +THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BASH_SOURCE[0]}")" +. "$(dirname "$THIS_SCRIPT")/../../resources/build/build-utils.sh" +## END STANDARD BUILD SCRIPT INCLUDE + display_usage ( ) { echo "build.sh [-no-kmw-build] | [-no-kmw] [-no-daemon] | [-no-test]" echo @@ -26,9 +32,9 @@ echo Build KMEA SHLVL=0 # Path definitions -KM_ROOT="$(cd "$( dirname "${BASH_SOURCE[0]}" )/../.." && pwd )" -KMA_ROOT="$KM_ROOT/android" -KMW_ROOT="$KM_ROOT/web" + +KMA_ROOT="$KEYMAN_ROOT/android" +KMW_ROOT="$KEYMAN_ROOT/web" KMW_SOURCE="$KMW_ROOT/source" KMEA_ASSETS="$KMA_ROOT/KMEA/app/src/main/assets" diff --git a/android/Samples/KMSample1/app/build.gradle b/android/Samples/KMSample1/app/build.gradle index 9b2a0b175e..12e3849e29 100644 --- a/android/Samples/KMSample1/app/build.gradle +++ b/android/Samples/KMSample1/app/build.gradle @@ -1,5 +1,8 @@ apply plugin: 'com.android.application' +ext.rootPath = '../../' +apply from: "$rootPath/version.gradle" + android { compileSdkVersion 29 @@ -7,8 +10,10 @@ android { applicationId "com.keyman.kmsample1" minSdkVersion 16 targetSdkVersion 29 - versionCode 1 - versionName "1.0" + + // VERSION_CODE and VERSION_NAME from version.gradle + versionCode VERSION_CODE as Integer + versionName VERSION_NAME } buildTypes { release { diff --git a/android/Samples/KMSample2/app/build.gradle b/android/Samples/KMSample2/app/build.gradle index e0302f6747..7ed933b6d5 100644 --- a/android/Samples/KMSample2/app/build.gradle +++ b/android/Samples/KMSample2/app/build.gradle @@ -1,5 +1,8 @@ apply plugin: 'com.android.application' +ext.rootPath = '../../../' +apply from: "$rootPath/version.gradle" + android { compileSdkVersion 29 @@ -7,8 +10,10 @@ android { applicationId "com.keyman.kmsample2" minSdkVersion 16 targetSdkVersion 29 - versionCode 1 - versionName "1.0" + + // VERSION_CODE and VERSION_NAME from version.gradle + versionCode VERSION_CODE as Integer + versionName VERSION_NAME } buildTypes { release { diff --git a/android/Tests/KeyboardHarness/app/build.gradle b/android/Tests/KeyboardHarness/app/build.gradle index aceb9242d8..6a30f69b68 100644 --- a/android/Tests/KeyboardHarness/app/build.gradle +++ b/android/Tests/KeyboardHarness/app/build.gradle @@ -1,5 +1,8 @@ apply plugin: 'com.android.application' +ext.rootPath = '../../../' +apply from: "$rootPath/version.gradle" + android { compileSdkVersion 29 @@ -7,8 +10,10 @@ android { applicationId "com.keyman.android.tests.keyboardHarness" minSdkVersion 16 targetSdkVersion 29 - versionCode 1 - versionName "1.0" + + // VERSION_CODE and VERSION_NAME from version.gradle + versionCode VERSION_CODE as Integer + versionName VERSION_NAME } buildTypes { release { diff --git a/android/Tests/keycode/app/build.gradle b/android/Tests/keycode/app/build.gradle index 197dc7a8a5..6d44898146 100644 --- a/android/Tests/keycode/app/build.gradle +++ b/android/Tests/keycode/app/build.gradle @@ -1,13 +1,18 @@ apply plugin: 'com.android.application' +ext.rootPath = '../../../' +apply from: "$rootPath/version.gradle" + android { compileSdkVersion 29 defaultConfig { applicationId "com.keyman.android.tests.keycode" minSdkVersion 16 targetSdkVersion 29 - versionCode 1 - versionName "1.0" + + // VERSION_CODE and VERSION_NAME from version.gradle + versionCode VERSION_CODE as Integer + versionName VERSION_NAME } buildTypes { release { diff --git a/android/build-help.sh b/android/build-help.sh index 8acf0a082c..462eed6c57 100755 --- a/android/build-help.sh +++ b/android/build-help.sh @@ -1,5 +1,13 @@ #!/bin/bash +## START STANDARD BUILD SCRIPT INCLUDE +# adjust relative paths as necessary +THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BASH_SOURCE[0]}")" +. "$(dirname "$THIS_SCRIPT")/../resources/build/build-utils.sh" +## END STANDARD BUILD SCRIPT INCLUDE + +KMA_ROOT="$KEYMAN_ROOT/android" + # Uses the open-source `wget` utility to create an embedding-friendly offline mirror # equivalent of online help. @@ -20,15 +28,13 @@ OPTIONS="--no-host-directories" DEVICE=android HELP_SITE_SECTION=products/android -HELP_ROOT=KMAPro/kMAPro/src/main/assets/info +HELP_ROOT="$KMA_ROOT/KMAPro/kMAPro/src/main/assets/info" # Clear previous help file downloads (if they exist) if [ -d "$HELP_ROOT" ]; then rm -r "$HELP_ROOT" fi -VERSION=`cat ../resources/VERSION.md` - # If TIER is set to "alpha", use the previous version. Help is usually only updated during # the "beta" process. if [ -z $TIER ]; then @@ -37,10 +43,8 @@ if [ -z $TIER ]; then fi if [ $TIER = "alpha" ]; then - # More readable: (major).minor - [[ "$VERSION" =~ ([0-9]+)\.[0-9]+ ]] # Construct a decremented version string with .minor set to .0 - VERSION="$((${BASH_REMATCH[1]}-1)).0" + VERSION="$(($VERSION_MAJOR-1)).0" fi do_offline_mirror() { @@ -69,8 +73,8 @@ do_offline_mirror() { do_offline_mirror "phone" # Now for some magic... we rename the page's folder and redownload with the other setting. -mv ./$HELP_ROOT/$HELP_SITE_SECTION/$VERSION ./$HELP_ROOT/$HELP_SITE_SECTION/phone +mv $HELP_ROOT/$HELP_SITE_SECTION/$VERSION $HELP_ROOT/$HELP_SITE_SECTION/phone do_offline_mirror "tablet" -mv ./$HELP_ROOT/$HELP_SITE_SECTION/$VERSION ./$HELP_ROOT/$HELP_SITE_SECTION/tablet \ No newline at end of file +mv $HELP_ROOT/$HELP_SITE_SECTION/$VERSION $HELP_ROOT/$HELP_SITE_SECTION/tablet diff --git a/android/build.sh b/android/build.sh index 6b94cbbe6c..25b1b738c6 100755 --- a/android/build.sh +++ b/android/build.sh @@ -1,12 +1,11 @@ #!/bin/sh # Build Keyman Engine Android and KMAPro -die () { - echo - echo "$*" - echo - exit 1 -} +## START STANDARD BUILD SCRIPT INCLUDE +# adjust relative paths as necessary +THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BASH_SOURCE[0]}")" +. "$(dirname "$THIS_SCRIPT")/../resources/build/build-utils.sh" +## END STANDARD BUILD SCRIPT INCLUDE # # Prevents 'clear' on exit of mingw64 bash shell @@ -17,7 +16,7 @@ echo Build KMEA and KMAPro: # Building Keyman Engine for Android -cd KMEA +cd "$KEYMAN_ROOT/android/KMEA" ./build.sh "$@" if [ $? -ne 0 ]; then @@ -26,19 +25,19 @@ fi # Building Keyman for Android -cd ../KMAPro +cd "$KEYMAN_ROOT/android/KMAPro" ./build.sh "$@" if [ $? -ne 0 ]; then die "ERROR: KMAPro/build.sh failed" fi -cd ../ +cd "$KEYMAN_ROOT/android" # Building OEM apps if [ ! -z "$RELEASE_OEM" ]; then - pushd ../oem/firstvoices/android + pushd "$KEYMAN_ROOT/oem/firstvoices/android" ./build.sh -lib-nobuild "$@" if [ $? -ne 0 ]; then diff --git a/android/version.gradle b/android/version.gradle new file mode 100644 index 0000000000..7b95cdd58f --- /dev/null +++ b/android/version.gradle @@ -0,0 +1,39 @@ +// version.gradle + +// +// This depends on ext.rootPath = path to /android folder in repository +// It can be a relative path. Gradle does not appear to support relative +// paths from included scripts. +// + +def getVersionCode = { -> + String env_build_counter = System.getenv("build_counter") + if(env_build_counter != null) { + // This has been assigned by TeamCity, so use it if present + println "Using version code $env_build_counter from environment (TeamCity)" + return env_build_counter + } + + println "Using fixed version code 100" + return 100 +} + +def getVersionName = { -> + String env_version = System.getenv("VERSION") + String env_tier = System.getenv("TIER") + if (env_version != null && env_tier != null) { + // If building from script, we have build number in VERSION and tier in TIER + return "$env_version-$env_tier" + } else { + // Building probably from IDE, so let's use VERSION.md and TIER.md directly + String version_md = file("$rootPath/../VERSION.md").text.trim() + String tier_md = file("$rootPath/../TIER.md").text.trim() + println "Using build $version_md-$tier_md from project VERSION.md" + return "$version_md-$tier_md" + } +} + +ext { + VERSION_CODE=getVersionCode() + VERSION_NAME=getVersionName() +} \ No newline at end of file diff --git a/common/predictive-text/build.sh b/common/predictive-text/build.sh index 8f98a4e039..7e862e1c79 100755 --- a/common/predictive-text/build.sh +++ b/common/predictive-text/build.sh @@ -8,7 +8,17 @@ set -eu # Include some helper functions from resources -. ../../resources/shellHelperFunctions.sh + +## START STANDARD BUILD SCRIPT INCLUDE +# adjust relative paths as necessary +THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BASH_SOURCE[0]}")" +. "$(dirname "$THIS_SCRIPT")/../../resources/build/build-utils.sh" +## END STANDARD BUILD SCRIPT INCLUDE + +. "$KEYMAN_ROOT/resources/shellHelperFunctions.sh" + +# This script runs from its own folder +cd "$(dirname "$THIS_SCRIPT")" # Exit status on invalid usage. EX_USAGE=64 diff --git a/docs/history-and-versioning.md b/docs/history-and-versioning.md new file mode 100644 index 0000000000..3b1b936bf4 --- /dev/null +++ b/docs/history-and-versioning.md @@ -0,0 +1,49 @@ +# History and Versioning + +In Keyman 14.0, history and versioning is controlled as part of the build process, +and unified. We no longer have a separate version or history for each project. The +controlling version number is in /VERSION.md and the master history is in /HISTORY.md. + +While there may be multiple versions of HISTORY.md in different branches, the +**master** branch is source of truth and is the version that is published to the +website. + +# VERSION.md + +The version shown in VERSION.md is the upcoming release version. This means: + + 1. A snapshot of the repository will show the changes relevant to that version + 2. The build system will simply use that version number when building. + 3. If a release does not exist for the version shown, then you are at the + bleeding edge. + +# TIER.md + +The release tier is updated in TIER.md? + +# How history and version are updated + +For Alpha versions (**master**), the version number is incremented at the end of a +successful Nightly build. This means that during a single day, there may be multiple +builds with the same version number. Only the last one of these is kept. + +A similar process will be followed for Beta versions. + +For Stable versions, the version number should be manually incremented in a pull +request (these are much rarer). + +## History format + +``` +## + + [([/])]: [(#)] +``` + +For example: + +``` +## 2020-01-27 13.0.65 beta +feat(developer/compiler): Hotkeys defined in .kmn no longer need to be quoted (#2432) +chore: Release beta (#2555) +``` diff --git a/ios/README.md b/ios/README.md index 06dbacfb9d..a38b00e69a 100644 --- a/ios/README.md +++ b/ios/README.md @@ -6,6 +6,7 @@ * SwiftLint (`brew install swiftlint`) * Carthage (`brew install carthage`) * [Node.js](https://nodejs.org/) 8.9+ (for building KeymanWeb) +* Coreutils (`brew install coreutils`) ## Keyman App diff --git a/ios/kmbuild.sh b/ios/kmbuild.sh index db31df0241..e5d2df453c 100755 --- a/ios/kmbuild.sh +++ b/ios/kmbuild.sh @@ -1,7 +1,19 @@ #!/bin/sh + +## START STANDARD BUILD SCRIPT INCLUDE +# adjust relative paths as necessary +THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BASH_SOURCE[0]}")" +. "$(dirname "$THIS_SCRIPT")/../resources/build/build-utils.sh" +## END STANDARD BUILD SCRIPT INCLUDE + +KEYMAN_MAC_BASE_PATH="$KEYMAN_ROOT/mac" + # Include our resource functions; they're pretty useful! -. ../resources/shellHelperFunctions.sh +. "$KEYMAN_ROOT/resources/shellHelperFunctions.sh" + +# This script runs from its own folder +cd "$(dirname "$THIS_SCRIPT")" # Please note that this build script (understandably) assumes that it is running on Mac OS X. verify_on_mac @@ -191,10 +203,10 @@ if [ $DO_KEYMANAPP = true ]; then assertDirExists "$ARCHIVE_PATH" # Pass the build number information along to the Plist file of the app. - if [ $BUILD_NUMBER ]; then - echo "Setting version numbers to $BUILD_NUMBER." - /usr/libexec/Plistbuddy -c "Set ApplicationProperties:CFBundleVersion $BUILD_NUMBER" "$ARCHIVE_PATH/Info.plist" - /usr/libexec/Plistbuddy -c "Set ApplicationProperties:CFBundleShortVersionString $BUILD_NUMBER" "$ARCHIVE_PATH/Info.plist" + if [ $VERSION ]; then + echo "Setting version numbers to $VERSION." + /usr/libexec/Plistbuddy -c "Set ApplicationProperties:CFBundleVersion $VERSION" "$ARCHIVE_PATH/Info.plist" + /usr/libexec/Plistbuddy -c "Set ApplicationProperties:CFBundleShortVersionString $VERSION" "$ARCHIVE_PATH/Info.plist" ARCHIVE_APP="$ARCHIVE_PATH/Products/Applications/Keyman.app" ARCHIVE_KBD="$ARCHIVE_APP/Plugins/SWKeyboard.appex" diff --git a/linux/README.md b/linux/README.md index ece02b8af1..9d93449947 100644 --- a/linux/README.md +++ b/linux/README.md @@ -101,7 +101,7 @@ To upload the packages to launchpad, run the following script from the `linux/` ``` **Parameters** UPLOAD="yes" do the dput for real -TIER="\" alpha, beta, or stable, default beta +TIER="\" alpha, beta, or stable, default from ../TIER.md PROJECT="\" only upload this project DIST="\" only upload for this distribution PACKAGEVERSION="\" normally use the default so don't specify it. But if you change packaging and run another upload you need to increment the number at the end of `PACKAGEVERSION`. e.g. next one is `1~sil2` then `1~sil3`... @@ -123,13 +123,6 @@ Run `ibus restart` after installing any of them #### Getting a Keyman keyboard -- There are some kmfl keyboards available on packages.sil.org. Search for "kmfl-keyboard". These will also install the ibus-kmfl package. - -- You can find more `.kmn` source keyboards at the [Keyboards repo](https://github.com/keymanapp/keyboards). They may or may not currently work with KMFL. - -- The `.kmn` file should be put in `/usr/share/kmfl` or `~/.kmfl`, preferably `~/.kmfl` - * TODO: let ibus-kmfl find keyboards in `/usr/local/share/kmfl` as well - - After installing a Keyman keyboard you need to run `ibus restart` so that ibus will look for it. (TODO: double check this) #### Activating a Keyman keyboard diff --git a/linux/VERSION b/linux/VERSION index 5af49d1257..cd581fe793 120000 --- a/linux/VERSION +++ b/linux/VERSION @@ -1 +1 @@ -../resources/VERSION.md \ No newline at end of file +../VERSION.md \ No newline at end of file diff --git a/linux/scripts/launchpad.sh b/linux/scripts/launchpad.sh index 206e3d9e63..a2ec7c2168 100755 --- a/linux/scripts/launchpad.sh +++ b/linux/scripts/launchpad.sh @@ -25,7 +25,7 @@ if [[ -z "${TIER}" ]]; then # In master branch this should be alpha and the debian/watch files should check alpha dir # tier="alpha" # tier="beta" - tier="stable" + tier=`cat ../TIER.md` else tier="${TIER}" fi diff --git a/linux/scripts/reconf.sh b/linux/scripts/reconf.sh index a8b3ea127a..bf556cf950 100755 --- a/linux/scripts/reconf.sh +++ b/linux/scripts/reconf.sh @@ -8,7 +8,13 @@ set -e -BASEDIR=`pwd` +## START STANDARD BUILD SCRIPT INCLUDE +# adjust relative paths as necessary +THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BASH_SOURCE[0]}")" +. "$(dirname "$THIS_SCRIPT")/../../resources/build/build-utils.sh" +## END STANDARD BUILD SCRIPT INCLUDE + +BASEDIR="$KEYMAN_ROOT/linux" echo "basedir is $BASEDIR" autotool_projects="kmflcomp libkmfl ibus-kmfl ibus-keyman" extra_projects="keyboardprocessor keyman-config" @@ -32,20 +38,8 @@ if [ "$1" != "" ]; then fi fi -if [ -n "$SKIPVERSION" -a -f OLDVERSION ]; then - oldvers=$(cat OLDVERSION) - newvers=$(cat VERSION) -else - JENKINS=${JENKINS:="no"} - oldvers=`cat VERSION` - - . $(dirname "$0")/version.sh - - version - - echo "version: ${newvers}" - echo "${newvers}" > VERSION -fi +. "$BASEDIR/scripts/version.sh" +version # autoreconf the projects for proj in ${autotool_projects}; do @@ -60,6 +54,8 @@ done for proj in ${extra_projects}; do if [ "${proj}" == "keyboardprocessor" ]; then rm -rf keyboardprocessor + #TODO: update meson version to 0.50.0+ and use `meson rewrite` + #meson rewrite kwargs set project / version "${newvers}" sed -i "s/version: '.*'/version: '${newvers}'/" ../common/engine/keyboardprocessor/meson.build meson ../common/engine/keyboardprocessor keyboardprocessor fi @@ -67,10 +63,7 @@ for proj in ${extra_projects}; do cd keyman-config make clean cd keyman_config - sed -e "s/_VERSION_/${newvers}/g" -e "s/_MAJORVERSION_/${oldvers}/g" version.py.in > version.py + sed -e "s/_VERSION_/${newvers}/g" -e "s/_MAJORVERSION_/${VERSION_MAJOR}/g" version.py.in > version.py fi cd $BASEDIR done - -# reset VERSION file -echo "${oldvers}" > VERSION diff --git a/linux/scripts/version.sh b/linux/scripts/version.sh old mode 100644 new mode 100755 index 2154f335b7..d8e431f013 --- a/linux/scripts/version.sh +++ b/linux/scripts/version.sh @@ -2,54 +2,7 @@ version() { - if [[ -z "${TIER}" ]]; then - tier="alpha" - else - tier="${TIER}" - fi - echo "tier is ${tier}" - local catvers=`cat VERSION` - echo "VERSION is ${catvers}" - local datevers=`TZ=UTC git log -1 --pretty=format:%cd --date=format-local:%Y%m%d%H%M` - local num=`git describe --abbrev=0 --match=linux-release-${tier}*| cut -d '.' -f3` - if [[ -z "${num}" ]]; then - num="0" - fi - echo "current tag number ${num}" - local next=$((num+1)) - echo "next tag number ${next}" - - local current_tag=`git tag -l --points-at HEAD|grep "linux-release-${tier}"|grep "${catvers}.${num}"` - - if [ -n "${current_tag}" ]; then - echo "tag is on current commit, use $num" - newvers="${catvers}.${num}" - else - #echo "tag is not on current commit" - local prev_tag=`git tag --contains HEAD~1|grep "linux"|grep ${num}` - if [ -n "${prev_tag}" ]; then - #echo "tag is on previous commit" - local prev_log=`git log --oneline HEAD~1..HEAD|grep "linux"|grep "Merge pull"` - if [ -n "${prev_log}" ]; then - echo "latest commit was a merge PR, use $num" - newvers="${catvers}.${num}" - else - if [ "${JENKINS}" == "no" ]; then - echo "latest commit was not a merge PR, use $num and datetime" - newvers="${catvers}.${num}.${datevers}" - else - echo "latest commit was not a merge PR, on jenkins use $next because not tagged yet" - newvers="${catvers}.${next}" - fi - fi - else - if [ "${JENKINS}" == "no" ]; then - echo "tag is not on previous commit, use $num and datetime" - newvers="${catvers}.${num}.${datevers}" - else - echo "tag is not on previous commit, on jenkins use $next because not tagged yet" - newvers="${catvers}.${next}" - fi - fi - fi + tier=${TIER} + newvers=${VERSION} + echo "Found tier ${tier}, version ${newvers}" } diff --git a/mac/Keyman4Mac/Keyman4Mac.xcodeproj/project.pbxproj b/mac/Keyman4Mac/Keyman4Mac.xcodeproj/project.pbxproj index d19e94b630..1e1cf8ae70 100644 --- a/mac/Keyman4Mac/Keyman4Mac.xcodeproj/project.pbxproj +++ b/mac/Keyman4Mac/Keyman4Mac.xcodeproj/project.pbxproj @@ -190,6 +190,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -396,7 +397,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = org.sil.Keyman4Mac; PRODUCT_NAME = "$(TARGET_NAME)"; - PRODUCT_VERSION = 13.0; + PRODUCT_VERSION = 0.0.1; }; name = Debug; }; @@ -417,7 +418,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = org.sil.Keyman4Mac; PRODUCT_NAME = "$(TARGET_NAME)"; - PRODUCT_VERSION = 13.0; + PRODUCT_VERSION = 0.0.1; }; name = Release; }; diff --git a/mac/Keyman4MacIM/Keyman4MacIM.xcodeproj/project.pbxproj b/mac/Keyman4MacIM/Keyman4MacIM.xcodeproj/project.pbxproj index 1e3b5f5333..de85d26ca5 100644 --- a/mac/Keyman4MacIM/Keyman4MacIM.xcodeproj/project.pbxproj +++ b/mac/Keyman4MacIM/Keyman4MacIM.xcodeproj/project.pbxproj @@ -719,7 +719,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "# check that our PRODUCT_VERSION matches this git branch's KM_VERSION from ../../resources/VERSION.md\n(cd .. ; ./is_same_version.sh Keyman4MacIM || exit 1 ; cd -)\n"; + shellScript = "# check that our PRODUCT_VERSION matches this git branch's VERSION from ../../VERSION.md\n(cd .. ; ./is_same_version.sh Keyman4MacIM || exit 1 ; cd -)\n"; showEnvVarsInLog = 0; }; D2FF67BB6C749BA6861F5E25 /* [CP] Check Pods Manifest.lock */ = { @@ -969,7 +969,7 @@ OTHER_CODE_SIGN_FLAGS = "--timestamp"; PRODUCT_BUNDLE_IDENTIFIER = "keyman.inputmethod.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - PRODUCT_VERSION = 13.0; + PRODUCT_VERSION = 0.0.1; PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE_SPECIFIER = ""; STRIP_INSTALLED_PRODUCT = YES; @@ -1009,7 +1009,7 @@ OTHER_CODE_SIGN_FLAGS = "--timestamp"; PRODUCT_BUNDLE_IDENTIFIER = "keyman.inputmethod.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - PRODUCT_VERSION = 13.0; + PRODUCT_VERSION = 0.0.1; PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE_SPECIFIER = ""; STRIP_INSTALLED_PRODUCT = YES; diff --git a/mac/Keyman4MacIM/Keyman4MacIM/InfoPlist.strings b/mac/Keyman4MacIM/Keyman4MacIM/InfoPlist.strings index 9ecb03d226..14875de26c 100644 --- a/mac/Keyman4MacIM/Keyman4MacIM/InfoPlist.strings +++ b/mac/Keyman4MacIM/Keyman4MacIM/InfoPlist.strings @@ -21,7 +21,3 @@ CFBundleDisplayName = "Keyman"; //CFBundleShortVersionString = "10.0"; //CFBundleVersion = "10.0"; //CFBundleGetInfoString = "Keyman 10.0 for macOS, Copyright 2018, SIL International"; - -// The PRODUCT_VERSION only needs to be changed once per version. It should be in sync with -// ../resources/VERSION.md -// There is a Run Script that checks to be sure diff --git a/mac/Keyman4MacIM/make-km-dmg.sh b/mac/Keyman4MacIM/make-km-dmg.sh index ac9c2ff4d3..3749c941b5 100755 --- a/mac/Keyman4MacIM/make-km-dmg.sh +++ b/mac/Keyman4MacIM/make-km-dmg.sh @@ -1,5 +1,11 @@ #!/bin/sh +## START STANDARD BUILD SCRIPT INCLUDE +# adjust relative paths as necessary +THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BASH_SOURCE[0]}")" +. "$(dirname "$THIS_SCRIPT")/../../resources/build/build-utils.sh" +## END STANDARD BUILD SCRIPT INCLUDE + # Please note that this build script (understandably) assumes that it is running on Mac OS X. if [[ "${OSTYPE}" != "darwin"* ]]; then echo "This build script will only run in a Mac environment." @@ -10,10 +16,8 @@ display_usage() { echo "Used to create a disk image containing the Keyman Input Method app." echo "Typically called from the Keyman mac build script." echo - echo "usage: make-km-dmg.sh -version #.#.#" + echo "usage: make-km-dmg.sh" echo - echo " -version #.#.# Specifies the build version number, which should be in the" - echo " form Major.Minor.BuildCounter" echo "Optional switches:" echo " -sourceApp APP The Keyman.app to put into the DMG" echo " -template DMG The DMG image to use as a template (with background image, etc.)" @@ -58,12 +62,6 @@ QUIET=false while [[ $# -gt 0 ]] ; do key="$1" case $key in - -version) - assertValidVersionNbr "$2" - KM_VERSION="$2" - KM_BLD_COUNTER="$((${KM_VERSION##*.}))" - shift # past argument - ;; -sourceApp) if [[ "$2" == "" || "$2" =~ ^\- ]]; then fail "Missing source directory on command line." @@ -112,7 +110,7 @@ while [[ $# -gt 0 ]] ; do done # Step 0 - check parameter and initial file state -if [ "$KM_VERSION" = "" ]; then +if [ "$VERSION" = "" ]; then fail "Required -version parameter not specified!" fi @@ -131,7 +129,7 @@ elif [[ ! -d "$OUTPUT_DIR" ]]; then fi if $ADD_VERSION_TO_DEST_DIR ; then - DEST_DIR="$DEST_DIR/$KM_VERSION" + DEST_DIR="$DEST_DIR/$VERSION" fi if [[ ! -e "$DEST_DIR" ]]; then mkdir -p "$DEST_DIR" @@ -140,7 +138,7 @@ elif [[ ! -d "$DEST_DIR" ]]; then fi # Step 1 - Copy template to working copy to prevent unintended changes -WORKING_COPY_OF_IMAGE="$OUTPUT_DIR/Keyman-temp-$KM_VERSION.dmg" +WORKING_COPY_OF_IMAGE="$OUTPUT_DIR/Keyman-temp-$VERSION.dmg" displayInfo "Copying \"$TEMPLATE_IMAGE\" to \"$WORKING_COPY_OF_IMAGE\"..." if [[ -e "$WORKING_COPY_OF_IMAGE" && "$VERBOSITY" != "-quiet" ]] ; then warn "Overwriting: $WORKING_COPY_OF_IMAGE" @@ -176,7 +174,7 @@ if [[ $? != 0 || -d "$STAGING_DIR" ]] ; then fi # Step 5 - Convert image to a compressed readonly DMG image -DMG_FILE_PATH="$DEST_DIR/keyman-$KM_VERSION.dmg" +DMG_FILE_PATH="$DEST_DIR/keyman-$VERSION.dmg" displayInfo "Converting/compressing image to create \"$DMG_FILE_PATH\"" if [[ -e "$DMG_FILE_PATH" ]] ; then if [[ "$VERBOSITY" != "-quiet" ]] ; then diff --git a/mac/Keyman4MacIM/write-download_info.sh b/mac/Keyman4MacIM/write-download_info.sh index db435253f8..9a30f4611b 100755 --- a/mac/Keyman4MacIM/write-download_info.sh +++ b/mac/Keyman4MacIM/write-download_info.sh @@ -1,5 +1,11 @@ #!/bin/sh +## START STANDARD BUILD SCRIPT INCLUDE +# adjust relative paths as necessary +THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BASH_SOURCE[0]}")" +. "$(dirname "$THIS_SCRIPT")/../../resources/build/build-utils.sh" +## END STANDARD BUILD SCRIPT INCLUDE + # Please note that this build script (understandably) assumes that it is running on Mac OS X. if [[ "${OSTYPE}" != "darwin"* ]]; then echo "This build script will only run in a Mac environment." @@ -11,11 +17,7 @@ display_usage() { echo "to describe the downloadable Keyman Input Method app." echo "Typically called from the Keyman mac build script." echo - echo "usage: write-download_info.sh -version #.#.# -tier TIER [-destDir DIR]" - echo - echo " -version #.#.# Specifies the build version number, which should be in the" - echo " form Major.Minor.BuildCounter" - echo " -tier TIER Specifies tier (typically one of: alpha, beta, stable)." + echo "usage: write-download_info.sh [-destDir DIR]" echo echo " Optional switches:" echo " -destDir DIR Directory where the download_info file should be created" @@ -37,25 +39,14 @@ popd > /dev/null DEST_DIR="$KEYMAN_MACIM_BASE_PATH/output/upload" ADD_VERSION_TO_DEST_DIR=true +KM_BLD_COUNTER="$((${VERSION##*.}))" + # Parse args shopt -s nocasematch while [[ $# -gt 0 ]] ; do key="$1" case $key in - -version) - assertValidVersionNbr "$2" - KM_VERSION="$2" - KM_BLD_COUNTER="$((${KM_VERSION##*.}))" - shift # past argument - ;; - -tier) - if [[ "$2" == "" || "$2" =~ ^\- ]]; then - fail "Missing tier name on command line!" - fi - KM_TIER=$2 - shift # past argument - ;; -destDir) if [[ "$2" == "" || "$2" =~ ^\- ]]; then fail "Missing destination directory on command line." @@ -75,16 +66,8 @@ while [[ $# -gt 0 ]] ; do shift # past argument done -if [ "$KM_VERSION" = "" ]; then - fail "Required -version parameter not specified!" -fi - -if [ "$KM_TIER" = "" ]; then - fail "Required -tier parameter not specified!" -fi - if $ADD_VERSION_TO_DEST_DIR ; then - DEST_DIR="$DEST_DIR/$KM_VERSION" + DEST_DIR="$DEST_DIR/$VERSION" fi if [[ ! -e $DEST_DIR ]]; then mkdir -p $DEST_DIR @@ -92,7 +75,7 @@ elif [[ ! -d $DEST_DIR ]]; then fail "Destination dir exists but is not a directory: $2" fi -DMG_FILENAME="keyman-$KM_VERSION.dmg" +DMG_FILENAME="keyman-$VERSION.dmg" DMG_FILEPATH="$DEST_DIR/$DMG_FILENAME" DOWNLOAD_INFO_FILEPATH="${DMG_FILEPATH}.download_info" if [[ ! -f "$DMG_FILEPATH" ]]; then @@ -107,10 +90,10 @@ fi echo { > "$DOWNLOAD_INFO_FILEPATH" echo " \"name\": \"Keyman4MacIM\"," >> "$DOWNLOAD_INFO_FILEPATH" -echo " \"version\": \"${KM_VERSION}\"," >> "$DOWNLOAD_INFO_FILEPATH" +echo " \"version\": \"${VERSION}\"," >> "$DOWNLOAD_INFO_FILEPATH" echo " \"date\": \"$(date "+%Y-%m-%d")\"," >> "$DOWNLOAD_INFO_FILEPATH" echo " \"platform\": \"mac\"," >> "$DOWNLOAD_INFO_FILEPATH" -echo " \"stability\": \"${KM_TIER}\"," >> "$DOWNLOAD_INFO_FILEPATH" +echo " \"stability\": \"${TIER}\"," >> "$DOWNLOAD_INFO_FILEPATH" echo " \"file\": \"${DMG_FILENAME}\"," >> "$DOWNLOAD_INFO_FILEPATH" echo " \"md5\": \"${DMG_MD5}\"," >> "$DOWNLOAD_INFO_FILEPATH" echo " \"type\": \"dmg\"," >> "$DOWNLOAD_INFO_FILEPATH" diff --git a/mac/KeymanEngine4Mac/KeymanEngine4Mac.xcodeproj/project.pbxproj b/mac/KeymanEngine4Mac/KeymanEngine4Mac.xcodeproj/project.pbxproj index f80d6e3dd9..6ac76a6b7e 100644 --- a/mac/KeymanEngine4Mac/KeymanEngine4Mac.xcodeproj/project.pbxproj +++ b/mac/KeymanEngine4Mac/KeymanEngine4Mac.xcodeproj/project.pbxproj @@ -405,7 +405,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "# check that our PRODUCT_VERSION matches this git branch's KM_VERSION from ../../resources/VERSION.md\n(cd .. ; ./is_same_version.sh KeymanEngine4Mac || exit 1 ; cd -)\n"; + shellScript = "# check that our PRODUCT_VERSION matches this git branch's VERSION from ../../VERSION.md\n(cd .. ; ./is_same_version.sh KeymanEngine4Mac || exit 1 ; cd -)\n"; showEnvVarsInLog = 0; }; E2588F2F1F2647A50061C9C4 /* ShellScript */ = { @@ -591,7 +591,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = org.sil.KeymanEngine4Mac; PRODUCT_NAME = "$(TARGET_NAME)"; - PRODUCT_VERSION = 13.0; + PRODUCT_VERSION = 0.0.1; PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; STRIP_INSTALLED_PRODUCT = NO; @@ -619,7 +619,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = org.sil.KeymanEngine4Mac; PRODUCT_NAME = "$(TARGET_NAME)"; - PRODUCT_VERSION = 13.0; + PRODUCT_VERSION = 0.0.1; PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; STRIP_INSTALLED_PRODUCT = NO; diff --git a/mac/README.md b/mac/README.md index 96d001ef86..3280fc6817 100644 --- a/mac/README.md +++ b/mac/README.md @@ -3,7 +3,8 @@ ## Mac Tools Requirements/Setup Install Xcode 8.3.3 or later (it might also work to use an older version) Install [Carthage](https://github.com/Carthage/Carthage/blob/master/README.md) *see Homebrew note below -Install cocoapods (sudo gem install cocoapods) if not already installed. +Install cocoapods (`sudo gem install cocoapods`) if not already installed. +Install coreutils (`brew install coreutils`) ## Keyman for macOS Development Keyman for macOS can be built from a command line (preferred) or Xcode. diff --git a/mac/build.sh b/mac/build.sh index 3d46c1cb09..e390a1e06a 100755 --- a/mac/build.sh +++ b/mac/build.sh @@ -1,7 +1,19 @@ #!/bin/sh +## START STANDARD BUILD SCRIPT INCLUDE +# adjust relative paths as necessary +THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BASH_SOURCE[0]}")" +. "$(dirname "$THIS_SCRIPT")/../resources/build/build-utils.sh" +## END STANDARD BUILD SCRIPT INCLUDE + +KEYMAN_MAC_BASE_PATH="$KEYMAN_ROOT/mac" + # Include our resource functions; they're pretty useful! -. ../resources/shellHelperFunctions.sh +. "$KEYMAN_ROOT/resources/shellHelperFunctions.sh" + +# This script runs from its own folder +cd "$(dirname "$THIS_SCRIPT")" + # Please note that this build script (understandably) assumes that it is running on Mac OS X. verify_on_mac @@ -16,9 +28,6 @@ display_usage() { echo " l|local $HOME/Library/Input Methods (kills running process if needed)" echo " p|preprelease Builds a DMG and download_info file in output\upload." echo " -deploy-only Suppresses build/clean/test for all targets." - echo " -tier TIER Used with -deploy p to specify tier: alpha (default), beta, or stable." - echo " -version #.#.# Used to specify the build version number, which should be in the" - echo " form Major.Minor.BuildCounter (optional, but expected if deploy preprelease)" echo " -config NAME NAME is passed to xcodebuild as -configuration parameter. Defaults to Debug, unless" echo " the -deploy option is used, in which configuration will be Release (i.e., -config option" echo " is ignored)." @@ -51,15 +60,6 @@ display_usage() { ### DEFINE HELPER FUNCTIONS ### -KEYMAN_MAC_BASE_PATH="${BASH_SOURCE[0]}"; -if ([ -h "${KEYMAN_MAC_BASE_PATH}" ]) then - while([ -h "${KEYMAN_MAC_BASE_PATH}" ]) do KEYMAN_MAC_BASE_PATH=`readlink "${KEYMAN_MAC_BASE_PATH}"`; done -fi -pushd . > /dev/null -cd `dirname ${KEYMAN_MAC_BASE_PATH}` > /dev/null -KEYMAN_MAC_BASE_PATH=`pwd`; -popd > /dev/null - assertOptionsPrecedeTargets() { if [[ "$1" =~ ^\- ]]; then if $PROCESSING_TARGETS ; then @@ -116,9 +116,7 @@ PROCESSING_TARGETS=false CONFIG="Debug" LOCALDEPLOY=false PREPRELEASE=false -KM_TIER="alpha" -KM_VERSION=`cat ../resources/VERSION.md`.0 -UPDATE_VERSION_IN_PLIST=false +UPDATE_VERSION_IN_PLIST=true DO_KEYMANENGINE=true DO_KEYMANIM=true DO_KEYMANTESTAPP=false @@ -155,29 +153,6 @@ while [[ $# -gt 0 ]] ; do SKIP_BUILD=true shift # past argument ;; - -tier) - if [[ "$2" == "" || "$2" =~ ^\- ]]; then - warn "Missing tier name on command line. Using '$KM_TIER' as default..." - else - if [[ "$2" =~ ^(a(lpha)?)$ ]]; then - KM_TIER="alpha" - elif [[ "$2" =~ ^(b(eta)?)$ ]]; then - KM_TIER="beta" - elif [[ "$2" =~ ^(s(table)?)$ ]]; then - KM_TIER="stable" - else - KM_TIER=$2 - fail "Unexpected tier: '$KM_TIER'" - fi - shift # past argument - fi - ;; - -version) - assertValidVersionNbr "$2" - KM_VERSION="$2" - UPDATE_VERSION_IN_PLIST=true - shift # past argument - ;; -config) if [[ "$2" == "" || "$2" =~ ^\- ]]; then warn "Missing config name on command line. Using 'Debug' as default..." @@ -246,11 +221,11 @@ if $SKIP_BUILD ; then CODESIGNING_SUPPRESSION="" fi -BUILD_OPTIONS="-configuration $CONFIG $BUILD_OPTIONS" +BUILD_OPTIONS="-configuration $CONFIG $BUILD_OPTIONS PRODUCT_VERSION=$VERSION" displayInfo "" \ - "KM_VERSION: $KM_VERSION" \ - "KM_TIER: $KM_TIER" \ + "VERSION: $VERSION" \ + "TIER: $TIER" \ "LOCALDEPLOY: $LOCALDEPLOY" \ "PREPRELEASE: $PREPRELEASE" \ "CLEAN: $CLEAN" \ @@ -300,14 +275,15 @@ execBuildCommand() { } updatePlist() { + # TODO: use set_version() to update plist after build instead of the currenet pattern. See ios for example if $UPDATE_VERSION_IN_PLIST ; then KM_COMPONENT_BASE_PATH="$1" KM_COMPONENT_NAME="$2" KM_PLIST="$KM_COMPONENT_BASE_PATH/$KM_COMPONENT_NAME/Info.plist" if [ -f "$KM_PLIST" ]; then - echo "Setting $KM_COMPONENT_NAME version to $KM_VERSION in $KM_PLIST" - /usr/libexec/Plistbuddy -c "Set CFBundleVersion $KM_VERSION" "$KM_PLIST" - /usr/libexec/Plistbuddy -c "Set CFBundleShortVersionString $KM_VERSION" "$KM_PLIST" + echo "Setting $KM_COMPONENT_NAME version to $VERSION in $KM_PLIST" + /usr/libexec/Plistbuddy -c "Set CFBundleVersion $VERSION" "$KM_PLIST" + /usr/libexec/Plistbuddy -c "Set CFBundleShortVersionString $VERSION" "$KM_PLIST" if [[ "$CONFIG" == "Release" && "$KM_COMPONENT_NAME" == "$IM_NAME" ]]; then echo "Setting Fabric APIKey for release build in $KM_PLIST" if [ "$FABRIC_API_KEY_KEYMAN4MACIM" == "" ]; then @@ -445,7 +421,7 @@ if $LOCALDEPLOY ; then elif $PREPRELEASE ; then echo_heading "Preparing files for release deployment..." # Create the disk image - eval "$KM4MIM_BASE_PATH/make-km-dmg.sh" -version $KM_VERSION $QUIET_FLAG + eval "$KM4MIM_BASE_PATH/make-km-dmg.sh" $QUIET_FLAG if [ $? == 0 ]; then displayInfo "Creating disk image succeeded!" "" else @@ -453,7 +429,7 @@ elif $PREPRELEASE ; then fi # Create download info - eval "$KM4MIM_BASE_PATH/write-download_info.sh" -version $KM_VERSION -tier $KM_TIER + eval "$KM4MIM_BASE_PATH/write-download_info.sh" if [ $? == 0 ]; then displayInfo "Writing download_info file succeeded!" "" else diff --git a/mac/is_same_version.sh b/mac/is_same_version.sh index ae6c3b4b95..987735beb7 100755 --- a/mac/is_same_version.sh +++ b/mac/is_same_version.sh @@ -1,9 +1,18 @@ #!/bin/bash -# compares the version of this branch (in ../resources/VERSION.md) to the +# compares the version of this branch (in ../VERSION.md) to the # version in the Xcode project file of the subproject named in $1 # returns zero if they are the same, non-zero if not the same or a problem occurs +## START STANDARD BUILD SCRIPT INCLUDE +# adjust relative paths as necessary +THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BASH_SOURCE[0]}")" +. "$(dirname "$THIS_SCRIPT")/../resources/build/build-utils.sh" +## END STANDARD BUILD SCRIPT INCLUDE + +#TODO: +exit 0 + if [ $# -eq 1 ] then echo the argument is $1 @@ -32,18 +41,15 @@ echo $PROJ_PROD_VERSION_LINE | sed /\ /s///g > ./PROJ_VERSION.md . ./PROJ_VERSION.md echo Product version in the project file PRODUCT_VERSION is $PRODUCT_VERSION -KM_VERSION=`cat ../resources/VERSION.md` +echo Keyman version VERSION is $VERSION -echo Keyman version KM_VERSION is $KM_VERSION - -if [ x$KM_VERSION = x$PRODUCT_VERSION ] +if [ x$VERSION = x$PRODUCT_VERSION ] then echo the versions are the same, all is well. # clean up rm ./PROJ_VERSION.md exit 0 else - echo the version $KM_VERSION and $PRODUCT_VERSION are NOT the same! + echo the version $VERSION and $PRODUCT_VERSION are NOT the same! exit 1 fi - diff --git a/oem/firstvoices/android/app/build.gradle b/oem/firstvoices/android/app/build.gradle index 9141e9e102..82020505df 100644 --- a/oem/firstvoices/android/app/build.gradle +++ b/oem/firstvoices/android/app/build.gradle @@ -4,6 +4,9 @@ plugins { id 'com.github.triplet.play' version '2.5.0' apply false } +ext.rootPath = '../../../../android' +apply from: "$rootPath/version.gradle" + android { compileSdkVersion 29 @@ -24,18 +27,9 @@ android { } } - String env_build_number = System.getenv("BUILD_NUMBER") //assigned by TeamCity, so all caps - String env_build_counter = System.getenv("build_counter") - if (env_build_number != null) { - println "Using build number $env_build_number and counter $env_build_counter from environment" - versionCode env_build_counter as Integer - versionName env_build_number - } else { - String majorMinorVersion = file('$projectDir/../../../../../resources/VERSION.md').text.trim() - versionCode 999 - versionName majorMinorVersion + '.0.0' - println "Using build $majorMinorVersion from project VERSION.md" - } + // VERSION_CODE and VERSION_NAME from version.gradle + versionCode VERSION_CODE as Integer + versionName VERSION_NAME } String env_release_store_file = System.getenv("oem_firstvoices_release_store_file") diff --git a/oem/firstvoices/ios/build_common.sh b/oem/firstvoices/ios/build_common.sh index 3ab810b517..ad823e53d2 100755 --- a/oem/firstvoices/ios/build_common.sh +++ b/oem/firstvoices/ios/build_common.sh @@ -164,10 +164,10 @@ if [ $CODE_SIGN = true ]; then assertDirExists "$ARCHIVE_PATH" # Pass the build number information along to the Plist file of the app. - if [ $BUILD_NUMBER ]; then - echo "Setting version numbers to $BUILD_NUMBER." - /usr/libexec/Plistbuddy -c "Set ApplicationProperties:CFBundleVersion $BUILD_NUMBER" "$ARCHIVE_PATH/Info.plist" - /usr/libexec/Plistbuddy -c "Set ApplicationProperties:CFBundleShortVersionString $BUILD_NUMBER" "$ARCHIVE_PATH/Info.plist" + if [ $VERSION ]; then + echo "Setting version numbers to $VERSION." + /usr/libexec/Plistbuddy -c "Set ApplicationProperties:CFBundleVersion $VERSION" "$ARCHIVE_PATH/Info.plist" + /usr/libexec/Plistbuddy -c "Set ApplicationProperties:CFBundleShortVersionString $VERSION" "$ARCHIVE_PATH/Info.plist" ARCHIVE_APP="$ARCHIVE_PATH/Products/Applications/$TARGET.app" ARCHIVE_KBD="$ARCHIVE_APP/Plugins/SWKeyboard.appex" diff --git a/resources/VERSION.md b/resources/VERSION.md deleted file mode 100644 index 7f27d6b1d9..0000000000 --- a/resources/VERSION.md +++ /dev/null @@ -1 +0,0 @@ -13.0 \ No newline at end of file diff --git a/resources/build/build-utils.sh b/resources/build/build-utils.sh new file mode 100755 index 0000000000..9372d82890 --- /dev/null +++ b/resources/build/build-utils.sh @@ -0,0 +1,88 @@ +#!/bin/bash +# +# This script sets build environment variables: +# VERSION: Full current build version, e.g. "14.0.1" +# VERSION_WIN: Full current build version for Windows, e.g. "14.0.1.0" +# VERSION_RELEASE: Current release version, e.g. "14.0" +# VERSION_MAJOR: Major version, e.g. "14" +# VERSION_MINOR: Minor version, e.g. "0" +# VERSION_PATCH: Patch version, e.g. "1" +# TIER: Current tier, one of "alpha", "beta" or "stable" +# KEYMAN_ROOT: fully resolved root path of Keyman repository +# +# On macOS, this script requires coreutils (`brew install coreutils`) +# +# Here is how to include this script reliably, cross-platform: +# ## START STANDARD BUILD SCRIPT INCLUDE +# # adjust relative paths as necessary +# THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BASH_SOURCE[0]}")" +# . "$(dirname "$THIS_SCRIPT")/../resources/build/build-utils.sh" +# # END STANDARD BUILD SCRIPT INCLUDE +# + +function die () { + # TODO: consolidate this with fail() from shellHelperFunctions.sh + echo + echo "$*" + echo + exit 1 +} + +function findRepositoryRoot() { + # See https://stackoverflow.com/questions/59895/how-to-get-the-source-directory-of-a-bash-script-from-within-the-script-itself + # None of the answers are 100% correct for cross-platform + # On macOS, requires coreutils (`brew install coreutils`) + + local SCRIPT=$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BASH_SOURCE[0]}") + KEYMAN_ROOT=$(dirname $(dirname $(dirname "$SCRIPT"))) + readonly KEYMAN_ROOT +} + +function findVersion() { + local VERSION_MD="$KEYMAN_ROOT/VERSION.md" + VERSION=`cat $VERSION_MD` + [[ "$VERSION" =~ ^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)$ ]] && { + VERSION_MAJOR="${BASH_REMATCH[1]}" + VERSION_MINOR="${BASH_REMATCH[2]}" + VERSION_PATCH="${BASH_REMATCH[3]}" + VERSION_RELEASE="$VERSION_MAJOR.$VERSION_MINOR" + } || { + echo "Invalid VERSION.md file: expected major.minor.patch"; + exit 1; + } + + # Used for Windows, which requires a four part version string + VERSION_WIN="$VERSION.0" + + readonly VERSION + readonly VERSION_MAJOR + readonly VERSION_MINOR + readonly VERSION_PATCH + readonly VERSION_RELEASE + readonly VERSION_WIN +} + +function findTier() { + local TIER_MD="$KEYMAN_ROOT/TIER.md" + TIER=`cat $TIER_MD` + [[ "$TIER" =~ ^(alpha|beta|stable)$ ]] || { + echo "Invalid TIER.md file: expected alpha, beta or stable." + exit 1; + } +} + +function printVersionUtilsDebug() { + echo "KEYMAN_ROOT: $KEYMAN_ROOT" + echo "VERSION: $VERSION" + echo "VERSION_WIN: $VERSION_WIN" + echo "VERSION_RELEASE: $VERSION_RELEASE" + echo "VERSION_MAJOR: $VERSION_MAJOR" + echo "VERSION_MINOR: $VERSION_MINOR" + echo "VERSION_PATCH: $VERSION_PATCH" + echo "TIER: $TIER" +} + +findRepositoryRoot +findVersion +findTier +#printVersionUtilsDebug diff --git a/resources/historyUtils.sh b/resources/build/history/history-utils.sh similarity index 99% rename from resources/historyUtils.sh rename to resources/build/history/history-utils.sh index 1d651273cf..875852179f 100755 --- a/resources/historyUtils.sh +++ b/resources/build/history/history-utils.sh @@ -1,5 +1,8 @@ #!/bin/sh +echo "**TODO** Update script to work with new history/versioning" +exit 1 + _hu_base_dir=$(dirname "$BASH_SOURCE")/.. . $_hu_base_dir/resources/shellHelperFunctions.sh diff --git a/resources/validateAllHistory.sh b/resources/build/history/validate-all-history.sh old mode 100644 new mode 100755 similarity index 84% rename from resources/validateAllHistory.sh rename to resources/build/history/validate-all-history.sh index c6cfdf378f..0efbd7d312 --- a/resources/validateAllHistory.sh +++ b/resources/build/history/validate-all-history.sh @@ -1,4 +1,8 @@ #!/bin/bash + +echo "**TODO** Update script to work with new history/versioning" +exit 1 + FAIL=0 ./validateHistory.sh android || FAIL=$(($FAIL + 1)) ./validateHistory.sh desktop || FAIL=$(($FAIL + 2)) diff --git a/resources/validateHistory.sh b/resources/build/history/validate-history.sh similarity index 70% rename from resources/validateHistory.sh rename to resources/build/history/validate-history.sh index 03a8da18aa..8242c13d32 100755 --- a/resources/validateHistory.sh +++ b/resources/build/history/validate-history.sh @@ -1,3 +1,6 @@ +echo "**TODO** Update script to work with new history/versioning" +exit 1 + _hu_base_dir=$(dirname "$BASH_SOURCE")/.. . $_hu_base_dir/resources/historyUtils.sh diff --git a/resources/build/increment-version.sh b/resources/build/increment-version.sh new file mode 100755 index 0000000000..2e517d119c --- /dev/null +++ b/resources/build/increment-version.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +set -e +set -u + +# +# Usage: increment-version.sh [-commit branch] +# +# Increments the patch version on VERSION.md +# +# If -commit is specified, pushes the new version +# to the repository. branch snould be either +# master or beta. +# + +## START STANDARD BUILD SCRIPT INCLUDE +# adjust relative paths as necessary +THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BASH_SOURCE[0]}")" +. "$(dirname "$THIS_SCRIPT")/build-utils.sh" +## END STANDARD BUILD SCRIPT INCLUDE + +gitbranch=`git branch --show-current` + +if [[ $# -gt 1 ]] && [[ $1 == -commit ]]; then + # We want the action to specify the branch as a consistency check + # for now at least. + action=$1 + branch=$2 + if [ "$branch" != "master" ] && [ "$branch" != "beta" ]; then + echo "Invalid branch $branch specified: must be master or beta." + exit 1 + fi + + if [ "$branch" != "$gitbranch" ]; then + echo "Branch doesn't match currently checked out branch." + exit 2 + fi +else + action="increment" + branch="$gitbranch" +fi + +NEWVERSION="$VERSION_MAJOR.$VERSION_MINOR.$(($VERSION_PATCH + 1))" + +echo "Incrementing $branch version from $VERSION to $NEWVERSION" +echo "$NEWVERSION" > "$KEYMAN_ROOT/VERSION.md" + +if [ "$action" == "-commit" ]; then + pushd "$KEYMAN_ROOT" > /dev/null + message="auto: increment $branch version to $NEWVERSION" + prbranch="auto/version-$branch-$NEWVERSION" + git checkout -b "$prbranch" + git add VERSION.md + git commit -m "$message" + git push origin "$prbranch" + hub pull-request -f --no-edit -b $branch -l auto + git checkout $branch + git branch -D "$prbranch" + popd > /dev/null +fi diff --git a/resources/git-hooks/commit-msg b/resources/git-hooks/commit-msg index ce21376361..2dc4c609b2 100755 --- a/resources/git-hooks/commit-msg +++ b/resources/git-hooks/commit-msg @@ -16,7 +16,7 @@ # Configurable options for types, scopes and message length. # -types=(fix feat chore change docs style refactor test) +types=(fix feat chore change docs style refactor test auto) scopes=(android ci common developer ios linux mac web windows) min_length=4 max_length=72 diff --git a/resources/shellHelperFunctions.sh b/resources/shellHelperFunctions.sh index f18561a794..12b9ed0f2e 100755 --- a/resources/shellHelperFunctions.sh +++ b/resources/shellHelperFunctions.sh @@ -230,12 +230,12 @@ write_download_info() { set_version ( ) { PRODUCT_PATH=$1 - if [ $BUILD_NUMBER ]; then + if [ $VERSION ]; then if [ $2 ]; then # $2 = product name. - echo "Setting version numbers in $2 to $BUILD_NUMBER." + echo "Setting version numbers in $2 to $VERSION." fi - /usr/libexec/Plistbuddy -c "Set CFBundleVersion $BUILD_NUMBER" "$PRODUCT_PATH/Info.plist" - /usr/libexec/Plistbuddy -c "Set CFBundleShortVersionString $BUILD_NUMBER" "$PRODUCT_PATH/Info.plist" + /usr/libexec/Plistbuddy -c "Set CFBundleVersion $VERSION" "$PRODUCT_PATH/Info.plist" + /usr/libexec/Plistbuddy -c "Set CFBundleShortVersionString $VERSION" "$PRODUCT_PATH/Info.plist" fi } diff --git a/web/source/build.sh b/web/source/build.sh index d5ddb1630e..a569033e7c 100755 --- a/web/source/build.sh +++ b/web/source/build.sh @@ -3,6 +3,15 @@ # Compile keymanweb and copy compiled javascript and resources to output/embedded folder # +## START STANDARD BUILD SCRIPT INCLUDE +# adjust relative paths as necessary +THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BASH_SOURCE[0]}")" +. "$(dirname "$THIS_SCRIPT")/../../resources/build/build-utils.sh" +## END STANDARD BUILD SCRIPT INCLUDE + +# This script runs from its own folder +cd "$(dirname "$THIS_SCRIPT")" + display_usage ( ) { echo "build.sh [-ui | -test | -embed | -web | -debug_embedded] [-no_minify] [-clean]" echo @@ -177,7 +186,7 @@ copy_resources ( ) { echo Copy source to $1/src cp -Rf $SOURCE/*.js $1/src cp -Rf $SOURCE/*.ts $1/src - echo $BUILD > $1/src/version.txt + echo $VERSION_PATCH > $1/src/version.txt # Remove KMW Recorder source. rm -f $1/src/recorder_*.ts @@ -212,18 +221,10 @@ NODE_SOURCE="source" ENVIRONMENT_FILE="environment.inc.ts" -VERSION=`cat ../../resources/VERSION.md` - readonly WEB_OUTPUT readonly EMBED_OUTPUT readonly SOURCE -# Get build version -- if not building in TeamCity, then always use 300 -: ${BUILD_COUNTER:=300} -BUILD=$BUILD_COUNTER - -readonly BUILD - # Ensures that we rely first upon the local npm-based install of Typescript. # (Facilitates automated setup for build agents.) PATH="../node_modules/.bin:$PATH" @@ -312,7 +313,8 @@ generate_environment_ts_file ( ) { echo "//Autogenerated file - do not modify! namespace com.keyman.environment { - export var VERSION = \"$VERSION\"; + export var VERSION = \"$VERSION_RELEASE\"; + export var BUILD = $VERSION_PATCH; } " >> $ENVIRONMENT_FILE } @@ -320,13 +322,13 @@ namespace com.keyman.environment { generate_environment_ts_file if [ $FULL_BUILD = true ]; then - echo Compiling build $BUILD + echo Compiling version $VERSION echo "" fi if [ $BUILD_EMBED = true ]; then - echo Compile KMEI/KMEA build $BUILD + echo Compile KMEI/KMEA version $VERSION $compilecmd -p $NODE_SOURCE/tsconfig.embedded.json if [ $? -ne 0 ]; then @@ -347,7 +349,7 @@ if [ $BUILD_EMBED = true ]; then rm $EMBED_OUTPUT/keyman.js 2>/dev/null - minify keyman.js $EMBED_OUTPUT SIMPLE_OPTIMIZATIONS "KeymanBase.__BUILD__=$BUILD" + minify keyman.js $EMBED_OUTPUT SIMPLE_OPTIMIZATIONS assert $EMBED_OUTPUT/keyman.js echo Compiled embedded application saved as $EMBED_OUTPUT/keyman.js @@ -358,7 +360,7 @@ if [ $BUILD_EMBED = true ]; then # Update build number if successful echo - echo KMEA/KMEI build $BUILD compiled and saved under $EMBED_OUTPUT + echo KMEA/KMEI version $VERSION compiled and saved under $EMBED_OUTPUT echo fi fi @@ -381,7 +383,7 @@ if [ $BUILD_COREWEB = true ]; then rm $WEB_OUTPUT/keymanweb.js 2>/dev/null echo Minifying KeymanWeb... - minify keymanweb.js $WEB_OUTPUT SIMPLE_OPTIMIZATIONS "KeymanBase.__BUILD__=$BUILD" + minify keymanweb.js $WEB_OUTPUT SIMPLE_OPTIMIZATIONS assert $WEB_OUTPUT/keymanweb.js echo Compiled KeymanWeb application saved as $WEB_OUTPUT/keymanweb.js @@ -392,7 +394,7 @@ if [ $BUILD_FULLWEB = true ] && [ $DO_MINIFY = true ]; then copy_resources "$WEB_OUTPUT" # Update build number if successful echo - echo KeymanWeb $VERSION build $BUILD compiled and saved under $WEB_OUTPUT + echo KeymanWeb $VERSION compiled and saved under $WEB_OUTPUT echo fi diff --git a/web/source/dom/utils.ts b/web/source/dom/utils.ts index 410aa4bff7..80ffdeec8b 100644 --- a/web/source/dom/utils.ts +++ b/web/source/dom/utils.ts @@ -145,7 +145,7 @@ namespace com.keyman.dom { // only executes when com.keyman.DOMEventHandlers is defined. // // We also bypass this whenever operating in the embedded format. - if(com && com.keyman && com.keyman['DOMEventHandlers'] && !com.keyman.singleton.isEmbedded) { + if(com && com.keyman && com.keyman['DOMEventHandlers'] && !com.keyman['singleton']['isEmbedded']) { let DOMEventHandlers = com.keyman['DOMEventHandlers']; let selectionStart = element.selectionStart; diff --git a/web/source/kmwbase.ts b/web/source/kmwbase.ts index 292bca8638..f203cf106f 100644 --- a/web/source/kmwbase.ts +++ b/web/source/kmwbase.ts @@ -63,7 +63,6 @@ namespace com.keyman { static _srcPath: string; static _rootPath: string; static _protocol: string; - static __BUILD__: number; // Internal objects ['util']: Util; @@ -127,7 +126,7 @@ namespace com.keyman { this.osk = this['osk'] = new com.keyman.osk.OSKManager(); // Load properties from their static variants. - this['build'] = KeymanBase.__BUILD__; + this['build'] = com.keyman.environment.BUILD; this.srcPath = KeymanBase._srcPath; this.rootPath = KeymanBase._rootPath; this.protocol = KeymanBase._protocol; @@ -622,9 +621,6 @@ KeymanBase._srcPath = sPath; KeymanBase._rootPath = sPath.replace(/(https?:\/\/)([^\/]*)(.*)/,'$1$2/'); KeymanBase._protocol = sPath.replace(/(.{3,5}:)(.*)/,'$1'); -/** @define {number} build counter that gets set by the build environment */ -KeymanBase.__BUILD__ = 299; - /** * Base code: Declare major component namespaces, instances, and utility functions */ diff --git a/windows/src/Defines.mak b/windows/src/Defines.mak index b78c425438..e9594b3273 100644 --- a/windows/src/Defines.mak +++ b/windows/src/Defines.mak @@ -1,9 +1,5 @@ # DEBUG=1 -# TODO: Eliminate this hard coded version; used only in windows/src/desktop/help/Makefile -# so convert to .in with mkver transform -KEYMAN_VERSION=13.0 - # # Paths # diff --git a/windows/src/Makefile b/windows/src/Makefile index cd8430be6b..64afd9eedc 100644 --- a/windows/src/Makefile +++ b/windows/src/Makefile @@ -201,13 +201,9 @@ build-release-wrapper-oem: global-versions: mkver-app # Build our root version.txt cd $(ROOT)\src -!ifdef BUILD_NUMBER - # If CI has defined a version for us, then use that. - $(MKVER_APP) -c $(ROOT)\src\version.txt -b $(BUILD_NUMBER) -!else - # Otherwise, we use the major version from resources/VERSION.md and build 9999 for 'debug' - $(MKVER_APP) -c $(ROOT)\src\version.txt -r $(KEYMAN_ROOT)\resources\VERSION.md -!endif + + # We use the version from VERSION.md + $(MKVER_APP) -c $(ROOT)\src\version.txt -r $(KEYMAN_ROOT)\VERSION.md $(MKVER_U) $(ROOT)\src\global\inc\keymanversion_build.in $(ROOT)\src\global\inc\keymanversion_build.h $(ROOT)\src\version.txt $(MKVER_U) $(ROOT)\src\global\delphi\general\keymanversion_build.in $(ROOT)\src\global\delphi\general\keymanversion_build.inc $(ROOT)\src\version.txt diff --git a/windows/src/buildtools/mkver/Main.pas b/windows/src/buildtools/mkver/Main.pas index fde526ac07..1b010fc973 100644 --- a/windows/src/buildtools/mkver/Main.pas +++ b/windows/src/buildtools/mkver/Main.pas @@ -40,7 +40,7 @@ const S_DebugBuildVersion = '9999'; type - TMKVerMode = (mmUnknown, mmSetRootVersionFromBuild, mmSetRootVersionFromVersionMd, mmWriteVersionedFile, mmWriteManifestFile); + TMKVerMode = (mmUnknown, mmSetRootVersionFromVersionMd, mmWriteVersionedFile, mmWriteManifestFile); var FMode: TMKVerMode = mmUnknown; BuildVersion, ResourceMdFilename: string; @@ -86,12 +86,7 @@ begin if s = '-c' then begin RootTemplateFileName := ParamStr(2); - if SameText(ParamStr(3), '-b') then - begin - FMode := mmSetRootVersionFromBuild; - BuildVersion := ParamStr(4); - end - else if SameText(ParamStr(3), '-r') then + if SameText(ParamStr(3), '-r') then begin FMode := mmSetRootVersionFromVersionMd; ResourceMdFilename := ParamStr(4); @@ -308,20 +303,6 @@ begin CloseFile(tfo); end; -procedure WriteRootVersionTemplateFromBuild; -begin - // Transform the string from 1.2.3.4 to 1,2,3,4 for version.txt/version.rc format - BuildVersion := StringReplace(BuildVersion, '.', ',', [rfReplaceAll]); - - with TStringList.Create do - try - Add('PRODUCTVERSION '+BuildVersion); - SaveToFile(RootTemplateFileName); - finally - Free; - end; -end; - procedure WriteRootVersionTemplateFromVersionMd; begin with TStringList.Create do @@ -335,8 +316,9 @@ begin // Transform the string from 1.2 to 1,2 to match version.txt/version.rc format BuildVersion := StringReplace(BuildVersion, '.', ',', [rfReplaceAll]); - // And add the static 9999 version - BuildVersion := BuildVersion + ',' + S_DebugBuildVersion+',0'; + // VERSION.MD has only major.minor.patch, so append ,0 to satisfy Windows + // version patterns + BuildVersion := BuildVersion + ',0'; with TStringList.Create do try @@ -358,11 +340,10 @@ begin if not Init then begin UpdateFiles.Free; - writeln(#13#10+'Usage: kmver -c (-b | -r )'); + writeln(#13#10+'Usage: kmver -c -r '); writeln(' or kmver -v [-u f.in f.out]*