add -i flag for dev convenience so build all isn't run when not required

This commit is contained in:
julian 2024-05-22 15:28:16 -06:00
parent 46a5548cb8
commit 9d872754ef

View file

@ -13,27 +13,49 @@ usage() {
exit 1 exit 1
} }
# check for required number of args # required args
if [ $# -ne 8 ]; then
usage
fi
unset -v APP_VERSION_STRING unset -v APP_VERSION_STRING
unset -v APP_BUILD_NUMBER unset -v APP_BUILD_NUMBER
unset -v APP_BUILD_PLATFORM unset -v APP_BUILD_PLATFORM
unset -v APP_NAMED_ID unset -v APP_NAMED_ID
# optional args (with defaults)
BUILD_CRYPTO_PLUGINS=0
# Parse command-line arguments. # Parse command-line arguments.
while getopts "v:b:p:a:" opt; do while getopts "v:b:p:a:i" opt; do
case "$opt" in case "${opt}" in
v) APP_VERSION_STRING="$OPTARG" ;; v) APP_VERSION_STRING="$OPTARG" ;;
b) APP_BUILD_NUMBER="$OPTARG" ;; b) APP_BUILD_NUMBER="$OPTARG" ;;
p) APP_BUILD_PLATFORM="$OPTARG" ;; p) APP_BUILD_PLATFORM="$OPTARG" ;;
a) APP_NAMED_ID="$OPTARG" ;; a) APP_NAMED_ID="$OPTARG" ;;
i) BUILD_CRYPTO_PLUGINS=1 ;;
*) usage ;; *) usage ;;
esac esac
done done
if [ -z "$APP_VERSION_STRING" ]; then
echo "Missing -v option"
usage
fi
if [ -z "$APP_BUILD_NUMBER" ]; then
echo "Missing -b option"
usage
fi
if [ -z "$APP_BUILD_PLATFORM" ]; then
echo "Missing -p option"
usage
fi
if [ -z "$APP_NAMED_ID" ]; then
echo "Missing -a option"
usage
fi
if printf '%s\0' "${APP_PLATFORMS[@]}" | grep -Fxqz -- "${APP_BUILD_PLATFORM}"; then if printf '%s\0' "${APP_PLATFORMS[@]}" | grep -Fxqz -- "${APP_BUILD_PLATFORM}"; then
pushd "${APP_PROJECT_ROOT_DIR}/scripts/${APP_BUILD_PLATFORM}" pushd "${APP_PROJECT_ROOT_DIR}/scripts/${APP_BUILD_PLATFORM}"
else else
@ -51,13 +73,15 @@ else
exit 1 exit 1
fi fi
if [[ "$APP_NAMED_ID" = "stack_wallet" ]]; then if [ "$BUILD_CRYPTO_PLUGINS" -eq 0 ]; then
./build_all.sh if [[ "$APP_NAMED_ID" = "stack_wallet" ]]; then
elif [[ "$APP_NAMED_ID" = "stack_duo" ]]; then ./build_all.sh
./build_all_duo.sh elif [[ "$APP_NAMED_ID" = "stack_duo" ]]; then
else ./build_all_duo.sh
echo "Invalid app id: ${APP_NAMED_ID}" else
exit 1 echo "Invalid app id: ${APP_NAMED_ID}"
exit 1
fi
fi fi
popd popd