Make it possible to override the path of runfiles trees.

This is needed for a quirk in the remote execution implementation at Google. Previously, its implementation was in Google-internal code but removing RunfilesSupplier requires that we move this code here.

It's quite a bit of of boilerplate, but in exchange we can delete RunfilesSupplier.getRunfilesDirOverride() and remove the "possibly incorrect" path from getPossiblyIncorrectExecPath(). This also encapsulates knowledge about the runfiles trees in InputMetadataProvider, where it belongs.

RELNOTES: None.
PiperOrigin-RevId: 606613420
Change-Id: I4d9220ba02758a100f7115b2f3a5995c4c3e4ac4
diff --git a/src/main/java/com/google/devtools/build/lib/actions/RunfilesArtifactValue.java b/src/main/java/com/google/devtools/build/lib/actions/RunfilesArtifactValue.java
index 6f2219a..c5b3da8 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/RunfilesArtifactValue.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/RunfilesArtifactValue.java
@@ -62,6 +62,10 @@
         this);
   }
 
+  public RunfilesArtifactValue withOverriddenRunfilesTree(RunfilesTree overrideTree) {
+    return new RunfilesArtifactValue(metadata, overrideTree, files, fileValues, trees, treeValues);
+  }
+
   /** Returns the data of the artifact for this value, as computed by the action cache checker. */
   public FileArtifactValue getMetadata() {
     return metadata;