Rename Root to ArtifactRoot.

This is slightly more descriptive, and we will potentially want to use the name Root for a broader concept shared between ArtifactRoot and RootedPath.

PiperOrigin-RevId: 182082367
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 dda385f..681b2a3 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
@@ -40,14 +40,14 @@
 public class ArtifactTest {
   private Scratch scratch;
   private Path execDir;
-  private Root rootDir;
+  private ArtifactRoot rootDir;
   private final ActionKeyContext actionKeyContext = new ActionKeyContext();
 
   @Before
   public final void setRootDir() throws Exception  {
     scratch = new Scratch();
     execDir = scratch.dir("/exec");
-    rootDir = Root.asDerivedRoot(execDir, scratch.dir("/exec/root"));
+    rootDir = ArtifactRoot.asDerivedRoot(execDir, scratch.dir("/exec/root"));
   }
 
   @Test
@@ -55,7 +55,7 @@
     Path f1 = scratch.file("/exec/dir/file.ext");
     Path bogusDir = scratch.file("/exec/dir/bogus");
     try {
-      new Artifact(f1, Root.asDerivedRoot(execDir, bogusDir), f1.relativeTo(execDir));
+      new Artifact(f1, ArtifactRoot.asDerivedRoot(execDir, bogusDir), f1.relativeTo(execDir));
       fail("Expected IllegalArgumentException constructing artifact with a bad root dir");
     } catch (IllegalArgumentException expected) {}
   }
@@ -97,7 +97,7 @@
   @Test
   public void testRootPrefixedExecPath_noRoot() throws IOException {
     Path f1 = scratch.file("/exec/dir/file.ext");
-    Artifact a1 = new Artifact(f1.relativeTo(execDir), Root.asSourceRoot(execDir));
+    Artifact a1 = new Artifact(f1.relativeTo(execDir), ArtifactRoot.asSourceRoot(execDir));
     assertThat(Artifact.asRootPrefixedExecPath(a1)).isEqualTo(":dir/file.ext");
   }
 
