aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/skyframe/TreeArtifactBuildTest.java
diff options
context:
space:
mode:
authorGravatar nharmata <nharmata@google.com>2017-04-04 17:11:39 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2017-04-05 15:18:20 +0200
commitb4060b6e53944a7c3bdc5e62b288e7293a87652a (patch)
tree59b0f1f3d3e8e99412e060bb98b5a37fe90d9b6e /src/test/java/com/google/devtools/build/lib/skyframe/TreeArtifactBuildTest.java
parent3ac77cb94a4cf1bd1993a97fe79f2005b2b1a711 (diff)
Refactor all ctor callsites of PathFragment to instead call a static 'create' method.
This paves the way for changing PathFragment to e.g. an abstract class with multiple subclasses. This way we can split out the windows-specific stuff into one of these concrete classes, making the code more readable and also saving memory (since the shallow heap size of the NonWindowsPathFragment subclass will hopefully be smaller than that of the current PathFragment). This also lets us pursue gc churn optimizations. We can now do interning in PathFragment#create and can also get rid of unnecessary intermediate PathFragment allocations. RELNOTES: None PiperOrigin-RevId: 152145768
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/skyframe/TreeArtifactBuildTest.java')
-rw-r--r--src/test/java/com/google/devtools/build/lib/skyframe/TreeArtifactBuildTest.java36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/TreeArtifactBuildTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/TreeArtifactBuildTest.java
index 99da8b961b..c682340282 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/TreeArtifactBuildTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/TreeArtifactBuildTest.java
@@ -709,9 +709,9 @@ public class TreeArtifactBuildTest extends TimestampBuilderTestCase {
// artifact1 is a tree artifact generated by a TouchingTestAction.
Artifact artifact1 = createTreeArtifact("treeArtifact1");
TreeFileArtifact treeFileArtifactA = ActionInputHelper.treeFileArtifact(
- artifact1, new PathFragment("child1"));
+ artifact1, PathFragment.create("child1"));
TreeFileArtifact treeFileArtifactB = ActionInputHelper.treeFileArtifact(
- artifact1, new PathFragment("child2"));
+ artifact1, PathFragment.create("child2"));
registerAction(new TouchingTestAction(treeFileArtifactA, treeFileArtifactB));
// artifact2 is a tree artifact generated by an action template.
@@ -723,9 +723,9 @@ public class TreeArtifactBuildTest extends TimestampBuilderTestCase {
// We mock out the action template function to expand into two actions that just touch the
// output files.
TreeFileArtifact expectedOutputTreeFileArtifact1 = ActionInputHelper.treeFileArtifact(
- artifact2, new PathFragment("child1"));
+ artifact2, PathFragment.create("child1"));
TreeFileArtifact expectedOutputTreeFileArtifact2 = ActionInputHelper.treeFileArtifact(
- artifact2, new PathFragment("child2"));
+ artifact2, PathFragment.create("child2"));
Action generateOutputAction = new DummyAction(
ImmutableList.<Artifact>of(treeFileArtifactA), expectedOutputTreeFileArtifact1);
Action noGenerateOutputAction = new DummyAction(
@@ -747,9 +747,9 @@ public class TreeArtifactBuildTest extends TimestampBuilderTestCase {
// artifact1 is a tree artifact generated by a TouchingTestAction.
Artifact artifact1 = createTreeArtifact("treeArtifact1");
TreeFileArtifact treeFileArtifactA = ActionInputHelper.treeFileArtifact(
- artifact1, new PathFragment("child1"));
+ artifact1, PathFragment.create("child1"));
TreeFileArtifact treeFileArtifactB = ActionInputHelper.treeFileArtifact(
- artifact1, new PathFragment("child2"));
+ artifact1, PathFragment.create("child2"));
registerAction(new TouchingTestAction(treeFileArtifactA, treeFileArtifactB));
// artifact2 is a tree artifact generated by an action template.
@@ -762,9 +762,9 @@ public class TreeArtifactBuildTest extends TimestampBuilderTestCase {
// One Action that touches the output file.
// The other action that does not generate the output file.
TreeFileArtifact expectedOutputTreeFileArtifact1 = ActionInputHelper.treeFileArtifact(
- artifact2, new PathFragment("child1"));
+ artifact2, PathFragment.create("child1"));
TreeFileArtifact expectedOutputTreeFileArtifact2 = ActionInputHelper.treeFileArtifact(
- artifact2, new PathFragment("child2"));
+ artifact2, PathFragment.create("child2"));
Action generateOutputAction = new DummyAction(
ImmutableList.<Artifact>of(treeFileArtifactA), expectedOutputTreeFileArtifact1);
Action noGenerateOutputAction = new NoOpDummyAction(
@@ -792,9 +792,9 @@ public class TreeArtifactBuildTest extends TimestampBuilderTestCase {
// artifact1 is a tree artifact generated by a TouchingTestAction.
Artifact artifact1 = createTreeArtifact("treeArtifact1");
TreeFileArtifact treeFileArtifactA = ActionInputHelper.treeFileArtifact(
- artifact1, new PathFragment("child1"));
+ artifact1, PathFragment.create("child1"));
TreeFileArtifact treeFileArtifactB = ActionInputHelper.treeFileArtifact(
- artifact1, new PathFragment("child2"));
+ artifact1, PathFragment.create("child2"));
registerAction(new TouchingTestAction(treeFileArtifactA, treeFileArtifactB));
// artifact2 is a tree artifact generated by an action template.
@@ -807,9 +807,9 @@ public class TreeArtifactBuildTest extends TimestampBuilderTestCase {
// One Action that touches the output file.
// The other action that just throws when executed.
TreeFileArtifact expectedOutputTreeFileArtifact1 = ActionInputHelper.treeFileArtifact(
- artifact2, new PathFragment("child1"));
+ artifact2, PathFragment.create("child1"));
TreeFileArtifact expectedOutputTreeFileArtifact2 = ActionInputHelper.treeFileArtifact(
- artifact2, new PathFragment("child2"));
+ artifact2, PathFragment.create("child2"));
Action generateOutputAction = new DummyAction(
ImmutableList.<Artifact>of(treeFileArtifactA), expectedOutputTreeFileArtifact1);
Action throwingAction = new ThrowingDummyAction(
@@ -837,9 +837,9 @@ public class TreeArtifactBuildTest extends TimestampBuilderTestCase {
// artifact1 is a tree artifact generated by a TouchingTestAction.
Artifact artifact1 = createTreeArtifact("treeArtifact1");
TreeFileArtifact treeFileArtifactA = ActionInputHelper.treeFileArtifact(
- artifact1, new PathFragment("child1"));
+ artifact1, PathFragment.create("child1"));
TreeFileArtifact treeFileArtifactB = ActionInputHelper.treeFileArtifact(
- artifact1, new PathFragment("child2"));
+ artifact1, PathFragment.create("child2"));
registerAction(new TouchingTestAction(treeFileArtifactA, treeFileArtifactB));
// artifact2 is a tree artifact generated by an action template.
@@ -850,9 +850,9 @@ public class TreeArtifactBuildTest extends TimestampBuilderTestCase {
// We mock out the action template function to expand into two actions that throw when executed.
TreeFileArtifact expectedOutputTreeFileArtifact1 = ActionInputHelper.treeFileArtifact(
- artifact2, new PathFragment("child1"));
+ artifact2, PathFragment.create("child1"));
TreeFileArtifact expectedOutputTreeFileArtifact2 = ActionInputHelper.treeFileArtifact(
- artifact2, new PathFragment("child2"));
+ artifact2, PathFragment.create("child2"));
Action throwingAction = new ThrowingDummyAction(
ImmutableList.<Artifact>of(treeFileArtifactA),
ImmutableList.<Artifact>of(expectedOutputTreeFileArtifact1));
@@ -1044,7 +1044,7 @@ public class TreeArtifactBuildTest extends TimestampBuilderTestCase {
void registerOutput(ActionExecutionContext context, String outputName) throws IOException {
context.getMetadataHandler().addExpandedTreeOutput(
- treeFileArtifact(getSoleOutput(), new PathFragment(outputName)));
+ treeFileArtifact(getSoleOutput(), PathFragment.create(outputName)));
}
static List<TreeFileArtifact> asTreeFileArtifacts(final Artifact parent, String... files) {
@@ -1158,7 +1158,7 @@ public class TreeArtifactBuildTest extends TimestampBuilderTestCase {
private Artifact createTreeArtifact(String name) {
FileSystem fs = scratch.getFileSystem();
Path execRoot = fs.getPath(TestUtils.tmpDir());
- PathFragment execPath = new PathFragment("out").getRelative(name);
+ PathFragment execPath = PathFragment.create("out").getRelative(name);
Path path = execRoot.getRelative(execPath);
return new SpecialArtifact(
path, Root.asDerivedRoot(execRoot, execRoot.getRelative("out")), execPath, ALL_OWNER,