From ecacc5fca418d937e86d355ce41061053ece9659 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 e86add34fa34d1..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 @@ -1134,8 +1134,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 + ? pkgContext.getBuilder().getLabelConverter() + : currentRuleClass.getLabelConverterForInitializer()); kwargs.putEntry(nativeName, reifiedValue); } }