Skip to content

Commit

Permalink
Add --debug-mode to aapt2 invocations when building without -c opt.
Browse files Browse the repository at this point in the history
RELNOTES: None
PiperOrigin-RevId: 193562885
  • Loading branch information
corbinrsmith-work authored and Copybara-Service committed Apr 19, 2018
1 parent ae25202 commit e6b9c2a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ public static void main(String[] args) throws Exception {
.buildVersion(aaptConfigOptions.buildToolsVersion)
.conditionalKeepRules(aaptConfigOptions.conditionalKeepRules == TriState.YES)
.filterToDensity(options.densities)
.debug(aaptConfigOptions.debug)
.includeOnlyConfigs(aaptConfigOptions.resourceConfigs)
.link(compiled)
.copyPackageTo(options.packagePath)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ public static void main(String[] args) throws Exception {
.outputAsProto(aapt2ConfigOptions.resourceTableAsProto)
.buildVersion(aapt2ConfigOptions.buildToolsVersion)
.includeOnlyConfigs(aapt2ConfigOptions.resourceConfigs)
.debug(aapt2ConfigOptions.debug)
.link(compiled)
.copyPackageTo(options.shrunkApk)
.copyRTxtTo(options.rTxtOutput);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@

/** Performs linking of {@link CompiledResources} using aapt2. */
public class ResourceLinker {

private boolean debug;

/** Represents errors thrown during linking. */
public static class LinkError extends Aapt2Exception {

Expand Down Expand Up @@ -122,6 +125,11 @@ public ResourceLinker buildVersion(Revision buildToolsVersion) {
return this;
}

public ResourceLinker debug(boolean debug) {
this.debug = debug;
return this;
}

public ResourceLinker conditionalKeepRules(boolean conditionalKeepRules) {
this.conditionalKeepRules = conditionalKeepRules;
return this;
Expand Down Expand Up @@ -310,6 +318,8 @@ public PackagedResources link(CompiledResources compiled) {
.add("--manifest", compiled.getManifest())
// Enables resource redefinition and merging
.add("--auto-add-overlay")
.when(debug)
.thenAdd("--debug-mode")
.add("--custom-package", customPackage)
.when(densities.size() == 1)
.thenAddRepeated("--preferred-density", densities)
Expand Down

0 comments on commit e6b9c2a

Please sign in to comment.