Disambiguate jar paths in the exec root tree
Before, external jars would stomp on each other and the last jar loaded would
"win" (all others would be overwritten and the build would fail). This changes
symlink forest path generation to generate unique paths under
<exec-root>/external/ for jars, so multiple external jar dependencies can be
used.
--
MOS_MIGRATED_REVID=88952191
diff --git a/src/main/java/com/google/devtools/build/lib/packages/PackageIdentifier.java b/src/main/java/com/google/devtools/build/lib/packages/PackageIdentifier.java
index 5ff17ae..fd9d0ea 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/PackageIdentifier.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/PackageIdentifier.java
@@ -233,6 +233,16 @@
}
/**
+ * Returns a relative path that should be unique across all remote and packages, based on the
+ * repository and package names.
+ */
+ public PathFragment getPathFragment() {
+ return repository.isDefault() ? pkgName
+ : new PathFragment(ExternalPackage.NAME).getRelative(repository.strippedName())
+ .getRelative(pkgName);
+ }
+
+ /**
* Returns the name of this package.
*
* <p>There are certain places that expect the path fragment as the package name ('foo/bar') as a