Update android_binary to always use the bytecode optimizer's mnemonic.
Currently, single-action optimization will always use the Proguard mnemonic and
progress message. However, if we're using --experimental_bytecode_optimizers,
we're likely substituting --proguard_top with a similar optimizer, so we should
update the mnemonic and progress message accordingly.
@@ -347,8 +347,12 @@ public final class ProguardHelper {
libraryJars = NestedSetBuilder.create(Order.STABLE_ORDER, filteredLibraryJar);
}
+ JavaConfiguration javaConfiguration =
+ ruleContext.getConfiguration().getFragment(JavaConfiguration.class);
+ JavaConfiguration.NamedLabel optimizer = javaConfiguration.getBytecodeOptimizer();
+ String mnemonic = optimizer.name();
if (optimizationPasses == null) {
- // Run proguard as a single step.
+ // Run the optimizer as a single step.
SpawnAction.Builder proguardAction = new SpawnAction.Builder();
CustomCommandLine.Builder commandLine = CustomCommandLine.builder();
defaultAction(
@@ -367,17 +371,13 @@ public final class ProguardHelper {
output.getUsage(),
output.getConstantStringObfuscatedMapping(),
output.getConfig(),
- "Proguard");
+ mnemonic);
proguardAction
- .setProgressMessage("Trimming binary with Proguard: %s", ruleContext.getLabel())
+ .setProgressMessage("Trimming binary with %s: %s", mnemonic, ruleContext.getLabel())
.addOutput(proguardOutputJar);
proguardAction.addCommandLine(commandLine.build());
ruleContext.registerAction(proguardAction.build(ruleContext));
} else {
- JavaConfiguration javaConfiguration =
- ruleContext.getConfiguration().getFragment(JavaConfiguration.class);
- JavaConfiguration.NamedLabel optimizer = javaConfiguration.getBytecodeOptimizer();
- String mnemonic = optimizer.name();
Optional<Label> optimizerTarget = optimizer.label();
FilesToRunProvider executable = null;
if (optimizerTarget.isPresent()) {
