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
diff --git a/src/main/java/com/google/devtools/build/lib/packages/Package.java b/src/main/java/com/google/devtools/build/lib/packages/Package.java
index 3a01bc3..b05e6ae 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/Package.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/Package.java
@@ -103,7 +103,7 @@
/**
* The root of the source tree in which this package was found. It is an invariant that
- * {@code sourceRoot.getRelative(packageId.getPathFragment()).equals(packageDirectory)}.
+ * {@code sourceRoot.getRelative(packageId.getSourceRoot()).equals(packageDirectory)}.
*/
private Path sourceRoot;
@@ -292,9 +292,9 @@
this.filename = builder.getFilename();
this.packageDirectory = filename.getParentDirectory();
- this.sourceRoot = getSourceRoot(filename, packageIdentifier.getPathFragment());
+ this.sourceRoot = getSourceRoot(filename, packageIdentifier.getSourceRoot());
if ((sourceRoot == null
- || !sourceRoot.getRelative(packageIdentifier.getPathFragment()).equals(packageDirectory))
+ || !sourceRoot.getRelative(packageIdentifier.getSourceRoot()).equals(packageDirectory))
&& !filename.getBaseName().equals("WORKSPACE")) {
throw new IllegalArgumentException(
"Invalid BUILD file name for package '" + packageIdentifier + "': " + filename);
@@ -345,7 +345,7 @@
* Returns the source root (a directory) beneath which this package's BUILD file was found.
*
* <p> Assumes invariant:
- * {@code getSourceRoot().getRelative(packageId.getPathFragment()).equals(getPackageDirectory())}
+ * {@code getSourceRoot().getRelative(packageId.getSourceRoot()).equals(getPackageDirectory())}
*/
public Path getSourceRoot() {
return sourceRoot;