Compute root relative path on the fly to reduce memory in DerivedArtifact objects

This especially helps ThinLTO builds, which have many more artifacts.

RELNOTES: None.
PiperOrigin-RevId: 266932890
diff --git a/src/test/java/com/google/devtools/build/lib/actions/ArtifactTest.java b/src/test/java/com/google/devtools/build/lib/actions/ArtifactTest.java
index ef9cd43b..86111df 100644
--- a/src/test/java/com/google/devtools/build/lib/actions/ArtifactTest.java
+++ b/src/test/java/com/google/devtools/build/lib/actions/ArtifactTest.java
@@ -68,7 +68,8 @@
         IllegalArgumentException.class,
         () ->
             ActionsTestUtil.createArtifactWithExecPath(
-                ArtifactRoot.asDerivedRoot(execDir, bogusDir), f1.relativeTo(execDir)));
+                    ArtifactRoot.asDerivedRoot(execDir, bogusDir), f1.relativeTo(execDir))
+                .getRootRelativePath());
   }
 
   private static long getUsedMemory() {
@@ -328,7 +329,9 @@
         IllegalArgumentException.class,
         () ->
             ActionsTestUtil.createArtifactWithExecPath(
-                ArtifactRoot.asDerivedRoot(execRoot, scratch.dir("/a")), PathFragment.create("c")));
+                    ArtifactRoot.asDerivedRoot(execRoot, scratch.dir("/a")),
+                    PathFragment.create("c"))
+                .getRootRelativePath());
   }
 
   @Test