aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/cmdline
diff options
context:
space:
mode:
authorGravatar Kristina Chodorow <kchodorow@google.com>2016-09-19 18:08:59 +0000
committerGravatar Laszlo Csomor <laszlocsomor@google.com>2016-09-20 06:45:52 +0000
commit82d43279f93d95e4c41b4bc598a3cc05ddd1ae1a (patch)
tree6554cd4499ca265d9ad9ae1d3ef9867afe97e0c6 /src/main/java/com/google/devtools/build/lib/cmdline
parent35b50d26893147c642eeb48b8247350a87f03741 (diff)
Change execution root for external repositories to be ../repo
Some of the important aspect of this change: * Remote repos in the execution root are under output_base/execroot/repo_name, so the prefix is ../repo_name (to escape the local workspace name). * Package roots for external repos were previously "output_base/", they are now output_base/external/repo_name (which means source artifacts always have a relative path from their repository). * Outputs are under bazel-bin/external/repo_name/ (or similarly under genfiles). Note that this is a bit of a change from how this was implemented in the previous cl. Fixes #1262. RELNOTES[INC]: Previously, an external repository would be symlinked into the execution root at execroot/local_repo/external/remote_repo. This changes it to be at execroot/remote_repo. This may break genrules/Skylark actions that hardcode execution root paths. If this causes breakages for you, ensure that genrules are using $(location :target) to access files and Skylark rules are using http://bazel.io/docs/skylark/lib/File.html's path, dirname, etc. functions. Roll forward of bdfd58a. -- MOS_MIGRATED_REVID=133606309
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/cmdline')
-rw-r--r--src/main/java/com/google/devtools/build/lib/cmdline/Label.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/cmdline/PackageIdentifier.java10
-rw-r--r--src/main/java/com/google/devtools/build/lib/cmdline/RepositoryName.java13
3 files changed, 5 insertions, 22 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/cmdline/Label.java b/src/main/java/com/google/devtools/build/lib/cmdline/Label.java
index b5a699023e..fb4c47f0c8 100644
--- a/src/main/java/com/google/devtools/build/lib/cmdline/Label.java
+++ b/src/main/java/com/google/devtools/build/lib/cmdline/Label.java
@@ -72,7 +72,7 @@ public final class Label implements Comparable<Label>, Serializable, SkylarkPrin
public static final PackageIdentifier EXTERNAL_PACKAGE_IDENTIFIER =
PackageIdentifier.createInMainRepo(EXTERNAL_PACKAGE_NAME);
- public static final String EXTERNAL_PATH_PREFIX = "external";
+ public static final String EXTERNAL_PATH_PREFIX = "..";
private static final Interner<Label> LABEL_INTERNER = Interners.newWeakInterner();
@@ -334,7 +334,7 @@ public final class Label implements Comparable<Label>, Serializable, SkylarkPrin
doc = "Returns the execution root for the workspace of this label, relative to the execroot. "
+ "For instance:<br>"
+ "<pre class=language-python>Label(\"@repo//pkg/foo:abc\").workspace_root =="
- + " \"external/repo\"</pre>")
+ + " \"../repo\"</pre>")
public String getWorkspaceRoot() {
return packageIdentifier.getRepository().getSourceRoot().toString();
}
diff --git a/src/main/java/com/google/devtools/build/lib/cmdline/PackageIdentifier.java b/src/main/java/com/google/devtools/build/lib/cmdline/PackageIdentifier.java
index 905866f077..727433a244 100644
--- a/src/main/java/com/google/devtools/build/lib/cmdline/PackageIdentifier.java
+++ b/src/main/java/com/google/devtools/build/lib/cmdline/PackageIdentifier.java
@@ -124,15 +124,7 @@ public final class PackageIdentifier implements Comparable<PackageIdentifier>, S
}
public PathFragment getPathUnderExecRoot() {
- return getSourceRoot();
- }
-
- /**
- * Returns the runfiles/execRoot path for this repository (relative to the x.runfiles/main-repo/
- * directory).
- */
- public PathFragment getRunfilesPath() {
- return repository.getRunfilesPath().getRelative(pkgName);
+ return repository.getPathUnderExecRoot().getRelative(pkgName);
}
public PackageIdentifier makeAbsolute() {
diff --git a/src/main/java/com/google/devtools/build/lib/cmdline/RepositoryName.java b/src/main/java/com/google/devtools/build/lib/cmdline/RepositoryName.java
index ba0f6b407b..cfad122e69 100644
--- a/src/main/java/com/google/devtools/build/lib/cmdline/RepositoryName.java
+++ b/src/main/java/com/google/devtools/build/lib/cmdline/RepositoryName.java
@@ -214,8 +214,8 @@ public final class RepositoryName implements Serializable {
}
/**
- * Returns the runfiles/execRoot path for this repository. If we don't know the name of this repo
- * (i.e., it is in the main repository), return an empty path fragment.
+ * Returns the runfiles/execRoot path for this repository: ../reponame. If we don't know the name
+ * of this repo (i.e., it is in the main repository), return an empty path fragment.
*/
public PathFragment getPathUnderExecRoot() {
return isDefault() || isMain()
@@ -224,15 +224,6 @@ public final class RepositoryName implements Serializable {
}
/**
- * Returns the runfiles path relative to the x.runfiles/main-repo directory.
- */
- // TODO(kchodorow): remove once execroot is reorg-ed.
- public PathFragment getRunfilesPath() {
- return isDefault() || isMain()
- ? PathFragment.EMPTY_FRAGMENT : new PathFragment("..").getRelative(strippedName());
- }
-
- /**
* Returns the repository name, with leading "{@literal @}" (or "" for the default repository).
*/
@Override