C++: Remove remaining usages of context in compile
A new method was added to ActionConstructionContext in order to get a Tree artifact and the API must now take the grep-includes artifact.
RELNOTES:none
PiperOrigin-RevId: 232634667
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java b/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java
index 5b2dbf4..1777564 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java
@@ -710,13 +710,7 @@
return getAnalysisEnvironment().getDerivedArtifact(rootRelativePath, root);
}
- /**
- * Creates a TreeArtifact under a given root with the given root-relative path.
- *
- * <p>Verifies that it is in the root-relative directory corresponding to the package of the rule,
- * thus ensuring that it doesn't clash with other artifacts generated by other rules using this
- * method.
- */
+ @Override
public SpecialArtifact getTreeArtifact(PathFragment rootRelativePath, ArtifactRoot root) {
Preconditions.checkState(rootRelativePath.startsWith(getPackageDirectory()),
"Output artifact '%s' not under package directory '%s' for target '%s'",
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/actions/ActionConstructionContext.java b/src/main/java/com/google/devtools/build/lib/analysis/actions/ActionConstructionContext.java
index 08a0887..ff54a8f 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/actions/ActionConstructionContext.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/actions/ActionConstructionContext.java
@@ -16,6 +16,7 @@
import com.google.devtools.build.lib.actions.ActionAnalysisMetadata;
import com.google.devtools.build.lib.actions.ActionOwner;
import com.google.devtools.build.lib.actions.Artifact;
+import com.google.devtools.build.lib.actions.Artifact.SpecialArtifact;
import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.analysis.AnalysisEnvironment;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
@@ -60,6 +61,15 @@
Artifact getDerivedArtifact(PathFragment rootRelativePath, ArtifactRoot root);
/**
+ * Creates a TreeArtifact under a given root with the given root-relative path.
+ *
+ * <p>Verifies that it is in the root-relative directory corresponding to the package of the rule,
+ * thus ensuring that it doesn't clash with other artifacts generated by other rules using this
+ * method.
+ */
+ SpecialArtifact getTreeArtifact(PathFragment rootRelativePath, ArtifactRoot root);
+
+ /**
* Returns an artifact that can be an output of shared actions. Only use when there is no other
* option.
*