From ec94022adb65791d9eecf9fed048a50bf088c19c Mon Sep 17 00:00:00 2001 From: cmita Date: Wed, 21 Apr 2021 08:07:19 -0700 Subject: [PATCH] Allow rules in _builtins to use transitions, regardless of the allowlist 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 --- .../StarlarkRuleConfiguredTargetUtil.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/analysis/starlark/StarlarkRuleConfiguredTargetUtil.java b/src/main/java/com/google/devtools/build/lib/analysis/starlark/StarlarkRuleConfiguredTargetUtil.java index d88d6e709576cd..35f3e1cd0eba94 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/starlark/StarlarkRuleConfiguredTargetUtil.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/starlark/StarlarkRuleConfiguredTargetUtil.java @@ -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"); + } } }