Don't create a custom built sequence and copy a list in the process. Instead,
use a regular StringSequenceVariable using Iterables.transform().
RELNOTES: None.
@@ -25,7 +25,6 @@ import com.google.devtools.build.lib.collect.nestedset.NestedSet;
import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder;
import com.google.devtools.build.lib.collect.nestedset.Order;
import com.google.devtools.build.lib.rules.cpp.CcToolchainFeatures.FeatureConfiguration;
-import com.google.devtools.build.lib.rules.cpp.CcToolchainVariables.StringSequenceBuilder;
import com.google.devtools.build.lib.rules.cpp.CcToolchainVariables.VariablesExtension;
import com.google.devtools.build.lib.syntax.EvalException;
import com.google.devtools.build.lib.vfs.PathFragment;
@@ -441,11 +440,9 @@ public enum CompileBuildVariables {
buildVariables.addStringVariable(MODULE_NAME.getVariableName(), cppModuleMap.getName());
buildVariables.addStringVariable(
MODULE_MAP_FILE.getVariableName(), cppModuleMap.getArtifact().getExecPathString());
- StringSequenceBuilder sequence = new StringSequenceBuilder();
- for (Artifact artifact : directModuleMaps) {
- sequence.addValue(artifact.getExecPathString());
- }
- buildVariables.addCustomBuiltVariable(DEPENDENT_MODULE_MAP_FILES.getVariableName(), sequence);
+ buildVariables.addStringSequenceVariable(
+ DEPENDENT_MODULE_MAP_FILES.getVariableName(),
+ Iterables.transform(directModuleMaps, Artifact::getExecPathString));
}
if (featureConfiguration.isEnabled(CppRuleClasses.USE_HEADER_MODULES)) {
// Module inputs will be set later when the action is executed.
