From d083f3d4b2d6a0c1a92d7cf444900423d9cf3bd7 Mon Sep 17 00:00:00 2001 From: Googler Date: Tue, 23 Jan 2024 11:59:27 -0800 Subject: [PATCH] Reify outputs of initializer within the package The labels need to be local to the package. Setting them in an initializer was broken. PiperOrigin-RevId: 600863492 Change-Id: I0561f43273a62db3b9e823ec3b49734b380da878 --- .../lib/analysis/starlark/StarlarkRuleClassFunctions.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 aae8a7a69f89d2..5d7324634f293b 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 @@ -1269,8 +1269,11 @@ public Object call(StarlarkThread thread, Tuple args, Dict kwarg currentRuleClass.getName(), attr, value, - // Reify to the location of the initializer definition - currentRuleClass.getLabelConverterForInitializer()); + // Reify to the location of the initializer definition (except for outputs) + attr.getType() == BuildType.OUTPUT + || attr.getType() == BuildType.OUTPUT_LIST + ? pkgBuilder.getLabelConverter() + : currentRuleClass.getLabelConverterForInitializer()); kwargs.putEntry(nativeName, reifiedValue); } }