Skip to content

Commit

Permalink
Add option to skip universal APK generation for AABs. (#126)
Browse files Browse the repository at this point in the history
* Add option to skip universal APK generation for AABs.

This is much desired functionality because of the unintended consequences from locally-signed universal APKs. By granting an option (and defaulting it off), we allow the client to determine whether they need this.

* Fix unused variable and bad indentation

* Generated debug APK by default.

We must generate the APK by default to ensure we're not breaking any functionality for existing users of the step.

Co-authored-by: Mate Herber <[email protected]>
  • Loading branch information
Chris Lee and Mate Herber authored Jan 14, 2021
1 parent e32d292 commit 13302e3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
14 changes: 11 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type Config struct {
AppSlug string `env:"BITRISE_APP_SLUG,required"`
AddonAPIBaseURL string `env:"addon_api_base_url,required"`
AddonAPIToken string `env:"addon_api_token"`
GenerateUniversalApkIfNone bool `env:"generate_universal_apk_if_none,opt[true,false]"`
DebugMode bool `env:"debug_mode,opt[true,false]"`
BundletoolVersion string `env:"bundletool_version,required"`
}
Expand Down Expand Up @@ -333,10 +334,17 @@ func findAPKsAndAABs(pths []string) (apks []string, aabs []string, others []stri

func deploy(clearedFilesToDeploy []string, config Config) (ArtifactURLCollection, error) {
apks, aabs, others := findAPKsAndAABs(clearedFilesToDeploy)
apks, _, err := ensureAABsHasUniversalAPKPair(aabs, apks, config.BundletoolVersion)
if err != nil {
return ArtifactURLCollection{}, err

if config.GenerateUniversalApkIfNone {
var err error
apks, _, err = ensureAABsHasUniversalAPKPair(aabs, apks, config.BundletoolVersion)
if err != nil {
return ArtifactURLCollection{}, err
}
} else {
log.Printf("Does not have universal APK pair but ignoring generation.")
}

androidArtifacts := append(apks, aabs...)

// deploy the apks first, as the universal apk's public install page will be used for aabs.
Expand Down
7 changes: 7 additions & 0 deletions step.yml
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,13 @@ inputs:
The token required to authenticate with the API.
is_dont_change_value: true
is_sensitive: true
- generate_universal_apk_if_none: "true"
opts:
title: "Force generate universal APK for AABs"
description: |
When building an AAB artifact, check for a corresponding universal APK.
If none is found, generate the corresponding locally (debug) signed
universal APK for ease of debugging.
- debug_mode: "false"
opts:
category: Debug
Expand Down

0 comments on commit 13302e3

Please sign in to comment.