From acc4aba32cd999c54436d8fcb430acd5ca2f49a8 Mon Sep 17 00:00:00 2001 From: Darcy Wong Date: Fri, 23 May 2025 05:57:25 +0700 Subject: [PATCH] fix(ios): Apply review comments * Change zip_files to add_zip_files * Clarify flags used for zip vs 7z * Use `zip-excludes` instead of `excludes.in` for the list of file to exclude from the archive --- ios/tools/prepRelease.sh | 8 ++++---- ios/{exclude.in => zip-excludes} | 0 resources/build/zip.inc.sh | 19 ++++++++++++------- 3 files changed, 16 insertions(+), 11 deletions(-) rename ios/{exclude.in => zip-excludes} (100%) diff --git a/ios/tools/prepRelease.sh b/ios/tools/prepRelease.sh index af67632965..cd82520662 100755 --- a/ios/tools/prepRelease.sh +++ b/ios/tools/prepRelease.sh @@ -74,13 +74,13 @@ ZIP_FLAGS=("-q" "-r" "-X") # quiet, recursive, no-extra echo "Zipping ${FRAMEWORK} => ${UPLOAD_DIR}/${KMEI_DST}..." cd "${KMEI_FRAMEWORK_BASE}" -zip_files "${KMEI_DST}" "${ZIP_FLAGS[@]}" "${FRAMEWORK}" +add_zip_files "${KMEI_DST}" "${ZIP_FLAGS[@]}" "${FRAMEWORK}" cd "$WORK_DIR" echo "Copying Keyman Engine samples into ${UPLOAD_DIR}/${KMEI_DST_NAME}..." cp -rf "${KEYMAN_SAMPLES}" "${UPLOAD_DIR}/samples" cd "${UPLOAD_DIR}" -zip_files "${KMEI_DST_NAME}" "-x@../../exclude.in" "${ZIP_FLAGS[@]}" "samples" +add_zip_files "${KMEI_DST_NAME}" "-x@../../zip-excludes" "${ZIP_FLAGS[@]}" "samples" rm -rf "samples" cd "$WORK_DIR" @@ -100,7 +100,7 @@ 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_files "${WORK_DIR}/${UPLOAD_DIR}/${KEYMANAPP_SIM_APP_DST}" "${ZIP_FLAGS[@]}" "Keyman.app" +add_zip_files "${WORK_DIR}/${UPLOAD_DIR}/${KEYMANAPP_SIM_APP_DST}" "${ZIP_FLAGS[@]}" "Keyman.app" echo "${WORK_DIR}/${UPLOAD_DIR}/${KEYMANAPP_SIM_APP_DST}" cd "$WORK_DIR" @@ -121,7 +121,7 @@ if [ "${RELEASE_OEM_FIRSTVOICES}" = true ]; then echo "Zipping FirstVoices simulator artifact ${FIRSTVOICESAPP_SIM_APP} => ${UPLOAD_DIR}/${KEYMANAPP_SIM_APP_DST}..." cd "${FIRSTVOICESAPP_SIM_FOLDER}" - zip_files "${WORK_DIR}/${UPLOAD_DIR}/${FIRSTVOICESAPP_SIM_APP_DST}" "${ZIP_FLAGS[@]}" "FirstVoices.app" + add_zip_files "${WORK_DIR}/${UPLOAD_DIR}/${FIRSTVOICESAPP_SIM_APP_DST}" "${ZIP_FLAGS[@]}" "FirstVoices.app" cd "$WORK_DIR" fi diff --git a/ios/exclude.in b/ios/zip-excludes similarity index 100% rename from ios/exclude.in rename to ios/zip-excludes diff --git a/resources/build/zip.inc.sh b/resources/build/zip.inc.sh index bef8616024..3dc6a390c2 100644 --- a/resources/build/zip.inc.sh +++ b/resources/build/zip.inc.sh @@ -8,13 +8,14 @@ # # TODO: refactor with /resources/build/win/zip.inc.sh -# zip/7z to create an archive with the following parameters (in order) +# Add files to create a zip/7z archive with the following parameters (in order) # [zip filename] -# [list of flags to pass to zip command. Flags start with a single-dash +# [list of flags to pass to zip command] Flags start with a single-dash # -x@filename for a file containing list of files to exclude from the archive -# -* all other flags] +# -* all other flags +# Flags passed in are treated as zip parameters, and internally converterted to 7z flags as applicable # [list of files to include in zip] -function zip_files() { +function add_zip_files() { # Parse parameters @@ -29,11 +30,13 @@ function zip_files() { while [[ $# -gt 0 ]] ; do case "$1" in -r) - # Common flags to zip and 7z + # recursive paths - Identical flag to zip and 7z ZIP_FLAGS+=($1) SEVENZ_FLAGS+=($1) shift ;; + + # Zip flags that have a corresponding 7z flag -q) # quiet mode -> disable progress indicator, set output log level 0 ZIP_FLAGS+=($1) @@ -52,11 +55,13 @@ function zip_files() { fi shift; ;; + -*) - # Rest of zip flags. + # Remaining zip flags that don't apply to 7z ZIP_FLAGS+=($1) shift ;; + *) # files to include in the archive INCLUDE+=($1) @@ -88,7 +93,7 @@ function zip_files() { fi # Create archive - builder_echo_debug "${COMPRESS_CMD} ${SEVENZ_FLAGS[@]} ${ZIP_FLAGS[@]} ${ZIP_FILE} ${INCLUDE[@]}" + # builder_echo_debug "${COMPRESS_CMD} ${SEVENZ_FLAGS[@]} ${ZIP_FLAGS[@]} ${ZIP_FILE} ${INCLUDE[@]}" "${COMPRESS_CMD}" ${SEVENZ_FLAGS[@]} ${ZIP_FLAGS[@]} ${ZIP_FILE} ${INCLUDE[@]} }