From e7fd4e608a8ca51a1a9061adb99f32e657b2c1e6 Mon Sep 17 00:00:00 2001 From: ztefanie Date: Fri, 26 Jan 2024 11:18:50 +0100 Subject: [PATCH] Fix android build --- .circleci/config.yml | 32 ---------- .../src/workflows/delivery_beta_native.yml | 64 +++++++++---------- frontend/android/app/build.gradle | 16 ++--- frontend/android/fastlane/Fastfile | 24 ++----- 4 files changed, 47 insertions(+), 89 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5ae6f427a..3f70ed1c3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -805,14 +805,6 @@ workflows: requires: - bump_version - check_frontend - - deliver_android: - buildConfig: bayern - context: - - tuerantuer-google-play - name: deliver_android_bayern - production_delivery: false - requires: - - build_android_bayern - build_android: buildConfig: nuernberg context: @@ -823,14 +815,6 @@ workflows: requires: - bump_version - check_frontend - - deliver_android: - buildConfig: nuernberg - context: - - tuerantuer-google-play - name: deliver_android_nuernberg - production_delivery: false - requires: - - build_android_nuernberg - build_ios: buildConfig: bayern context: @@ -841,14 +825,6 @@ workflows: requires: - bump_version - check_frontend - - deliver_ios: - buildConfig: bayern - context: - - tuerantuer-apple - name: deliver_bayern_ios - production_delivery: false - requires: - - build_ios_bayern - build_ios: buildConfig: nuernberg context: @@ -859,14 +835,6 @@ workflows: requires: - bump_version - check_frontend - - deliver_ios: - buildConfig: nuernberg - context: - - tuerantuer-apple - name: deliver_nuernberg_ios - production_delivery: false - requires: - - build_ios_nuernberg when: << pipeline.parameters.run_delivery_beta_native >> frontend: jobs: diff --git a/.circleci/src/workflows/delivery_beta_native.yml b/.circleci/src/workflows/delivery_beta_native.yml index 481cf1da9..94d0e73f6 100644 --- a/.circleci/src/workflows/delivery_beta_native.yml +++ b/.circleci/src/workflows/delivery_beta_native.yml @@ -15,14 +15,14 @@ jobs: context: - credentials-repo - credentials-ehrenamtskarte - - deliver_android: - name: deliver_android_bayern - buildConfig: "bayern" - context: - - tuerantuer-google-play - production_delivery: false - requires: - - build_android_bayern +# - deliver_android: +# name: deliver_android_bayern +# buildConfig: "bayern" +# context: +# - tuerantuer-google-play +# production_delivery: false +# requires: +# - build_android_bayern - build_android: name: build_android_nuernberg buildConfig: "nuernberg" @@ -33,14 +33,14 @@ jobs: context: - credentials-repo - credentials-ehrenamtskarte - - deliver_android: - name: deliver_android_nuernberg - buildConfig: "nuernberg" - context: - - tuerantuer-google-play - production_delivery: false - requires: - - build_android_nuernberg +# - deliver_android: +# name: deliver_android_nuernberg +# buildConfig: "nuernberg" +# context: +# - tuerantuer-google-play +# production_delivery: false +# requires: +# - build_android_nuernberg - build_ios: name: build_ios_bayern buildConfig: "bayern" @@ -51,14 +51,14 @@ jobs: context: - tuerantuer-apple - fastlane-match - - deliver_ios: - name: deliver_bayern_ios - buildConfig: bayern - context: - - tuerantuer-apple - production_delivery: false - requires: - - build_ios_bayern +# - deliver_ios: +# name: deliver_bayern_ios +# buildConfig: bayern +# context: +# - tuerantuer-apple +# production_delivery: false +# requires: +# - build_ios_bayern - build_ios: name: build_ios_nuernberg buildConfig: "nuernberg" @@ -69,11 +69,11 @@ jobs: context: - tuerantuer-apple - fastlane-match - - deliver_ios: - name: deliver_nuernberg_ios - buildConfig: nuernberg - context: - - tuerantuer-apple - production_delivery: false - requires: - - build_ios_nuernberg \ No newline at end of file +# - deliver_ios: +# name: deliver_nuernberg_ios +# buildConfig: nuernberg +# context: +# - tuerantuer-apple +# production_delivery: false +# requires: +# - build_ios_nuernberg \ No newline at end of file diff --git a/frontend/android/app/build.gradle b/frontend/android/app/build.gradle index 2ac4b0541..1a77db727 100644 --- a/frontend/android/app/build.gradle +++ b/frontend/android/app/build.gradle @@ -91,10 +91,10 @@ android { signingConfigs { if (System.getenv()['KEYSTORE_PATH']) { // Signing with env variables (CI) release { - storeFile file("file://" + System.getenv()['HOME'] + project.KEYSTORE_PATH) - storePassword project.KEYSTORE_PASSWORD - keyAlias project.KEYSTORE_KEY_ALIAS - keyPassword project.KEYSTORE_KEY_PASSWORD + storeFile file("file://" + System.getenv()['HOME'] + System.getenv()['KEYSTORE_PATH']) + storePassword System.getenv()['KEYSTORE_PASSWORD'] + keyAlias System.getenv()['KEYSTORE_KEY_ALIAS'] + keyPassword System.getenv()['KEYSTORE_KEY_PASSWORD'] } } else if (localProperties.containsKey("signing.keyAlias")) { // Signing with local.properties file (locally) println "Selected using localProps" @@ -114,7 +114,7 @@ android { abiFilters 'armeabi-v7a','arm64-v8a','x86_64' } - if (project.hasProperty('KEYSTORE_PATH')) { + if (System.getenv()['KEYSTORE_PATH']) { signingConfig signingConfigs.release } else if ( localProperties.containsKey("signing.keyAlias")) { signingConfig signingConfigs.localProps @@ -142,9 +142,9 @@ android { multiDexEnabled true versionCode flutterVersionCode.toInteger() versionName flutterVersionName - if (project.hasProperty('VERSION_CODE')) { - versionCode project.VERSION_CODE.toInteger() - versionName project.VERSION_NAME + if (System.getenv()['VERSION_CODE']) { + versionCode System.getenv()['VERSION_CODE'].toInteger() + versionName System.getenv()['VERSION_NAME'] } } diff --git a/frontend/android/fastlane/Fastfile b/frontend/android/fastlane/Fastfile index 17d2d1187..59ce50df8 100644 --- a/frontend/android/fastlane/Fastfile +++ b/frontend/android/fastlane/Fastfile @@ -80,23 +80,13 @@ platform :android do sh("fvm flutter pub run build_runner build --define df_build_config=name=#{build_config_name}") - gradle( - task: "bundle", - flavor: flavor, - flags: " -Ptarget=lib/main.dart", - build_type: "Release", - properties: { - :VERSION_CODE => version_code, - :VERSION_NAME => version_name, - :BUILD_CONFIG_NAME => build_config_name, - :KEYSTORE_PATH => KEYSTORE_PATH, - :KEYSTORE_KEY_ALIAS => flavor == 'Nuernberg' ? KEYSTORE_KEY_ALIAS_NUERNBERG : KEYSTORE_KEY_ALIAS_BAYERN, - :KEYSTORE_PASSWORD => KEYSTORE_PASSWORD, - :KEYSTORE_KEY_PASSWORD => flavor == 'Nuernberg' ? KEYSTORE_KEY_PASSWORD_NUERNBERG : KEYSTORE_KEY_PASSWORD_BAYERN, - }.compact, - system_properties: gradle_system_properties, - print_command: false - ) + ENV["VERSION_CODE"] = version_code + ENV["VERSION_NAME"] = version_name + ENV["BUILD_CONFIG_NAME"] = build_config_name + ENV["KEYSTORE_KEY_ALIAS"] = flavor == 'Nuernberg' ? KEYSTORE_KEY_ALIAS_NUERNBERG : KEYSTORE_KEY_ALIAS_BAYERN + ENV["KEYSTORE_KEY_PASSWORD"] = flavor == 'Nuernberg' ? KEYSTORE_KEY_PASSWORD_NUERNBERG : KEYSTORE_KEY_PASSWORD_BAYERN + + sh("fvm flutter build appbundle --dart-define=environment=production --flavor #{flavor} --release -t lib/main.dart") end desc "Upload Android App to Google Play"