chore(mac): use new version infrastructure

This commit is contained in:
Marc Durdin 2020-01-29 11:15:36 +11:00
parent 7e8121529b
commit ccfef64c99
8 changed files with 65 additions and 105 deletions

View file

@ -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 = 14.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 = 14.0;
PRODUCT_VERSION = 0.0.1;
};
name = Release;
};

View file

@ -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 = 14.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 = 14.0;
PRODUCT_VERSION = 0.0.1;
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE_SPECIFIER = "";
STRIP_INSTALLED_PRODUCT = YES;

View file

@ -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

View file

@ -1,5 +1,7 @@
#!/bin/sh
# 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 +12,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.)"
@ -60,8 +60,7 @@ while [[ $# -gt 0 ]] ; do
case $key in
-version)
assertValidVersionNbr "$2"
KM_VERSION="$2"
KM_BLD_COUNTER="$((${KM_VERSION##*.}))"
VERSION="$2"
shift # past argument
;;
-sourceApp)
@ -112,7 +111,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 +130,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 +139,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 +175,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

View file

@ -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"

View file

@ -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 = 14.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 = 14.0;
PRODUCT_VERSION = 0.0.1;
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
STRIP_INSTALLED_PRODUCT = NO;

View file

@ -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" \
@ -305,9 +280,9 @@ updatePlist() {
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 +420,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" -version $VERSION $QUIET_FLAG
if [ $? == 0 ]; then
displayInfo "Creating disk image succeeded!" ""
else
@ -453,7 +428,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" -version $VERSION -tier $TIER
if [ $? == 0 ]; then
displayInfo "Writing download_info file succeeded!" ""
else

View file

@ -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