diff --git a/src/main/java/com/google/devtools/build/lib/rules/platform/BUILD b/src/main/java/com/google/devtools/build/lib/rules/platform/BUILD index 0a2fbb1c1b8ee1..8caf14e2df6b40 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/platform/BUILD +++ b/src/main/java/com/google/devtools/build/lib/rules/platform/BUILD @@ -20,7 +20,6 @@ java_library( "//src/main/java/com/google/devtools/build/lib/analysis:analysis_cluster", "//src/main/java/com/google/devtools/build/lib/analysis:config/auto_cpu_converter", "//src/main/java/com/google/devtools/build/lib/analysis:config/config_matching_provider", - "//src/main/java/com/google/devtools/build/lib/analysis:config/transitions/no_config_transition", "//src/main/java/com/google/devtools/build/lib/analysis:configured_target", "//src/main/java/com/google/devtools/build/lib/analysis:file_provider", "//src/main/java/com/google/devtools/build/lib/analysis:platform_configuration", diff --git a/src/main/java/com/google/devtools/build/lib/rules/platform/ConstraintSettingRule.java b/src/main/java/com/google/devtools/build/lib/rules/platform/ConstraintSettingRule.java index 0f319707998b39..5b6c33e9f129bb 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/platform/ConstraintSettingRule.java +++ b/src/main/java/com/google/devtools/build/lib/rules/platform/ConstraintSettingRule.java @@ -16,16 +16,11 @@ import static com.google.devtools.build.lib.packages.Attribute.attr; -import com.google.common.collect.ImmutableList; -import com.google.devtools.build.lib.analysis.BaseRuleClasses; import com.google.devtools.build.lib.analysis.RuleDefinition; import com.google.devtools.build.lib.analysis.RuleDefinitionEnvironment; -import com.google.devtools.build.lib.analysis.config.transitions.NoConfigTransition; import com.google.devtools.build.lib.analysis.platform.ConstraintSettingInfo; import com.google.devtools.build.lib.packages.BuildType; import com.google.devtools.build.lib.packages.RuleClass; -import com.google.devtools.build.lib.packages.RuleClass.ToolchainResolutionMode; -import com.google.devtools.build.lib.packages.Type; /** Rule definition for {@link ConstraintSetting}. */ public class ConstraintSettingRule implements RuleDefinition { @@ -36,20 +31,6 @@ public class ConstraintSettingRule implements RuleDefinition { public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment env) { return builder .advertiseStarlarkProvider(ConstraintSettingInfo.PROVIDER.id()) - .cfg(NoConfigTransition.createFactory()) - .exemptFromConstraintChecking("this rule helps *define* a constraint") - .useToolchainResolution(ToolchainResolutionMode.DISABLED) - .override( - attr("applicable_licenses", BuildType.LABEL_LIST) - // This is a constant which is never linked into a target - .value(ImmutableList.of()) - .allowedFileTypes() - .nonconfigurable("fundamental constant, used in platform configuration")) - .override( - attr("tags", Type.STRING_LIST) - // No need to show up in ":all", etc. target patterns. - .value(ImmutableList.of("manual")) - .nonconfigurable("low-level attribute, used in platform configuration")) /* The label of the default value for this setting, to be used if no value is given. If this attribute is present, the constraint_value it points to must be defined in the @@ -72,7 +53,7 @@ constraint list (such as for a config_setting) that requires a part public RuleDefinition.Metadata getMetadata() { return RuleDefinition.Metadata.builder() .name(RULE_NAME) - .ancestors(BaseRuleClasses.NativeBuildRule.class) + .ancestors(PlatformBaseRule.class) .factoryClass(ConstraintSetting.class) .build(); } diff --git a/src/main/java/com/google/devtools/build/lib/rules/platform/ConstraintValueRule.java b/src/main/java/com/google/devtools/build/lib/rules/platform/ConstraintValueRule.java index 7b1282874c8f7c..1e5025128d7158 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/platform/ConstraintValueRule.java +++ b/src/main/java/com/google/devtools/build/lib/rules/platform/ConstraintValueRule.java @@ -16,17 +16,12 @@ import static com.google.devtools.build.lib.packages.Attribute.attr; -import com.google.common.collect.ImmutableList; -import com.google.devtools.build.lib.analysis.BaseRuleClasses; import com.google.devtools.build.lib.analysis.RuleDefinition; import com.google.devtools.build.lib.analysis.RuleDefinitionEnvironment; -import com.google.devtools.build.lib.analysis.config.transitions.NoConfigTransition; import com.google.devtools.build.lib.analysis.platform.ConstraintSettingInfo; import com.google.devtools.build.lib.analysis.platform.ConstraintValueInfo; import com.google.devtools.build.lib.packages.BuildType; import com.google.devtools.build.lib.packages.RuleClass; -import com.google.devtools.build.lib.packages.RuleClass.ToolchainResolutionMode; -import com.google.devtools.build.lib.packages.Type; import com.google.devtools.build.lib.util.FileTypeSet; /** Rule definition for {@link ConstraintValue}. */ @@ -38,20 +33,6 @@ public class ConstraintValueRule implements RuleDefinition { public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment env) { return builder .advertiseStarlarkProvider(ConstraintValueInfo.PROVIDER.id()) - .cfg(NoConfigTransition.createFactory()) - .exemptFromConstraintChecking("this rule helps *define* a constraint") - .useToolchainResolution(ToolchainResolutionMode.DISABLED) - .override( - attr("applicable_licenses", BuildType.LABEL_LIST) - // This is a constant which is never linked into a target - .value(ImmutableList.of()) - .allowedFileTypes() - .nonconfigurable("fundamental constant, used in platform configuration")) - .override( - attr("tags", Type.STRING_LIST) - // No need to show up in ":all", etc. target patterns. - .value(ImmutableList.of("manual")) - .nonconfigurable("low-level attribute, used in platform configuration")) /* The constraint_setting for which this constraint_value is a possible choice. @@ -70,7 +51,7 @@ public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment env) public Metadata getMetadata() { return Metadata.builder() .name(RULE_NAME) - .ancestors(BaseRuleClasses.NativeBuildRule.class) + .ancestors(PlatformBaseRule.class) .factoryClass(ConstraintValue.class) .build(); } diff --git a/src/test/java/com/google/devtools/build/lib/analysis/AnalysisCachingTest.java b/src/test/java/com/google/devtools/build/lib/analysis/AnalysisCachingTest.java index 1825d3c3900167..ed2e7a5aa9b837 100644 --- a/src/test/java/com/google/devtools/build/lib/analysis/AnalysisCachingTest.java +++ b/src/test/java/com/google/devtools/build/lib/analysis/AnalysisCachingTest.java @@ -671,9 +671,6 @@ public ImmutableSet> requiresOptionFragments() @Override public BuildOptions patch(BuildOptionsView options, EventHandler eventHandler) { - if (options.underlying().hasNoConfig()) { - return options.underlying(); - } BuildOptionsView cloned = options.clone(); cloned.get(DiffResetOptions.class).probablyIrrelevantOption = "(cleared)"; cloned.get(DiffResetOptions.class).alsoIrrelevantOption = "(cleared)"; diff --git a/src/test/java/com/google/devtools/build/lib/runtime/commands/ConfigCommandTest.java b/src/test/java/com/google/devtools/build/lib/runtime/commands/ConfigCommandTest.java index 57b583b626d605..ce01f470c0823b 100644 --- a/src/test/java/com/google/devtools/build/lib/runtime/commands/ConfigCommandTest.java +++ b/src/test/java/com/google/devtools/build/lib/runtime/commands/ConfigCommandTest.java @@ -171,9 +171,6 @@ private static String getOptionValue( } private static boolean isTargetConfig(ConfigurationForOutput config) { - if (config.mnemonic.endsWith("-noconfig")) { - return false; - } return !Boolean.parseBoolean(getOptionValue(config, "CoreOptions", "is exec configuration")); } @@ -195,7 +192,7 @@ public void showConfigIds() throws Exception { // Should be: target configuration, target configuration without test. assertThat(fullJson).isNotNull(); assertThat(fullJson.has("configuration-IDs")).isTrue(); - assertThat(fullJson.get("configuration-IDs").getAsJsonArray().size()).isEqualTo(3); + assertThat(fullJson.get("configuration-IDs").getAsJsonArray().size()).isEqualTo(2); } private boolean skipNoConfig(JsonElement configHash) { @@ -316,7 +313,7 @@ public void showAllConfigs() throws Exception { assertThat(config).isNotNull(); numConfigs++; } - assertThat(numConfigs).isEqualTo(3); // Target + target w/o test + nonConfig. + assertThat(numConfigs).isEqualTo(2); // Target + target w/o test. } @Test