Skip to content
31 changes: 23 additions & 8 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -102,30 +102,37 @@ platform :android do
Dir.glob("#{ENV['PWD']}/**/*.{gradle,gradle.kts,toml}").each do |f|
next if f.include?("/build/") || f.include?("/.gradle/")
File.readlines(f).each_with_index do |line, idx|
# Comments can name a SNAPSHOT version; only a declaration is a hit.
next if line.lstrip.start_with?("//", "/*", "*", "#")
snapshot_hits << "#{f}:#{idx + 1}: #{line.strip}" if line.include?("SNAPSHOT")
end
end
unless snapshot_hits.empty?
UI.user_error!("SNAPSHOT dependencies found — remove before releasing:\n#{snapshot_hits.join("\n")}")
Comment thread
HashEngineering marked this conversation as resolved.
Resolved
end

build(options)
# 'upload' sends the app bundle, so publish builds the bundle only.
build_aab(options)
upload(options)
end

desc "Upload for pre-launch report"
lane :upload do |options|
filename = "#{ENV['PWD']}/wallet/build/outputs/apk/prod/release/wallet-prod-release.apk"
# An app bundle, not the apk: Play rejects an apk this size (both ABIs'
# native libraries), while from a bundle each device downloads only its own ABI.
filename = "#{ENV['PWD']}/wallet/build/outputs/bundle/prodRelease/wallet-prod-release.aab"
Comment thread
HashEngineering marked this conversation as resolved.
Resolved
if !File.exist? "#{filename}"
UI.user_error!("Missing apk. Run 'publish' lane to build and upload")
UI.user_error!("Missing aab. Run 'publish' lane to build and upload")
end

mapping = "#{ENV['PWD']}/wallet/build/outputs/mapping/prodRelease/mapping.txt"
if !File.exist? "#{mapping}"
UI.user_error!("Missing mapping.txt. Run 'publish' lane to build and upload")
end

supply(apk: filename, mapping: mapping, track: 'internal')
# Upload only the bundle: an apk built in the same run is left in the lane
# context, and supply refuses to send both.
supply(aab: filename, mapping: mapping, track: 'internal', skip_upload_apk: true)
end

desc "Promote to production track with 0.2 rollout by default"
Expand Down Expand Up @@ -327,6 +334,9 @@ platform :android do

desc "Build apk"
lane :build do |options|
# bundle: true builds the app bundle (.aab) instead of the apk (see build_aab).
verb = options[:bundle] ? "bundle" : "assemble"

# Strip PiggyCards test merchants from production release builds.
ENV['BUILD_PROD'] = '1'

Expand All @@ -348,12 +358,12 @@ platform :android do
end

if is_ci
flavor=options[:flavor].capitalize
type=options[:type].capitalize
flavor = gradle_flavor(options[:flavor].to_s)
type = gradle_type(options[:type].to_s)
storepass=options[:storepass]
versioncode=options[:versioncode]
gradle(
task: "clean assemble#{flavor}#{type}",
task: "clean #{verb}#{flavor}#{type}",
properties: {
"android.injected.signing.store.file" => "#{ENV['PWD']}/.deploy/keystore.jks",
"android.injected.signing.store.password" => storepass,
Expand All @@ -372,7 +382,7 @@ platform :android do
end

gradle(
task: "clean assembleProdRelease",
task: "clean #{verb}ProdRelease",
properties: {
"android.injected.signing.store.file" => "#{ENV['PWD']}/.deploy/dash-wallet.keystore",
"android.injected.signing.store.password" => storepass,
Expand All @@ -384,6 +394,11 @@ platform :android do
end
end

desc "Build aab"
lane :build_aab do |options|
build(options.merge(bundle: true))
end
Comment thread
HashEngineering marked this conversation as resolved.
Resolved

desc "Download explore.db"
lane :explore_db do |options|
assets_path = "#{ENV['PWD']}/wallet/assets/"
Expand Down
10 changes: 8 additions & 2 deletions wallet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,17 @@ The APK is placed here: `wallet/build/outputs/apk/wallet-prod-release.apk`
```sh
fastlane build storepass:[keystore password] keypass:[key password]
```
## Upload existing wallet-prod-release.apk file to the internal test track.
## Build the app bundle for Google Play
Google Play takes the app bundle, not the APK. The bundle is placed here:
`wallet/build/outputs/bundle/prodRelease/wallet-prod-release.aab`
```sh
fastlane build_aab storepass:[keystore password] keypass:[key password]
```
## Upload existing wallet-prod-release.aab file to the internal test track.
```shell
fastlane upload
```
## Build, followed by Upload
## Build the app bundle, followed by Upload
```shell
fastlane publish storepass:[keystore password] keypass:[key password]
```
Expand Down
Loading