From 6adbbc9e4074248376439fc0598d9f08190b0aa6 Mon Sep 17 00:00:00 2001 From: Googler Date: Wed, 19 Apr 2023 06:04:26 -0700 Subject: [PATCH] Add AEGs to CppCompileActionTemplate inside CcCompilationHelper. This action was not covered by cc_common.compile or cc_link, which are already getting action owner from the AEG connected to the cpp toolchain type. PiperOrigin-RevId: 525426385 Change-Id: Ie7f00a3a043095953705b9364820d7878f55bfa8 --- .../build/lib/rules/cpp/CcCompilationHelper.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationHelper.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationHelper.java index caa067d69d1c16..ac760c09e955b9 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationHelper.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationHelper.java @@ -21,6 +21,7 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; import com.google.common.io.Files; +import com.google.devtools.build.lib.actions.ActionOwner; import com.google.devtools.build.lib.actions.ActionRegistry; import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.actions.Artifact.SpecialArtifact; @@ -910,7 +911,7 @@ private PublicHeaders computePublicHeaders(List headers) throws Interr originalHeader, virtualHeader, "Symlinking virtual headers for " + label, - /*useExecRootForSource=*/ true)); + /* useExecRootForSource= */ true)); moduleHeadersBuilder.add(virtualHeader); if (configuration.isCodeCoverageEnabled()) { virtualToOriginalHeaders.add( @@ -1497,6 +1498,12 @@ private Artifact createCompileActionTemplate( CppHelper.getDiagnosticsOutputTreeArtifact( actionConstructionContext, label, sourceArtifact, outputName, usePic); } + + ActionOwner actionOwner = null; + if (actionConstructionContext instanceof RuleContext + && ((RuleContext) actionConstructionContext).useAutoExecGroups()) { + actionOwner = actionConstructionContext.getActionOwner(semantics.getCppToolchainType()); + } CppCompileActionTemplate actionTemplate = new CppCompileActionTemplate( sourceArtifact, @@ -1506,7 +1513,7 @@ private Artifact createCompileActionTemplate( builder, ccToolchain, outputCategories, - actionConstructionContext.getActionOwner()); + actionOwner == null ? actionConstructionContext.getActionOwner() : actionOwner); actionRegistry.registerAction(actionTemplate); return outputFiles;