@@ -128,7 +128,7 @@
 
   @Test
   public void testGetFilename() throws Exception {
-    Root root = Root.asSourceRoot(scratch.dir("/foo"));
+    ArtifactRoot root = ArtifactRoot.asSourceRoot(scratch.dir("/foo"));
     Artifact javaFile = new Artifact(scratch.file("/foo/Bar.java"), root);
     Artifact generatedHeader = new Artifact(scratch.file("/foo/bar.proto.h"), root);
     Artifact generatedCc = new Artifact(scratch.file("/foo/bar.proto.cc"), root);
@@ -141,7 +141,7 @@
 
   @Test
   public void testGetExtension() throws Exception {
-    Root root = Root.asSourceRoot(scratch.dir("/foo"));
+    ArtifactRoot root = ArtifactRoot.asSourceRoot(scratch.dir("/foo"));
     Artifact javaFile = new Artifact(scratch.file("/foo/Bar.java"), root);
     assertThat(javaFile.getExtension()).isEqualTo("java");
   }
@@ -154,12 +154,14 @@
 
   private List<Artifact> getFooBarArtifacts(MutableActionGraph actionGraph, boolean collapsedList)
       throws Exception {
-    Root root = Root.asSourceRoot(scratch.dir("/foo"));
+    ArtifactRoot root = ArtifactRoot.asSourceRoot(scratch.dir("/foo"));
     Artifact aHeader1 = new Artifact(scratch.file("/foo/bar1.h"), root);
     Artifact aHeader2 = new Artifact(scratch.file("/foo/bar2.h"), root);
     Artifact aHeader3 = new Artifact(scratch.file("/foo/bar3.h"), root);
-    Artifact middleman = new Artifact(PathFragment.create("middleman"),
-        Root.middlemanRoot(scratch.dir("/foo"), scratch.dir("/foo/out")));
+    Artifact middleman =
+        new Artifact(
+            PathFragment.create("middleman"),
+            ArtifactRoot.middlemanRoot(scratch.dir("/foo"), scratch.dir("/foo/out")));
     actionGraph.registerAction(new MiddlemanAction(ActionsTestUtil.NULL_ACTION_OWNER,
         ImmutableList.of(aHeader1, aHeader2, aHeader3), middleman, "desc",
         MiddlemanType.AGGREGATING_MIDDLEMAN));
@@ -270,7 +272,7 @@
 
   @Test
   public void testRootRelativePathIsSameAsExecPath() throws Exception {
-    Root root = Root.asSourceRoot(scratch.dir("/foo"));
+    ArtifactRoot root = ArtifactRoot.asSourceRoot(scratch.dir("/foo"));
     Artifact a = new Artifact(scratch.file("/foo/bar1.h"), root);
     assertThat(a.getRootRelativePath()).isSameAs(a.getExecPath());
   }
@@ -281,7 +283,7 @@
     Artifact a =
         new Artifact(
             scratch.file("/a/b/c"),
-            Root.asDerivedRoot(execRoot, scratch.dir("/a/b")),
+            ArtifactRoot.asDerivedRoot(execRoot, scratch.dir("/a/b")),
             PathFragment.create("b/c"));
     assertThat(a.toDetailString()).isEqualTo("[[/a]b]c");
   }
@@ -292,7 +294,7 @@
       Path execRoot = scratch.getFileSystem().getPath("/");
       new Artifact(
           scratch.file("/a/b/c"),
-          Root.asDerivedRoot(execRoot, scratch.dir("/a")),
+          ArtifactRoot.asDerivedRoot(execRoot, scratch.dir("/a")),
           PathFragment.create("c"));
       fail();
     } catch (IllegalArgumentException e) {
@@ -305,7 +307,8 @@
   public void testSerializeToString() throws Exception {
     Path execRoot = scratch.getFileSystem().getPath("/");
     assertThat(
-            new Artifact(scratch.file("/a/b/c"), Root.asDerivedRoot(execRoot, scratch.dir("/a")))
+            new Artifact(
+                    scratch.file("/a/b/c"), ArtifactRoot.asDerivedRoot(execRoot, scratch.dir("/a")))
                 .serializeToString())
         .isEqualTo("a/b/c /3");
   }
@@ -314,7 +317,7 @@
   public void testSerializeToStringWithExecPath() throws Exception {
     Path execRoot = scratch.getFileSystem().getPath("/");
     Path path = scratch.file("/aaa/bbb/ccc");
-    Root root = Root.asDerivedRoot(execRoot, scratch.dir("/aaa/bbb"));
+    ArtifactRoot root = ArtifactRoot.asDerivedRoot(execRoot, scratch.dir("/aaa/bbb"));
     PathFragment execPath = PathFragment.create("bbb/ccc");
 
     assertThat(new Artifact(path, root, execPath).serializeToString()).isEqualTo("bbb/ccc /3");
@@ -326,7 +329,7 @@
     assertThat(
             new Artifact(
                     scratch.file("/aa/b/c"),
-                    Root.asDerivedRoot(execRoot, scratch.dir("/aa")),
+                    ArtifactRoot.asDerivedRoot(execRoot, scratch.dir("/aa")),
                     PathFragment.create("b/c"),
                     new LabelArtifactOwner(Label.parseAbsoluteUnchecked("//foo:bar")))
                 .serializeToString())
@@ -343,7 +346,7 @@
   @Test
   public void testDirnameInExecutionDir() throws Exception {
     Artifact artifact =
-        new Artifact(scratch.file("/foo/bar.txt"), Root.asSourceRoot(scratch.dir("/foo")));
+        new Artifact(scratch.file("/foo/bar.txt"), ArtifactRoot.asSourceRoot(scratch.dir("/foo")));
 
     assertThat(artifact.getDirname()).isEqualTo(".");
   }
@@ -360,26 +363,30 @@
   @Test
   public void testIsSourceArtifact() throws Exception {
     assertThat(
-        new Artifact(scratch.file("/src/foo.cc"), Root.asSourceRoot(scratch.dir("/")),
-            PathFragment.create("src/foo.cc"))
-            .isSourceArtifact())
+            new Artifact(
+                    scratch.file("/src/foo.cc"),
+                    ArtifactRoot.asSourceRoot(scratch.dir("/")),
+                    PathFragment.create("src/foo.cc"))
+                .isSourceArtifact())
         .isTrue();
     assertThat(
-        new Artifact(scratch.file("/genfiles/aaa/bar.out"),
-            Root.asDerivedRoot(scratch.dir("/genfiles"), scratch.dir("/genfiles/aaa")))
-            .isSourceArtifact())
+            new Artifact(
+                    scratch.file("/genfiles/aaa/bar.out"),
+                    ArtifactRoot.asDerivedRoot(
+                        scratch.dir("/genfiles"), scratch.dir("/genfiles/aaa")))
+                .isSourceArtifact())
         .isFalse();
-
   }
 
   @Test
   public void testGetRoot() throws Exception {
     Path execRoot = scratch.getFileSystem().getPath("/");
-    Root root = Root.asDerivedRoot(execRoot, scratch.dir("/newRoot"));
+    ArtifactRoot root = ArtifactRoot.asDerivedRoot(execRoot, scratch.dir("/newRoot"));
     assertThat(new Artifact(scratch.file("/newRoot/foo"), root).getRoot()).isEqualTo(root);
   }
 
   private Artifact createDirNameArtifact() throws Exception {
-    return new Artifact(scratch.file("/aaa/bbb/ccc/ddd"), Root.asSourceRoot(scratch.dir("/")));
+    return new Artifact(
+        scratch.file("/aaa/bbb/ccc/ddd"), ArtifactRoot.asSourceRoot(scratch.dir("/")));
   }
 }