aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib
diff options
context:
space:
mode:
authorGravatar Kristina Chodorow <kchodorow@google.com>2016-07-27 16:34:27 +0000
committerGravatar Adam Michael <ajmichael@google.com>2016-07-28 18:36:29 -0400
commita1a31ff6d16811dc72df32861bd1c1a98e104f02 (patch)
treeea94d4c1e7fa41f38be174a73f618152e18f1d65 /src/test/java/com/google/devtools/build/lib
parentb6b1a3f0670c7e62cec408b06a13ae02bbe1b42f (diff)
Rename some PackageId and RepositoryName fields/methods in prep for deep execroot change
This is in prep for making the execution root path for external repositories ../repo_name (instead of external/repo_name). Right now, the getRunfilesPath() returns that path, so that is renamed getExecRoot() (since the runfiles are really just a reflection of the execRoot structure). getSourceRoot() replaces getPathFragment, which has always been a confusing name (it's not clear from the name what the difference is between it and getPackageFragment()). It returns the relative path to source files for external repositories (external/repo_name). Also renamed/moved to more sensible class a few static RepositoryName fields. -- MOS_MIGRATED_REVID=128594419
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib')
-rw-r--r--src/test/java/com/google/devtools/build/lib/cmdline/PackageIdentifierTest.java10
-rw-r--r--src/test/java/com/google/devtools/build/lib/cmdline/RepositoryNameTest.java6
-rw-r--r--src/test/java/com/google/devtools/build/lib/rules/cpp/CrosstoolConfigurationLoaderTest.java2
-rw-r--r--src/test/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfTargetsUnderDirectoryFunctionTest.java8
-rw-r--r--src/test/java/com/google/devtools/build/lib/skyframe/RecursivePkgFunctionTest.java4
-rw-r--r--src/test/java/com/google/devtools/build/lib/skyframe/RecursivePkgKeyTest.java15
6 files changed, 22 insertions, 23 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/cmdline/PackageIdentifierTest.java b/src/test/java/com/google/devtools/build/lib/cmdline/PackageIdentifierTest.java
index 5d32df7f1b..e5a3ebb55a 100644
--- a/src/test/java/com/google/devtools/build/lib/cmdline/PackageIdentifierTest.java
+++ b/src/test/java/com/google/devtools/build/lib/cmdline/PackageIdentifierTest.java
@@ -39,7 +39,7 @@ public class PackageIdentifierTest {
PackageIdentifier fooA = PackageIdentifier.parse("@foo//a");
assertThat(fooA.getRepository().strippedName()).isEqualTo("foo");
assertThat(fooA.getPackageFragment().getPathString()).isEqualTo("a");
- assertThat(fooA.getRepository().getPathFragment()).isEqualTo(
+ assertThat(fooA.getRepository().getSourceRoot()).isEqualTo(
new PathFragment("external/foo"));
PackageIdentifier absoluteA = PackageIdentifier.parse("//a");
@@ -51,9 +51,9 @@ public class PackageIdentifierTest {
assertThat(plainA.getPackageFragment().getPathString()).isEqualTo("a");
PackageIdentifier mainA = PackageIdentifier.parse("@//a");
- assertThat(mainA.getRepository()).isEqualTo(PackageIdentifier.MAIN_REPOSITORY_NAME);
+ assertThat(mainA.getRepository()).isEqualTo(RepositoryName.MAIN);
assertThat(mainA.getPackageFragment().getPathString()).isEqualTo("a");
- assertThat(mainA.getRepository().getPathFragment()).isEqualTo(PathFragment.EMPTY_FRAGMENT);
+ assertThat(mainA.getRepository().getSourceRoot()).isEqualTo(PathFragment.EMPTY_FRAGMENT);
}
@Test
@@ -102,9 +102,9 @@ public class PackageIdentifierTest {
@Test
public void testRunfilesDir() throws Exception {
- assertThat(PackageIdentifier.create("@foo", new PathFragment("bar/baz")).getRunfilesPath())
+ assertThat(PackageIdentifier.create("@foo", new PathFragment("bar/baz")).getPathUnderExecRoot())
.isEqualTo(new PathFragment("../foo/bar/baz"));
- assertThat(PackageIdentifier.create("@", new PathFragment("bar/baz")).getRunfilesPath())
+ assertThat(PackageIdentifier.create("@", new PathFragment("bar/baz")).getPathUnderExecRoot())
.isEqualTo(new PathFragment("bar/baz"));
}
}
diff --git a/src/test/java/com/google/devtools/build/lib/cmdline/RepositoryNameTest.java b/src/test/java/com/google/devtools/build/lib/cmdline/RepositoryNameTest.java
index 9a39bbfda1..7d358619ee 100644
--- a/src/test/java/com/google/devtools/build/lib/cmdline/RepositoryNameTest.java
+++ b/src/test/java/com/google/devtools/build/lib/cmdline/RepositoryNameTest.java
@@ -59,11 +59,11 @@ public class RepositoryNameTest {
@Test
public void testRunfilesDir() throws Exception {
- assertThat(RepositoryName.create("@foo").getRunfilesPath())
+ assertThat(RepositoryName.create("@foo").getPathUnderExecRoot())
.isEqualTo(new PathFragment("../foo"));
- assertThat(RepositoryName.create("@").getRunfilesPath())
+ assertThat(RepositoryName.create("@").getPathUnderExecRoot())
.isEqualTo(PathFragment.EMPTY_FRAGMENT);
- assertThat(RepositoryName.create("").getRunfilesPath())
+ assertThat(RepositoryName.create("").getPathUnderExecRoot())
.isEqualTo(PathFragment.EMPTY_FRAGMENT);
}
diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/CrosstoolConfigurationLoaderTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/CrosstoolConfigurationLoaderTest.java
index d2d84e9ebf..8955951245 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/cpp/CrosstoolConfigurationLoaderTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/CrosstoolConfigurationLoaderTest.java
@@ -691,7 +691,7 @@ public class CrosstoolConfigurationLoaderTest extends AnalysisTestCase {
TestConstants.TOOLS_REPOSITORY,
new PathFragment(
new PathFragment(TestConstants.TOOLS_REPOSITORY_PATH), new PathFragment(path)));
- return packageIdentifier.getPathFragment();
+ return packageIdentifier.getSourceRoot();
}
private void checkToolchainB(CppConfigurationLoader loader, LipoMode lipoMode, String... args)
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfTargetsUnderDirectoryFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfTargetsUnderDirectoryFunctionTest.java
index 207465cda8..0a8aed0a29 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfTargetsUnderDirectoryFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfTargetsUnderDirectoryFunctionTest.java
@@ -23,7 +23,7 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.devtools.build.lib.analysis.util.BuildViewTestCase;
import com.google.devtools.build.lib.cmdline.Label;
-import com.google.devtools.build.lib.cmdline.PackageIdentifier;
+import com.google.devtools.build.lib.cmdline.RepositoryName;
import com.google.devtools.build.lib.pkgcache.FilteringPolicies;
import com.google.devtools.build.lib.pkgcache.FilteringPolicy;
import com.google.devtools.build.lib.util.Preconditions;
@@ -59,7 +59,7 @@ public class PrepareDepsOfTargetsUnderDirectoryFunctionTest extends BuildViewTes
Path root, PathFragment rootRelativePath, ImmutableSet<PathFragment> excludedPaths) {
RootedPath rootedPath = RootedPath.toRootedPath(root, rootRelativePath);
return CollectPackagesUnderDirectoryValue.key(
- PackageIdentifier.MAIN_REPOSITORY_NAME, rootedPath, excludedPaths);
+ RepositoryName.MAIN, rootedPath, excludedPaths);
}
private SkyKey createPrepDepsKey(Path root, PathFragment rootRelativePath) {
@@ -70,14 +70,14 @@ public class PrepareDepsOfTargetsUnderDirectoryFunctionTest extends BuildViewTes
ImmutableSet<PathFragment> excludedPaths) {
RootedPath rootedPath = RootedPath.toRootedPath(root, rootRelativePath);
return PrepareDepsOfTargetsUnderDirectoryValue.key(
- PackageIdentifier.MAIN_REPOSITORY_NAME, rootedPath, excludedPaths);
+ RepositoryName.MAIN, rootedPath, excludedPaths);
}
private SkyKey createPrepDepsKey(Path root, PathFragment rootRelativePath,
ImmutableSet<PathFragment> excludedPaths, FilteringPolicy filteringPolicy) {
RootedPath rootedPath = RootedPath.toRootedPath(root, rootRelativePath);
return PrepareDepsOfTargetsUnderDirectoryValue.key(
- PackageIdentifier.MAIN_REPOSITORY_NAME, rootedPath, excludedPaths, filteringPolicy);
+ RepositoryName.MAIN, rootedPath, excludedPaths, filteringPolicy);
}
private EvaluationResult<?> getEvaluationResult(SkyKey... keys) throws InterruptedException {
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/RecursivePkgFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/RecursivePkgFunctionTest.java
index 5a16bc386f..d6c6459c8e 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/RecursivePkgFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/RecursivePkgFunctionTest.java
@@ -22,7 +22,7 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.devtools.build.lib.analysis.util.BuildViewTestCase;
-import com.google.devtools.build.lib.cmdline.PackageIdentifier;
+import com.google.devtools.build.lib.cmdline.RepositoryName;
import com.google.devtools.build.lib.util.Preconditions;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.PathFragment;
@@ -60,7 +60,7 @@ public class RecursivePkgFunctionTest extends BuildViewTestCase {
Path root, PathFragment rootRelativePath, ImmutableSet<PathFragment> excludedPaths) {
RootedPath rootedPath = RootedPath.toRootedPath(root, rootRelativePath);
return RecursivePkgValue.key(
- PackageIdentifier.MAIN_REPOSITORY_NAME, rootedPath, excludedPaths);
+ RepositoryName.MAIN, rootedPath, excludedPaths);
}
private RecursivePkgValue buildRecursivePkgValue(Path root, PathFragment rootRelativePath)
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/RecursivePkgKeyTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/RecursivePkgKeyTest.java
index 6ee4ac0b4d..9d0fc4dba1 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/RecursivePkgKeyTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/RecursivePkgKeyTest.java
@@ -17,7 +17,6 @@ import static org.junit.Assert.fail;
import com.google.common.collect.ImmutableSet;
import com.google.devtools.build.lib.analysis.util.BuildViewTestCase;
-import com.google.devtools.build.lib.cmdline.PackageIdentifier;
import com.google.devtools.build.lib.cmdline.RepositoryName;
import com.google.devtools.build.lib.skyframe.RecursivePkgValue.RecursivePkgKey;
import com.google.devtools.build.lib.vfs.PathFragment;
@@ -44,7 +43,7 @@ public class RecursivePkgKeyTest extends BuildViewTestCase {
PathFragment rootRelativePath, ImmutableSet<PathFragment> excludedPaths) {
try {
buildRecursivePkgKey(
- PackageIdentifier.MAIN_REPOSITORY_NAME, rootRelativePath, excludedPaths);
+ RepositoryName.MAIN, rootRelativePath, excludedPaths);
fail();
} catch (IllegalArgumentException expected) {
}
@@ -53,29 +52,29 @@ public class RecursivePkgKeyTest extends BuildViewTestCase {
@Test
public void testValidRecursivePkgKeys() throws Exception {
buildRecursivePkgKey(
- PackageIdentifier.MAIN_REPOSITORY_NAME,
+ RepositoryName.MAIN,
new PathFragment(""),
ImmutableSet.<PathFragment>of());
buildRecursivePkgKey(
- PackageIdentifier.MAIN_REPOSITORY_NAME,
+ RepositoryName.MAIN,
new PathFragment(""),
ImmutableSet.of(new PathFragment("a")));
buildRecursivePkgKey(
- PackageIdentifier.MAIN_REPOSITORY_NAME,
+ RepositoryName.MAIN,
new PathFragment("a"),
ImmutableSet.<PathFragment>of());
buildRecursivePkgKey(
- PackageIdentifier.MAIN_REPOSITORY_NAME,
+ RepositoryName.MAIN,
new PathFragment("a"),
ImmutableSet.of(new PathFragment("a/b")));
buildRecursivePkgKey(
- PackageIdentifier.MAIN_REPOSITORY_NAME,
+ RepositoryName.MAIN,
new PathFragment("a/b"),
ImmutableSet.<PathFragment>of());
buildRecursivePkgKey(
- PackageIdentifier.MAIN_REPOSITORY_NAME,
+ RepositoryName.MAIN,
new PathFragment("a/b"),
ImmutableSet.of(new PathFragment("a/b/c")));
}