From 475a47f8c63f00b311e7767d02f0dbdf216a0a46 Mon Sep 17 00:00:00 2001 From: Matthew Fosse Date: Sat, 8 Jun 2024 17:19:35 +0200 Subject: [PATCH] original fix didn't work --- scripts/android/inject_app_details.sh | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/scripts/android/inject_app_details.sh b/scripts/android/inject_app_details.sh index 15e52de9a..3f8b7a010 100755 --- a/scripts/android/inject_app_details.sh +++ b/scripts/android/inject_app_details.sh @@ -9,10 +9,20 @@ cd ../.. # the sed command is slightly different for MacOS than linux: # https://stackoverflow.com/questions/4247068/sed-command-with-i-option-failing-on-mac-but-works-on-linux -sed -i'' -e "1,/version:.*/s/version:.*/version: ${APP_ANDROID_VERSION}+${APP_ANDROID_BUILD_NUMBER}/" ./pubspec.yaml -sed -i'' -e "1,/__APP_PACKAGE__/s/__APP_PACKAGE__/${APP_ANDROID_PACKAGE}/" ./android/app/src/main/AndroidManifest.xml -sed -i'' -e "1,/__APP_SCHEME__/s/__APP_SCHEME__/${APP_ANDROID_SCHEME}/" ./android/app/src/main/AndroidManifest.xml -sed -i'' -e "1,/__versionCode__/s/__versionCode__/${APP_ANDROID_BUILD_NUMBER}/" ./android/app/src/main/AndroidManifest.xml -sed -i'' -e "1,/__versionName__/s/__versionName__/${APP_ANDROID_VERSION}/" ./android/app/src/main/AndroidManifest.xml +# the sed command is slightly different for MacOS than linux: +# https://stackoverflow.com/questions/4247068/sed-command-with-i-option-failing-on-mac-but-works-on-linux +if [ "$(uname)" == "Darwin" ]; then + sed -i '' "1,/version:.*/s/version:.*/version: ${APP_ANDROID_VERSION}+${APP_ANDROID_BUILD_NUMBER}/" ./pubspec.yaml + sed -i '' "1,/__APP_PACKAGE__/s/__APP_PACKAGE__/${APP_ANDROID_PACKAGE}/" ./android/app/src/main/AndroidManifest.xml + sed -i '' "1,/__APP_SCHEME__/s/__APP_SCHEME__/${APP_ANDROID_SCHEME}/" ./android/app/src/main/AndroidManifest.xml + sed -i '' "1,/__versionCode__/s/__versionCode__/${APP_ANDROID_BUILD_NUMBER}/" ./android/app/src/main/AndroidManifest.xml + sed -i '' "1,/__versionName__/s/__versionName__/${APP_ANDROID_VERSION}/" ./android/app/src/main/AndroidManifest.xml +else + sed -i "0,/version:/{s/version:.*/version: ${APP_ANDROID_VERSION}+${APP_ANDROID_BUILD_NUMBER}/}" ./pubspec.yaml + sed -i "0,/version:/{s/__APP_PACKAGE__/${APP_ANDROID_PACKAGE}/}" ./android/app/src/main/AndroidManifest.xml + sed -i "0,/__APP_SCHEME__/s/__APP_SCHEME__/${APP_ANDROID_SCHEME}/" ./android/app/src/main/AndroidManifest.xml + sed -i "0,/version:/{s/__versionCode__/${APP_ANDROID_BUILD_NUMBER}/}" ./android/app/src/main/AndroidManifest.xml + sed -i "0,/version:/{s/__versionName__/${APP_ANDROID_VERSION}/}" ./android/app/src/main/AndroidManifest.xml +fi cd scripts/android \ No newline at end of file