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
This commit is contained in:
Darcy Wong 2025-05-23 05:57:25 +07:00
parent 04629414e8
commit acc4aba32c
3 changed files with 16 additions and 11 deletions

View file

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

View file

@ -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[@]}
}