From 048f048c75b89d441649a3694a419c90c66782fb Mon Sep 17 00:00:00 2001 From: Ivo List Date: Thu, 8 Feb 2024 13:33:31 +0100 Subject: [PATCH] [7.1.0] Fixes for experimental extend rule and subrule functionality (#21237) Contains cherry-picks: d083f3d4b2 Reify outputs of initializer within the package 723a3ac6f2 Allow reading the name of the target in the initializer 48b975ac72 Fix dict types in initializers c51991600c Make Google proto_library and extension of Bazel proto_library Fixes: https://github.com/bazelbuild/bazel/issues/20782 --- .../starlark/StarlarkRuleClassFunctions.java | 19 ++- .../starlark/StarlarkRuleContext.java | 4 +- .../devtools/build/lib/packages/Type.java | 17 +- .../proto/ProtoCompileActionBuilder.java | 25 --- .../build/lib/rules/proto/ProtoConstants.java | 2 +- .../StarlarkRuleFunctionsApi.java | 4 +- .../starlark/builtins_bzl/bazel/exports.bzl | 2 + .../starlark/builtins_bzl/common/exports.bzl | 2 - .../common/proto/proto_library.bzl | 10 +- .../common/proto/proto_semantics.bzl | 10 -- .../rules/proto/BazelProtoLibraryTest.java | 4 +- .../StarlarkRuleClassFunctionsTest.java | 147 +++++++++++++++--- 12 files changed, 173 insertions(+), 73 deletions(-) delete mode 100644 src/main/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilder.java diff --git a/src/main/java/com/google/devtools/build/lib/analysis/starlark/StarlarkRuleClassFunctions.java b/src/main/java/com/google/devtools/build/lib/analysis/starlark/StarlarkRuleClassFunctions.java index 31488ce1f47a1c..38e73767fd39f9 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/starlark/StarlarkRuleClassFunctions.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/starlark/StarlarkRuleClassFunctions.java @@ -516,7 +516,9 @@ public static StarlarkRuleFunction createRule( } // Verify the child against parent's allowlist - if (parent != null && parent.getExtendableAllowlist() != null) { + if (parent != null + && parent.getExtendableAllowlist() != null + && !bzlFile.getRepository().getNameWithAt().equals("@_builtins")) { builder.addAllowlistChecker(EXTEND_RULE_ALLOWLIST_CHECKER); Attribute.Builder