From e679edda5fcbf8d68a3f9e97aa00ee99ba5c2772 Mon Sep 17 00:00:00 2001 From: Matthew Fosse Date: Sat, 8 Jun 2024 14:23:45 +0200 Subject: [PATCH] fix sed command to work on mac & linux --- scripts/android/inject_app_details.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/scripts/android/inject_app_details.sh b/scripts/android/inject_app_details.sh index 3fa9ef921..15e52de9a 100755 --- a/scripts/android/inject_app_details.sh +++ b/scripts/android/inject_app_details.sh @@ -6,9 +6,13 @@ if [ -z "$APP_ANDROID_TYPE" ]; then fi cd ../.. -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 -cd scripts/android + +# 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 + +cd scripts/android \ No newline at end of file