From d9686591f0ab21e48532c4cbb1f3d53b042b0b9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Sat, 11 May 2024 18:34:42 +0200 Subject: [PATCH] Ensure APK build type parameter is valid Abort build script if the build type parameter value is not valid, instead of assuming the debug build. --- scripts/android/files/build.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/android/files/build.sh b/scripts/android/files/build.sh index ada181377..ef6c2f3cf 100644 --- a/scripts/android/files/build.sh +++ b/scripts/android/files/build.sh @@ -19,6 +19,15 @@ _APK_BASENAME="$1" _APK_PACKAGE_NAME="$2" _APK_BUILD_TYPE="$3" +if [[ "${_APK_BUILD_TYPE}" == "Debug" ]]; then + _RELEASE_TYPE_NAME=debug +elif [[ "${_APK_BUILD_TYPE}" == "Release" ]]; then + _RELEASE_TYPE_NAME=release +else + printf '\e[31mDid not pass build type to build script: Debug, Release\e[30m\n' + exit 1 +fi + _APK_PACKAGE_FOLDER=$(echo "$_APK_PACKAGE_NAME" | sed 's/\./\//g') sed -i "s/DDNet/${_APK_BASENAME}/g" settings.gradle @@ -54,15 +63,6 @@ if [[ "${_APK_BUILD_TYPE}" == "Debug" ]]; then sed -i "s/android.enableR8.fullMode=true/android.enableR8.fullMode=false/g" gradle.properties fi -_RELEASE_TYPE_NAME=debug -if [[ "${_APK_BUILD_TYPE}" == "Debug" ]]; then - _RELEASE_TYPE_NAME=debug -fi - -if [[ "${_APK_BUILD_TYPE}" == "Release" ]]; then - _RELEASE_TYPE_NAME=release -fi - function build_gradle() { java "-Dorg.gradle.appname=Gradle" -classpath gradle-wrapper.jar org.gradle.wrapper.GradleWrapperMain --warning-mode all "$1" }