diff options
author | tomlu <tomlu@google.com> | 2018-01-17 14:36:26 -0800 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-01-17 14:37:59 -0800 |
commit | ee6a6862e26704854fb08bd90912890814cc3426 (patch) | |
tree | 294eac82202e393c5baae0e357325f2488ab3cbb /src/test/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilderTest.java | |
parent | f323fb3043bc782526e0e47933efedea9c5c2ad9 (diff) |
Introduce Root class.
This class represents a root (such as a package path or an output root) used for file lookups and artifacts. It is meant to be as opaque as possible in order to hide the user's environment from sky keys and sky functions.
Roots are used by RootedPaths and ArtifactRoots.
This CL attempts to make the minimum number of modifications necessary to change RootedPath and ArtifactRoot to use these fields. Deprecated methods and invasive accessors are permitted to minimise the risk of any observable changes.
RELNOTES: None
PiperOrigin-RevId: 182271759
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilderTest.java')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilderTest.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilderTest.java b/src/test/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilderTest.java index 08d6f9c9f6..d21acf1839 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilderTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilderTest.java @@ -34,6 +34,7 @@ import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder; import com.google.devtools.build.lib.collect.nestedset.Order; import com.google.devtools.build.lib.rules.proto.ProtoCompileActionBuilder.ToolchainInvocation; import com.google.devtools.build.lib.util.LazyString; +import com.google.devtools.build.lib.vfs.Root; import com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem; import javax.annotation.Nullable; import org.junit.Ignore; @@ -45,7 +46,8 @@ import org.junit.runners.JUnit4; public class ProtoCompileActionBuilderTest { private static final InMemoryFileSystem FILE_SYSTEM = new InMemoryFileSystem(); - private final ArtifactRoot root = ArtifactRoot.asSourceRoot(FILE_SYSTEM.getPath("/")); + private final ArtifactRoot root = + ArtifactRoot.asSourceRoot(Root.fromPath(FILE_SYSTEM.getPath("/"))); private final ArtifactRoot derivedRoot = ArtifactRoot.asDerivedRoot(FILE_SYSTEM.getPath("/"), FILE_SYSTEM.getPath("/out")); @@ -345,7 +347,7 @@ public class ProtoCompileActionBuilderTest { private Artifact artifact(String ownerLabel, String path) { return new Artifact( - root.getPath().getRelative(path), + root.getRoot().getRelative(path), root, root.getExecPath().getRelative(path), new LabelArtifactOwner(Label.parseAbsoluteUnchecked(ownerLabel))); @@ -354,7 +356,7 @@ public class ProtoCompileActionBuilderTest { /** Creates a dummy artifact with the given path, that actually resides in /out/<path>. */ private Artifact derivedArtifact(String ownerLabel, String path) { return new Artifact( - derivedRoot.getPath().getRelative(path), + derivedRoot.getRoot().getRelative(path), derivedRoot, derivedRoot.getExecPath().getRelative(path), new LabelArtifactOwner(Label.parseAbsoluteUnchecked(ownerLabel))); |