From 09e538b71d2b1e25bf668b89075aec9a47d4c55f Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Wed, 12 Aug 2026 12:14:18 +0200 Subject: [PATCH] Permit C++ build variables to be `Label`-valued This enables further memory savings for module maps (see https://github.com/bazelbuild/rules_cc/pull/789). --- .../devtools/build/lib/rules/cpp/CcToolchainVariables.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainVariables.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainVariables.java index 5d2520b12ce0b3..8d333acd723061 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainVariables.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainVariables.java @@ -29,6 +29,7 @@ import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.actions.InputMetadataProvider; import com.google.devtools.build.lib.actions.PathMapper; +import com.google.devtools.build.lib.cmdline.Label; import com.google.devtools.build.lib.collect.nestedset.Depset; import com.google.devtools.build.lib.collect.nestedset.NestedSet; import com.google.devtools.build.lib.concurrent.BlazeInterners; @@ -828,6 +829,7 @@ private static VariableValue asVariableValue(Object o) { case NoneType ignored -> null; // null has the same behavior as omitted field case Boolean b -> BooleanValue.of(b); case String s -> new StringValue(s); + case Label label -> new StringValue(label.expandToCommandLine()); case Artifact artifact -> new ArtifactValue(artifact); case PathFragment pathFragment -> new PathFragmentValue(pathFragment); case Iterable iterable -> new Sequence(ImmutableList.copyOf(iterable));