Skip to content

Commit

Permalink
Automated rollback of commit 0fe4c36.
Browse files Browse the repository at this point in the history
RELNOTES: None
PiperOrigin-RevId: 505105037
Change-Id: Icfa947b58a74222f882464c512c24ef9791d99fc
  • Loading branch information
aiuto authored and copybara-github committed Jan 27, 2023
1 parent 850b334 commit 9234250
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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"))
/* <!-- #BLAZE_RULE(constraint_setting).ATTRIBUTE(default_constraint_value) -->
The label of the default value for this setting, to be used if no value is given. If this
attribute is present, the <code>constraint_value</code> it points to must be defined in the
Expand All @@ -72,7 +53,7 @@ constraint list (such as for a <code>config_setting</code>) 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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}. */
Expand All @@ -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"))
/* <!-- #BLAZE_RULE(constraint_value).ATTRIBUTE(constraint_setting) -->
The <code>constraint_setting</code> for which this <code>constraint_value</code> is a
possible choice.
Expand All @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -671,9 +671,6 @@ public ImmutableSet<Class<? extends FragmentOptions>> 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)";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}

Expand All @@ -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) {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9234250

Please sign in to comment.