diff options
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/cmdline/RepositoryName.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/cmdline/RepositoryName.java | 14 |
1 files changed, 12 insertions, 2 deletions
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 5f1421f9c6..ba0f6b407b 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,6 +22,7 @@ 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; @@ -213,8 +214,8 @@ public final class RepositoryName implements Serializable { } /** - * 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. + * 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. */ public PathFragment getPathUnderExecRoot() { return isDefault() || isMain() @@ -223,6 +224,15 @@ 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 |