Skip to content

Commit

Permalink
Change --experimental_local_java_optimization_configuration to only…
Browse files Browse the repository at this point in the history
… accept a single-label

PiperOrigin-RevId: 571069796
Change-Id: Ic93d179caa1c5bdca0ba6456492e42a5cb642988
  • Loading branch information
hvadehra authored and Copybara-Service committed Oct 5, 2023
1 parent caa6b76 commit 6e3a421
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
Expand Up @@ -97,7 +97,7 @@ public enum ImportDepsCheckingLevel {
private final Label proguardBinary;
private final NamedLabel bytecodeOptimizer;
private final boolean runLocalJavaOptimizations;
private final ImmutableList<Label> localJavaOptimizationConfiguration;
private final Label localJavaOptimizationConfiguration;
private final boolean splitBytecodeOptimizationPass;
private final int bytecodeOptimizationPassActions;
private final boolean enforceProguardFileExtension;
Expand Down Expand Up @@ -133,8 +133,7 @@ public JavaConfiguration(BuildOptions buildOptions) throws InvalidConfigurationE
this.fixDepsTool = javaOptions.fixDepsTool;
this.proguardBinary = javaOptions.proguard;
this.runLocalJavaOptimizations = javaOptions.runLocalJavaOptimizations;
this.localJavaOptimizationConfiguration =
ImmutableList.copyOf(javaOptions.localJavaOptimizationConfiguration);
this.localJavaOptimizationConfiguration = javaOptions.localJavaOptimizationConfiguration;
this.splitBytecodeOptimizationPass = javaOptions.splitBytecodeOptimizationPass;
this.bytecodeOptimizationPassActions = javaOptions.bytecodeOptimizationPassActions;
this.enforceProguardFileExtension = javaOptions.enforceProguardFileExtension;
Expand Down Expand Up @@ -399,7 +398,7 @@ public boolean runLocalJavaOptimizations() {
}

/** Returns the optimization configuration for local Java optimizations if they are enabled. */
public ImmutableList<Label> getLocalJavaOptimizationConfiguration() {
public Label getLocalJavaOptimizationConfiguration() {
return localJavaOptimizationConfiguration;
}

Expand Down
Expand Up @@ -325,13 +325,12 @@ public ImportDepsCheckingLevelConverter() {
*/
@Option(
name = "experimental_local_java_optimization_configuration",
allowMultiple = true,
defaultValue = "null",
converter = LabelConverter.class,
documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
effectTags = {OptionEffectTag.UNKNOWN},
help = "Do not use.")
public List<Label> localJavaOptimizationConfiguration;
public Label localJavaOptimizationConfiguration;

// TODO(b/237004872) Remove this after rollout of bytecode_optimization_pass_actions.
/** If true, the OPTIMIZATION stage of the bytecode optimizer will be split across two actions. */
Expand Down
Expand Up @@ -128,13 +128,14 @@ static Label javaToolchainAttribute(RuleDefinitionEnvironment environment) {
});

@SerializationConstant
LabelListLateBoundDefault<JavaConfiguration> LOCAL_JAVA_OPTIMIZATION_CONFIGURATION =
LabelListLateBoundDefault.fromTargetConfiguration(
LabelLateBoundDefault<JavaConfiguration> LOCAL_JAVA_OPTIMIZATION_CONFIGURATION =
LabelLateBoundDefault.fromTargetConfiguration(
JavaConfiguration.class,
null,
(rule, attributes, javaConfig) -> {
// Don't bother adding the configuration dep if we're not going to use it.
if (!javaConfig.runLocalJavaOptimizations()) {
return ImmutableList.of();
return null;
}
return javaConfig.getLocalJavaOptimizationConfiguration();
});
Expand Down
Expand Up @@ -378,7 +378,7 @@ The Java target version (e.g., '6' or '7'). It specifies for which Java runtime
.value(JavaSemantics.BYTECODE_OPTIMIZER)
.exec())
.add(
attr(":local_java_optimization_configuration", LABEL_LIST)
attr(":local_java_optimization_configuration", LABEL)
.cfg(ExecutionTransitionFactory.createFactory())
.value(JavaSemantics.LOCAL_JAVA_OPTIMIZATION_CONFIGURATION))
.build();
Expand Down

0 comments on commit 6e3a421

Please sign in to comment.