Skip to content

Commit

Permalink
Allow rules in _builtins to use transitions, regardless of the allowlist
Browse files Browse the repository at this point in the history
The allow list cannot reference symbols in @_builtins, so just always
allow them. Because _builtins is meant to be used for migrating existing
rules to Starlark, this should not represent an increase in the use of
transitions, so the lack of allowlisting here should not be significant.

The final migration out of builtins will require the allow list to be
filled appropriately.

PiperOrigin-RevId: 369656645
  • Loading branch information
c-mita authored and copybara-github committed Apr 21, 2021
1 parent c51bcbd commit ec94022
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,17 @@ public static ConfiguredTarget buildRule(
+ " should have been specified by the requesting rule.");
return null;
}
if (ruleClass.hasFunctionTransitionAllowlist()
&& !Allowlist.isAvailableBasedOnRuleLocation(
ruleContext, FunctionSplitTransitionAllowlist.NAME)) {
if (!Allowlist.isAvailable(ruleContext, FunctionSplitTransitionAllowlist.NAME)) {
ruleContext.ruleError("Non-allowlisted use of Starlark transition");
if (!ruleClass
.getRuleDefinitionEnvironmentLabel()
.getRepository()
.getName()
.equals("@_builtins")) {
if (ruleClass.hasFunctionTransitionAllowlist()
&& !Allowlist.isAvailableBasedOnRuleLocation(
ruleContext, FunctionSplitTransitionAllowlist.NAME)) {
if (!Allowlist.isAvailable(ruleContext, FunctionSplitTransitionAllowlist.NAME)) {
ruleContext.ruleError("Non-allowlisted use of Starlark transition");
}
}
}

Expand Down

0 comments on commit ec94022

Please sign in to comment.