Skip to content

Commit

Permalink
Make constraint_setting / constraint_value non_configurable.
Browse files Browse the repository at this point in the history
The concept of allowing what is fundamentally a constant to vary by target we are building for is too much to reason about, let along get the code correct.

PiperOrigin-RevId: 483748098
Change-Id: I966b7d21ad8d38de9867c870a0669e2123063809
  • Loading branch information
aiuto committed Nov 4, 2022
1 parent b54cd27 commit 654dc8e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2725,14 +2725,6 @@ public boolean isPackageMetadataRule() {
// not building it today because the exact needs are not clear.
return true;
}
// BEGIN-INTERNAL
// TODO(aiuto): This is a Google-ism, remove from Bazel.
String packageName = ruleDefinitionEnvironmentLabel.getPackageName();
if (packageName.startsWith("tools/build_defs/license")
|| packageName.startsWith("third_party/rules_license")) {
return true;
}
// END-INTERNAL
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment env)
constraint list (such as for a <code>config_setting</code>) that requires a particular value
for that setting.
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
.add(attr(DEFAULT_CONSTRAINT_VALUE_ATTR, BuildType.NODEP_LABEL))
.add(
attr(DEFAULT_CONSTRAINT_VALUE_ATTR, BuildType.NODEP_LABEL)
.nonconfigurable("constants must be consistent across configurations"))
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment env)
.mandatory()
.allowedRuleClasses(ConstraintSettingRule.RULE_NAME)
.allowedFileTypes(FileTypeSet.NO_FILE)
.mandatoryProviders(ConstraintSettingInfo.PROVIDER.id()))
.mandatoryProviders(ConstraintSettingInfo.PROVIDER.id())
.nonconfigurable("constants must be consistent across configurations"))
.build();
}

Expand Down

0 comments on commit 654dc8e

Please sign in to comment.