From aeeabb097f9c5413cec67c30afe9bffd8d52f726 Mon Sep 17 00:00:00 2001 From: Arno Lehtonen Date: Thu, 17 Oct 2019 11:31:18 +0300 Subject: [PATCH 1/3] Default to .aab builds with Play Store --- src/templates/fastlane/android/Fastfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/templates/fastlane/android/Fastfile b/src/templates/fastlane/android/Fastfile index ead05bf..5ac893a 100644 --- a/src/templates/fastlane/android/Fastfile +++ b/src/templates/fastlane/android/Fastfile @@ -41,7 +41,7 @@ platform :android do build_number = number_of_commits() gradle( - task: 'assemble', + task: 'bundle', build_type: build_type, properties: { "VERSION_CODE" => build_number @@ -79,7 +79,7 @@ platform :android do upload_to_play_store( package_name: "<%= props.appId %>#{package_name_postfix}", track: 'internal', - apk: "./app/build/outputs/apk/#{env}/release/app-#{env}-release.apk" + aab: "./app/build/outputs/bundle/#{env}/app.aab" ) end end From b3de7fd3817ff7abddfbbdf4ea2ce42a9c0d29e1 Mon Sep 17 00:00:00 2001 From: Arno Lehtonen Date: Thu, 17 Oct 2019 11:36:45 +0300 Subject: [PATCH 2/3] Remove extraneous line --- src/templates/fastlane/android/Fastfile | 1 - 1 file changed, 1 deletion(-) diff --git a/src/templates/fastlane/android/Fastfile b/src/templates/fastlane/android/Fastfile index 5ac893a..3a23ed5 100644 --- a/src/templates/fastlane/android/Fastfile +++ b/src/templates/fastlane/android/Fastfile @@ -70,7 +70,6 @@ platform :android do if env != 'dev' and env != 'staging' and env != 'release' then raise 'env must be one of dev|staging|release' end - env_name = env.capitalize package_name_postfix = { 'release' => '', 'dev' => '.dev', From cfbd87b97075c25f6eaa9ee6cc124045b1cbf0ed Mon Sep 17 00:00:00 2001 From: Arno Lehtonen Date: Sun, 12 Jan 2020 17:03:59 +0200 Subject: [PATCH 3/3] Add prompt for Android build type --- src/flows/android.js | 11 +++++++++-- src/templates/fastlane/android/Fastfile | 9 ++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/flows/android.js b/src/flows/android.js index 9e8e5bb..d927d40 100644 --- a/src/flows/android.js +++ b/src/flows/android.js @@ -62,13 +62,20 @@ const initAndroid = async ({ android, http, prompt, print, circle }, options) => } } -const initFastlane = async ({ system, android, template, filesystem, print }) => { +const initFastlane = async ({ system, android, template, filesystem, print, prompt }) => { const fastlanePath = system.which('fastlane') if (!fastlanePath) { print.info('No fastlane found, install...') await system.run('sudo gem install fastlane -NV') } + const { buildMode } = await prompt.ask({ + type: 'select', + name: 'buildMode', + message: 'Use Android App Bundle (.aab) or Android Package Kit (.apk) builds for Play Store?', + choices: ['.aab', '.apk'], + }) + const appId = android.getApplicationId() await template.generate({ @@ -80,7 +87,7 @@ const initFastlane = async ({ system, android, template, filesystem, print }) => await template.generate({ template: 'fastlane/android/Fastfile', target: 'android/fastlane/Fastfile', - props: { appId } + props: { appId, useAabBuilds: buildMode === '.aab' } }) await template.generate({ diff --git a/src/templates/fastlane/android/Fastfile b/src/templates/fastlane/android/Fastfile index 3a23ed5..43bc113 100644 --- a/src/templates/fastlane/android/Fastfile +++ b/src/templates/fastlane/android/Fastfile @@ -41,8 +41,9 @@ platform :android do build_number = number_of_commits() gradle( - task: 'bundle', - build_type: build_type, + <%if (props.useAabBuilds) { -%> task: 'bundle', + <% } else { -%> task: 'assemble', + <% } -%> build_type: build_type, properties: { "VERSION_CODE" => build_number } @@ -78,7 +79,9 @@ platform :android do upload_to_play_store( package_name: "<%= props.appId %>#{package_name_postfix}", track: 'internal', - aab: "./app/build/outputs/bundle/#{env}/app.aab" + <% if (props.useAabBuilds) { -%> aab: "./app/build/outputs/bundle/#{env}/app.aab"-%> + <% } else { -%> apk: "./app/build/outputs/apk/#{env}/release/app-#{env}-release.apk"-%> + <% } %> ) end end