Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default to .aab builds with Play Store #48

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/flows/android.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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({
Expand Down
10 changes: 6 additions & 4 deletions src/templates/fastlane/android/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ platform :android do

build_number = number_of_commits()
gradle(
task: 'assemble',
build_type: build_type,
<%if (props.useAabBuilds) { -%> task: 'bundle',
<% } else { -%> task: 'assemble',
<% } -%> build_type: build_type,
properties: {
"VERSION_CODE" => build_number
}
Expand Down Expand Up @@ -70,7 +71,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',
Expand All @@ -79,7 +79,9 @@ 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"
<% 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