Merge pull request #5557 from keymanapp/feat/ios/simulator-build-artifact

feat(ios): adds option for Simulator-compatible testing artifact
This commit is contained in:
Joshua Horton 2021-08-17 08:26:15 +07:00 committed by GitHub
commit 30296fe113
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 70 additions and 17 deletions

View file

@ -24,7 +24,7 @@ cd "$(dirname "$THIS_SCRIPT")"
verify_on_mac
display_usage ( ) {
echo "build.sh [-clean] [-no-kmw] [-only-framework] [-no-codesign] [-no-archive] [-no-build] [-upload-sentry]"
echo "build.sh [-clean] [-no-kmw] [-only-framework] [-no-codesign] [-no-archive] [-add-sim-artifact] [-no-build] [-upload-sentry]"
echo
echo " -clean Removes all previously-existing build products for KMEI and the Keyman app before building."
echo " -no-kmw Uses existing keyman.js, doesn't try to build"
@ -37,6 +37,7 @@ display_usage ( ) {
echo " -upload-sentry Uploads debug symbols, etc, to Sentry"
echo " -debug Sets the configuration to debug mode instead of release."
echo " -download-resources Download up-to-date versions of the engine's default resources from downloads.keyman.com."
echo " -add-sim-artifact Also produce a Simulator-installable .app build artifact"
exit 1
}
@ -55,6 +56,7 @@ BUILD_PATH=$DERIVED_DATA/Build/Products
DO_KMW_BUILD=true
DO_KEYMANAPP=true
DO_ARCHIVE=true
DO_SIMULATOR_TARGET=false
DO_CARTHAGE=true
CLEAN_ONLY=false
CONFIG=Release
@ -104,6 +106,9 @@ while [[ $# -gt 0 ]] ; do
-download-resources)
DO_KMP_DOWNLOADS=true
;;
-add-sim-artifact)
DO_SIMULATOR_TARGET=true
;;
esac
shift # past argument
done
@ -284,7 +289,7 @@ if [ $DO_KEYMANAPP = true ]; then
else
# Time to prepare the deployment archive data.
echo ""
echo "Preparing .xcarchive."
echo "Preparing .xcarchive for real devices."
xcodebuild $XCODEFLAGS_EXT $CODE_SIGN -scheme Keyman \
-archivePath $ARCHIVE_PATH \
archive -allowProvisioningUpdates \
@ -296,13 +301,25 @@ if [ $DO_KEYMANAPP = true ]; then
assertDirExists "$ARCHIVE_PATH"
if [ $DO_CODE_SIGN == true ]; then
echo "Preparing .ipa file for deployment"
echo "Preparing .ipa file for deployment to real devices"
# Do NOT use the _EXT variant here; there's no scheme to ref, which will lead
# Xcode to generate a build error.
xcodebuild $XCODEFLAGS -exportArchive -archivePath $ARCHIVE_PATH \
-exportOptionsPlist exportAppStore.plist \
-exportPath $BUILD_PATH/${CONFIG}-iphoneos -allowProvisioningUpdates
fi
fi
if [ $DO_SIMULATOR_TARGET == true ]; then
echo "Preparing .app file for simulator-targeted artifact for testing"
xcodebuild $XCODEFLAGS_EXT $CODE_SIGN -scheme Keyman \
-sdk iphonesimulator \
VERSION=$VERSION \
VERSION_WITH_TAG=$VERSION_WITH_TAG \
VERSION_ENVIRONMENT=$VERSION_ENVIRONMENT \
UPLOAD_SENTRY=$UPLOAD_SENTRY
fi
echo ""
if [ $? = 0 ]; then
echo "Build succeeded."

View file

@ -89,19 +89,38 @@ cd $WORK_DIR
KEYMANAPP_IPA="build/Build/Products/Release-iphoneos/Keyman.ipa"
KEYMANAPP_IPA_DST="keyman-ios-${BUILD_NUMBER}.ipa"
echo "Copying Keyman IPA ${KEYMANAPP_IPA} => ${UPLOAD_DIR}/${KEYMANAPP_IPA/DST}..."
echo "Copying Keyman IPA ${KEYMANAPP_IPA} => ${UPLOAD_DIR}/${KEYMANAPP_IPA_DST}..."
cp "${KEYMANAPP_IPA}" "${WORK_DIR}/${UPLOAD_DIR}/${KEYMANAPP_IPA_DST}"
KEYMANAPP_SIM_FOLDER="build/Build/Products/Release-iphonesimulator"
KEYMANAPP_SIM_APP="$KEYMANAPP_SIM_FOLDER/Keyman.app"
KEYMANAPP_SIM_APP_DST="keyman-ios-simulator-${BUILD_NUMBER}.app.zip"
echo "Zipping Keyman simulator artifact ${KEYMANAPP_SIM_APP} => ${UPLOAD_DIR}/${KEYMANAPP_SIM_APP_DST}..."
cd "${KEYMANAPP_SIM_FOLDER}"
zip -qrX "${WORK_DIR}/${UPLOAD_DIR}/${KEYMANAPP_SIM_APP_DST}" "Keyman.app"
echo "${WORK_DIR}/${UPLOAD_DIR}/${KEYMANAPP_SIM_APP_DST}"
cd "$WORK_DIR"
#
# FirstVoices app
#
if [ ${RELEASE_OEM_FIRSTVOICES} = true ]; then
if [ "${RELEASE_OEM_FIRSTVOICES}" = true ]; then
FIRSTVOICESAPP_IPA="../oem/firstvoices/ios/build/Build/Products/Release-iphoneos/FirstVoices.ipa"
FIRSTVOICESAPP_IPA_DST="firstvoices-ios-${BUILD_NUMBER}.ipa"
echo "Copying FirstVoices IPA ${FIRSTVOICESAPP_IPA} => ${UPLOAD_DIR}/${FIRSTVOICESAPP_IPA/DST}..."
echo "Copying FirstVoices IPA ${FIRSTVOICESAPP_IPA} => ${UPLOAD_DIR}/${FIRSTVOICESAPP_IPA_DST}..."
cp "${FIRSTVOICESAPP_IPA}" "${WORK_DIR}/${UPLOAD_DIR}/${FIRSTVOICESAPP_IPA_DST}"
FIRSTVOICESAPP_SIM_FOLDER="../oem/firstvoices/ios/build/Build/Products/Release-iphonesimulator/"
FIRSTVOICESAPP_SIM_APP="$FIRSTVOICESAPP_SIM_FOLDER/FirstVoices.app"
FIRSTVOICESAPP_SIM_APP_DST="firstvoices-ios-simulator-${BUILD_NUMBER}.app.zip"
echo "Zipping FirstVoices simulator artifact ${FIRSTVOICESAPP_SIM_APP} => ${UPLOAD_DIR}/${KEYMANAPP_SIM_APP_DST}..."
cd "${FIRSTVOICESAPP_SIM_FOLDER}"
zip -qrX "${WORK_DIR}/${UPLOAD_DIR}/${FIRSTVOICESAPP_SIM_APP_DST}" "FirstVoices.app"
cd "$WORK_DIR"
fi
#
@ -115,4 +134,4 @@ write_download_info "Keyman for iPhone and iPad" "${KEYMANAPP_IPA_DST}" "${BUILD
if [ ${RELEASE_OEM_FIRSTVOICES} = true ]; then
write_download_info "FirstVoices Keyboards" "${FIRSTVOICESAPP_IPA_DST}" "${BUILD_NUMBER}" "${TIER}" "ios"
fi
fi

View file

@ -22,13 +22,14 @@ fi
display_usage ( ) {
echo "build.sh [-no-update] | [-no-archive] | [-lib-build] | [-lib-ignore] | [-clean]"
echo
echo " -clean Removes all previously-existing build products for this project before building."
echo " -no-update If an in-place copy of KeymanEngine.framework exists, does not seek out an updated copy."
echo " -lib-build Actively rebuilds KMEI before copying its build products to project resources."
echo " -lib-nobuild Prevents the build script from building KeymanEngine under any circumstances."
echo " -no-carthage Disables downloading and building for dependencies."
echo " -no-codesign Performs the build without code signing."
echo " -debug Sets the configuration to debug mode instead of release."
echo " -clean Removes all previously-existing build products for this project before building."
echo " -no-update If an in-place copy of KeymanEngine.framework exists, does not seek out an updated copy."
echo " -lib-build Actively rebuilds KMEI before copying its build products to project resources."
echo " -lib-nobuild Prevents the build script from building KeymanEngine under any circumstances."
echo " -no-carthage Disables downloading and building for dependencies."
echo " -no-codesign Performs the build without code signing."
echo " -debug Sets the configuration to debug mode instead of release."
echo " -add-sim-artifact Also produce a Simulator-installable .app build artifact"
echo
echo " If no settings are specified this script will grab a copy of the most recent build of KeymanEngine,"
echo " performing an initial build of it if necessary."
@ -60,6 +61,7 @@ do_clean ( ) {
DO_UPDATE=true
DO_ARCHIVE=true
DO_SIMULATOR_TARGET=false
DO_CARTHAGE=true
FORCE_KMEI_BUILD=false
ALLOW_KMEI_BUILD=true
@ -103,6 +105,9 @@ while [[ $# -gt 0 ]] ; do
CONFIG=Debug
KMEI_FLAGS="$KMEI_FLAGS -debug"
;;
-add-sim-artifact)
DO_SIMULATOR_TARGET=true
;;
esac
shift
done
@ -186,25 +191,37 @@ if [ $CODE_SIGN = true ]; then
if [ $DO_ARCHIVE = true ]; then
# Time to prepare the deployment archive data.
echo ""
echo "Preparing .ipa file for deployment."
echo "Preparing .ipa file for deployment to real devices."
xcodebuild $XCODEFLAGS_EXT -scheme $TARGET -archivePath $ARCHIVE_PATH archive -allowProvisioningUpdates \
VERSION=$VERSION \
VERSION_WITH_TAG=$VERSION_WITH_TAG
assertDirExists "$ARCHIVE_PATH"
# Do NOT use the _EXT variant here; there's no scheme to ref, which will lead
# Xcode to generate a build error.
xcodebuild $XCODEFLAGS -exportArchive -archivePath $ARCHIVE_PATH -exportOptionsPlist exportAppStore.plist \
-exportPath $BUILD_PATH/${CONFIG}-iphoneos -allowProvisioningUpdates \
VERSION=$VERSION \
VERSION_WITH_TAG=$VERSION_WITH_TAG
else
xcodebuild $XCODEFLAGS -scheme "$TARGET" \
xcodebuild $XCODEFLAGS_EXT -scheme "$TARGET" \
VERSION=$VERSION \
VERSION_WITH_TAG=$VERSION_WITH_TAG
fi
else
xcodebuild CODE_SIGN_ENTITLEMENTS="" CODE_SIGNING_ALLOWED="NO" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO \
$XCODEFLAGS -scheme "$TARGET" \
$XCODEFLAGS_EXT -scheme "$TARGET" \
VERSION=$VERSION \
VERSION_WITH_TAG=$VERSION_WITH_TAG
fi
if [ $DO_SIMULATOR_TARGET == true ]; then
echo "Preparing .app file as Simulator-targeted build artifact."
xcodebuild CODE_SIGN_ENTITLEMENTS="" CODE_SIGNING_ALLOWED="NO" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO \
$XCODEFLAGS_EXT -scheme "$TARGET" \
-sdk iphonesimulator \
VERSION=$VERSION \
VERSION_WITH_TAG=$VERSION_WITH_TAG
fi