From 3f60b8bcad48fd672c8706c9e108253383b6a1a4 Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Tue, 28 Jan 2020 14:23:00 +1100 Subject: [PATCH 01/19] chore: start 14.0 --- history.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 history.md diff --git a/history.md b/history.md new file mode 100644 index 0000000000..218bda7b97 --- /dev/null +++ b/history.md @@ -0,0 +1,5 @@ +# Keyman Version History + +## 14.0 alpha + +chore: Starting 14.0 release \ No newline at end of file From b7f9a83c63c80ada3a8ef68b642de113b7382773 Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Tue, 28 Jan 2020 14:30:04 +1100 Subject: [PATCH 02/19] chore: version numbers --- mac/Keyman4Mac/Keyman4Mac.xcodeproj/project.pbxproj | 4 ++-- mac/Keyman4MacIM/Keyman4MacIM.xcodeproj/project.pbxproj | 4 ++-- .../KeymanEngine4Mac.xcodeproj/project.pbxproj | 4 ++-- resources/VERSION.md | 2 +- windows/src/Defines.mak | 2 +- windows/src/global/delphi/general/KeymanVersion.pas | 1 + windows/src/global/inc/keymanversion.h | 2 ++ 7 files changed, 11 insertions(+), 8 deletions(-) diff --git a/mac/Keyman4Mac/Keyman4Mac.xcodeproj/project.pbxproj b/mac/Keyman4Mac/Keyman4Mac.xcodeproj/project.pbxproj index d19e94b630..8a0d055e37 100644 --- a/mac/Keyman4Mac/Keyman4Mac.xcodeproj/project.pbxproj +++ b/mac/Keyman4Mac/Keyman4Mac.xcodeproj/project.pbxproj @@ -396,7 +396,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 = 14.0; }; name = Debug; }; @@ -417,7 +417,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 = 14.0; }; name = Release; }; diff --git a/mac/Keyman4MacIM/Keyman4MacIM.xcodeproj/project.pbxproj b/mac/Keyman4MacIM/Keyman4MacIM.xcodeproj/project.pbxproj index 1e3b5f5333..3961e9c61e 100644 --- a/mac/Keyman4MacIM/Keyman4MacIM.xcodeproj/project.pbxproj +++ b/mac/Keyman4MacIM/Keyman4MacIM.xcodeproj/project.pbxproj @@ -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 = 14.0; 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 = 14.0; PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE_SPECIFIER = ""; STRIP_INSTALLED_PRODUCT = YES; diff --git a/mac/KeymanEngine4Mac/KeymanEngine4Mac.xcodeproj/project.pbxproj b/mac/KeymanEngine4Mac/KeymanEngine4Mac.xcodeproj/project.pbxproj index f80d6e3dd9..4191b03ea7 100644 --- a/mac/KeymanEngine4Mac/KeymanEngine4Mac.xcodeproj/project.pbxproj +++ b/mac/KeymanEngine4Mac/KeymanEngine4Mac.xcodeproj/project.pbxproj @@ -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 = 14.0; 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 = 14.0; PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; STRIP_INSTALLED_PRODUCT = NO; diff --git a/resources/VERSION.md b/resources/VERSION.md index 7f27d6b1d9..ed9d00f9a5 100644 --- a/resources/VERSION.md +++ b/resources/VERSION.md @@ -1 +1 @@ -13.0 \ No newline at end of file +14.0 diff --git a/windows/src/Defines.mak b/windows/src/Defines.mak index b78c425438..50faaa558d 100644 --- a/windows/src/Defines.mak +++ b/windows/src/Defines.mak @@ -2,7 +2,7 @@ # 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 +KEYMAN_VERSION=14.0 # # Paths diff --git a/windows/src/global/delphi/general/KeymanVersion.pas b/windows/src/global/delphi/general/KeymanVersion.pas index dddfcd8e09..ce49c43b84 100644 --- a/windows/src/global/delphi/general/KeymanVersion.pas +++ b/windows/src/global/delphi/general/KeymanVersion.pas @@ -23,6 +23,7 @@ interface // we have a back-compat need to refer to a specific version. const + SKeymanVersion140 = '14.0'; SKeymanVersion130 = '13.0'; SKeymanVersion120 = '12.0'; SKeymanVersion110 = '11.0'; diff --git a/windows/src/global/inc/keymanversion.h b/windows/src/global/inc/keymanversion.h index e9db07f705..644095dd7e 100644 --- a/windows/src/global/inc/keymanversion.h +++ b/windows/src/global/inc/keymanversion.h @@ -6,6 +6,7 @@ // We should not need to add to these hard-coded version numbers for future versions, unless // we have a back-compat need to refer to a specific version. +#define KEYMANVERSION140 "14.0" #define KEYMANVERSION130 "13.0" #define KEYMANVERSION120 "12.0" #define KEYMANVERSION110 "11.0" @@ -13,6 +14,7 @@ #define KEYMANVERSION90 "9.0" #define KEYMANVERSION80 "8.0" +#define KEYMANVERSION140W L"13.0" #define KEYMANVERSION130W L"13.0" #define KEYMANVERSION120W L"12.0" #define KEYMANVERSION110W L"11.0" From d5fe536eef7f87c694ebe510a4735a97b6f4028d Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Wed, 29 Jan 2020 08:54:32 +1100 Subject: [PATCH 03/19] chore: start history/version infrastructure --- HISTORY.md | 7 ++ TIER.md | 1 + VERSION.md | 2 +- docs/history-and-versioning.md | 49 +++++++++++++ history.md | 5 -- ios/README.md | 1 + mac/README.md | 3 +- resources/VERSION.md | 1 - resources/build/build-utils.sh | 71 +++++++++++++++++++ .../history/history-utils.sh} | 3 + .../history/validate-all-history.sh} | 4 ++ .../history/validate-history.sh} | 3 + 12 files changed, 142 insertions(+), 8 deletions(-) create mode 100644 HISTORY.md create mode 100644 TIER.md create mode 100644 docs/history-and-versioning.md delete mode 100644 history.md delete mode 100644 resources/VERSION.md create mode 100644 resources/build/build-utils.sh rename resources/{historyUtils.sh => build/history/history-utils.sh} (99%) mode change 100755 => 100644 rename resources/{validateAllHistory.sh => build/history/validate-all-history.sh} (84%) rename resources/{validateHistory.sh => build/history/validate-history.sh} (70%) mode change 100755 => 100644 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/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/history.md b/history.md deleted file mode 100644 index 218bda7b97..0000000000 --- a/history.md +++ /dev/null @@ -1,5 +0,0 @@ -# Keyman Version History - -## 14.0 alpha - -chore: Starting 14.0 release \ No newline at end of file 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/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/resources/VERSION.md b/resources/VERSION.md deleted file mode 100644 index ed9d00f9a5..0000000000 --- a/resources/VERSION.md +++ /dev/null @@ -1 +0,0 @@ -14.0 diff --git a/resources/build/build-utils.sh b/resources/build/build-utils.sh new file mode 100644 index 0000000000..d110b75140 --- /dev/null +++ b/resources/build/build-utils.sh @@ -0,0 +1,71 @@ +#!/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`) +# + +function die () { + 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"))) +} + +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; + } + + VERSION_WIN="$VERSION.0" +} + +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 old mode 100755 new mode 100644 similarity index 99% rename from resources/historyUtils.sh rename to resources/build/history/history-utils.sh index 1d651273cf..875852179f --- 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 similarity index 84% rename from resources/validateAllHistory.sh rename to resources/build/history/validate-all-history.sh index c6cfdf378f..0efbd7d312 100644 --- 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 old mode 100755 new mode 100644 similarity index 70% rename from resources/validateHistory.sh rename to resources/build/history/validate-history.sh index 03a8da18aa..8242c13d32 --- 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 From 742aee39d7f6ec6df5986e9685f03f25eb8e253d Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Wed, 29 Jan 2020 08:55:19 +1100 Subject: [PATCH 04/19] chore(android): use new version infrastructure --- android/KMAPro/kMAPro/build.gradle | 18 +++------ android/KMEA/app/build.gradle | 18 +++------ android/KMEA/build.sh | 12 ++++-- android/Samples/KMSample1/app/build.gradle | 9 ++++- android/Samples/KMSample2/app/build.gradle | 9 ++++- .../Tests/KeyboardHarness/app/build.gradle | 9 ++++- android/Tests/keycode/app/build.gradle | 9 ++++- android/build-help.sh | 20 ++++++---- android/build.sh | 19 +++++---- android/version.gradle | 39 +++++++++++++++++++ 10 files changed, 109 insertions(+), 53 deletions(-) create mode 100644 android/version.gradle diff --git a/android/KMAPro/kMAPro/build.gradle b/android/KMAPro/kMAPro/build.gradle index ec03aeb697..3ef764f8bf 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 + 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..83e0a24bc7 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 + 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..8a23ad6960 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 + versionName VERSION_NAME } buildTypes { release { diff --git a/android/Samples/KMSample2/app/build.gradle b/android/Samples/KMSample2/app/build.gradle index e0302f6747..6d17a326cc 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 + versionName VERSION_NAME } buildTypes { release { diff --git a/android/Tests/KeyboardHarness/app/build.gradle b/android/Tests/KeyboardHarness/app/build.gradle index aceb9242d8..6366523561 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 + versionName VERSION_NAME } buildTypes { release { diff --git a/android/Tests/keycode/app/build.gradle b/android/Tests/keycode/app/build.gradle index 197dc7a8a5..5bf8162bcc 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 + 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 From 6f5f37ae821489a2e3fe9576056885f386a413dd Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Wed, 29 Jan 2020 09:15:21 +1100 Subject: [PATCH 05/19] chore(web): use new version infrastructure --- common/predictive-text/build.sh | 12 +++++++++++- resources/build/build-utils.sh | 17 +++++++++++++++++ web/source/build.sh | 33 +++++++++++++++++---------------- 3 files changed, 45 insertions(+), 17 deletions(-) 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/resources/build/build-utils.sh b/resources/build/build-utils.sh index d110b75140..9372d82890 100644 --- a/resources/build/build-utils.sh +++ b/resources/build/build-utils.sh @@ -12,8 +12,16 @@ # # 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 @@ -27,6 +35,7 @@ function findRepositoryRoot() { 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() { @@ -42,7 +51,15 @@ function findVersion() { 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() { diff --git a/web/source/build.sh b/web/source/build.sh index d5ddb1630e..bda0ddc5d2 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,7 @@ generate_environment_ts_file ( ) { echo "//Autogenerated file - do not modify! namespace com.keyman.environment { - export var VERSION = \"$VERSION\"; + export var VERSION = \"$VERSION_RELEASE\"; } " >> $ENVIRONMENT_FILE } @@ -320,13 +321,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 +348,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 "KeymanBase.__BUILD__=$VERSION_PATCH" assert $EMBED_OUTPUT/keyman.js echo Compiled embedded application saved as $EMBED_OUTPUT/keyman.js @@ -358,7 +359,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 +382,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 "KeymanBase.__BUILD__=$VERSION_PATCH" assert $WEB_OUTPUT/keymanweb.js echo Compiled KeymanWeb application saved as $WEB_OUTPUT/keymanweb.js @@ -392,7 +393,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 From 58d4fb72e85cd78719cd5b1f865eeb39f57fe379 Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Wed, 29 Jan 2020 09:59:50 +1100 Subject: [PATCH 06/19] chore(windows): use new version infrastructure --- windows/src/Defines.mak | 4 -- windows/src/Makefile | 42 +++++++++---------- windows/src/buildtools/mkver/Main.pas | 37 ++++------------ windows/src/buildtools/mkver/mkver.dproj | 3 +- windows/src/desktop/help/Makefile | 8 ++-- windows/src/desktop/help/install.in | 10 +++++ .../global/delphi/general/KeymanVersion.pas | 1 - windows/src/global/inc/keymanversion.h | 2 - 8 files changed, 43 insertions(+), 64 deletions(-) create mode 100644 windows/src/desktop/help/install.in diff --git a/windows/src/Defines.mak b/windows/src/Defines.mak index 50faaa558d..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=14.0 - # # Paths # diff --git a/windows/src/Makefile b/windows/src/Makefile index cd8430be6b..f2a75a3f45 100644 --- a/windows/src/Makefile +++ b/windows/src/Makefile @@ -6,24 +6,24 @@ default: @echo The following make targets are available: - @echo     build                 builds everything except help files (-DBUILDHELP to build help) - @echo     install               installs packages into Delphi IDE (run after a build) - @echo     clean                 removes all temp files - @echo     release               make a release - @echo     web-install           sends the documentation to the website - @echo     test-certificate      create a test certificate + CA (and install test CA) - @echo     signcode              sign the build artifacts + @echo ����build�����������������builds everything except help files (-DBUILDHELP to build help) + @echo ����install ���� ���� ����installs packages into Delphi IDE (run after a build) + @echo ����clean�������������� ��removes all temp files + @echo ����release���������������make a release + @echo ����web-install�����������sends the documentation to the website + @echo ����test-certificate������create a test certificate + CA (and install test CA) + @echo ����signcode��������������sign the build artifacts @echo. - @echo     Build flags: - @echo           DEBUG           Include debug information - @echo           SC_TIMESTAMP    Don't timestamp certificates (for internal releases only, offline) - @echo           BUILDHELP       Build the helpfiles (implicit when 'make release') - @echo           LINT            Turns on $MESSAGE hints and warnings and all extra string warnings - @echo           QUIET           Ignore hints and warnings - @echo           RELEASE_OEM     Build executables for third party products in oem folder (e.g. FirstVoices) + @echo ����Build flags: + @echo ����������DEBUG ����������Include debug information + @echo ����������SC_TIMESTAMP ���Don't timestamp certificates (for internal releases only, offline) + @echo ����������BUILDHELP ������Build the helpfiles (implicit when 'make release') + @echo ����������LINT ���� ���� �Turns on $MESSAGE hints and warnings and all extra string warnings + @echo ����������QUIET ���� ���� Ignore hints and warnings + @echo ����������RELEASE_OEM ����Build executables for third party products in oem folder (e.g. FirstVoices) @echo. - @echo     To view help on the build process, in /src/inst, run: - @echo           make help + @echo ����To view help on the build process, in /src/inst, run: + @echo ����������make help @echo. # ---------------------------------------------------------------------- @@ -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]*