aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/cmdline
diff options
context:
space:
mode:
authorGravatar Kristina Chodorow <kchodorow@google.com>2017-02-16 17:00:53 +0000
committerGravatar Dmitry Lomov <dslomov@google.com>2017-02-16 17:02:42 +0000
commit4b73e972d909bcd533f2f9940f95a00b9b73bdde (patch)
tree9144d26934aef8e16036d80d249f416bc585bbe4 /src/main/java/com/google/devtools/build/lib/cmdline
parentb222872e8d61cbd590bdaeb3cbb1764df70e4270 (diff)
Roll forward execroot change
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. Custom crosstools that hardcode external/<repo> paths will have to be updated. Issue #1262. -- PiperOrigin-RevId: 147726370 MOS_MIGRATED_REVID=147726370
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.java10
-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.java14
3 files changed, 7 insertions, 27 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 0fb7a08b10..7e3649102c 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 = BlazeInterners.newWeakInterner();
@@ -336,12 +336,12 @@ public final class Label implements Comparable<Label>, Serializable, SkylarkPrin
* it will returns an empty string.
*/
@SkylarkCallable(name = "workspace_root", structField = true,
- doc = "Returns the execution root for the workspace of this label, relative to the execroot. "
- + "For instance:<br>"
+ 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();
+ return packageIdentifier.getRepository().getPathUnderExecRoot().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 1e2e3d0385..f8dda81582 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
@@ -20,10 +20,8 @@ import com.google.devtools.build.lib.concurrent.BlazeInterners;
import com.google.devtools.build.lib.util.Preconditions;
import com.google.devtools.build.lib.vfs.Canonicalizer;
import com.google.devtools.build.lib.vfs.PathFragment;
-
import java.io.Serializable;
import java.util.Objects;
-
import javax.annotation.concurrent.Immutable;
/**
@@ -127,14 +125,6 @@ public final class PackageIdentifier implements Comparable<PackageIdentifier>, S
return repository.getPathUnderExecRoot().getRelative(pkgName);
}
- /**
- * Returns the runfiles/execRoot path for this repository (relative to the x.runfiles/main-repo/
- * directory).
- */
- public PathFragment getRunfilesPath() {
- return repository.getRunfilesPath().getRelative(pkgName);
- }
-
public PackageIdentifier makeAbsolute() {
if (!repository.isDefault()) {
return this;
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..5f1421f9c6 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
@@ -22,7 +22,6 @@ import com.google.devtools.build.lib.util.Pair;
import com.google.devtools.build.lib.util.StringCanonicalizer;
import com.google.devtools.build.lib.util.StringUtilities;
import com.google.devtools.build.lib.vfs.PathFragment;
-
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
@@ -214,8 +213,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 +223,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