C++: Remove usages of rule context from CcCompilationHelper
The Starlark API won't take the rule context. Here we replace usages of rule context in CcCompilationHelper with other fields. We still pass the context to CcCompilationHelper because this will be done incrementally over several CLs.
RELNOTES:none
PiperOrigin-RevId: 231939377
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 4e00092..5b2dbf4 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
@@ -751,10 +751,7 @@
return getUniqueDirectoryArtifact(uniqueDirectorySuffix, relative, getBinOrGenfilesDirectory());
}
- /**
- * Creates an artifact in a directory that is unique to the rule, thus guaranteeing that it never
- * clashes with artifacts created by other rules.
- */
+ @Override
public Artifact getUniqueDirectoryArtifact(
String uniqueDirectory, PathFragment relative, ArtifactRoot root) {
return getDerivedArtifact(getUniqueDirectory(uniqueDirectory).getRelative(relative), root);
@@ -1402,10 +1399,7 @@
return outs.get(0);
}
- /**
- * Returns an artifact with a given file extension. All other path components
- * are the same as in {@code pathFragment}.
- */
+ @Override
public final Artifact getRelatedArtifact(PathFragment pathFragment, String extension) {
PathFragment file = FileSystemUtils.replaceExtension(pathFragment, extension);
return getDerivedArtifact(file, getConfiguration().getBinDirectory(rule.getRepository()));