aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/packages
diff options
context:
space:
mode:
authorGravatar dannark <dannark@google.com>2018-06-21 14:40:46 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-06-21 14:42:47 -0700
commitc7c5ab1c96389212509813d56bac6f0607d68142 (patch)
tree76ddecb86030788b37650bfa5a94276133971ea2 /src/main/java/com/google/devtools/build/lib/packages
parent8b73f8d5bcf9d23e44ac5c4a7d6f51247013c232 (diff)
Remap labels that include a repository name that appear in $(location x).
RELNOTES: None. PiperOrigin-RevId: 201588988
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/packages')
-rw-r--r--src/main/java/com/google/devtools/build/lib/packages/Package.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/packages/Package.java b/src/main/java/com/google/devtools/build/lib/packages/Package.java
index 3d84851a22..cb7c427ae7 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/Package.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/Package.java
@@ -255,16 +255,23 @@ public class Package {
}
/**
- * Returns the workspace mappings for the repository with the given absolute name.
+ * Returns the repository mapping for the requested external repository.
*
* @throws LabelSyntaxException if repository is not a valid {@link RepositoryName}
+ * @throws UnsupportedOperationException if called from any package other than the //external
+ * package
*/
- public ImmutableMap<RepositoryName, RepositoryName> getRepositoryMapping(
- String repository) throws LabelSyntaxException {
+ public ImmutableMap<RepositoryName, RepositoryName> getRepositoryMapping(String repository)
+ throws LabelSyntaxException, UnsupportedOperationException {
RepositoryName repositoryName = RepositoryName.create(repository);
return getRepositoryMapping(repositoryName);
}
+ /** Get the repository mapping for this package. */
+ public ImmutableMap<RepositoryName, RepositoryName> getRepositoryMapping() {
+ return repositoryMapping;
+ }
+
/**
* Gets the global name for a repository within an external repository.
*