aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/cmdline
diff options
context:
space:
mode:
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