aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/objc
diff options
context:
space:
mode:
authorGravatar allevato <allevato@google.com>2017-05-08 15:09:56 -0400
committerGravatar Kristina Chodorow <kchodorow@google.com>2017-05-09 10:52:38 -0400
commit69044c06ff876f62faecef90a37d0b0a0b2eae40 (patch)
tree1ddff571b2a04ae894bd53f7137aedf2c9d7464c /src/main/java/com/google/devtools/build/lib/rules/objc
parent1f75476f7a2f1abb449d538ef865f51ac138d013 (diff)
Handle labels with explicit repositories correctly in objc rules.
The `structured_resources` path stemming used by `objc_library` and `objc_bundle_library` no longer breaks if one of these rules tries to reference a label with an explicit repository prefix. Previously, using "@foo//bar:baz" in such a rule would fail because the individual files would retain their "external/foo/" prefix but the owner path against which those files were relativized would not have it because of the use of getPackageFragment() instead of getPackageIdentifier().getSourceRoot(). RELNOTES: None. PiperOrigin-RevId: 155409464
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/objc')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/BundleableFile.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommon.java3
2 files changed, 4 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/BundleableFile.java b/src/main/java/com/google/devtools/build/lib/rules/objc/BundleableFile.java
index 8a4881abd8..21436a543a 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/BundleableFile.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/BundleableFile.java
@@ -116,7 +116,8 @@ public final class BundleableFile extends Value<BundleableFile> {
}
private static String ownerBundlePath(Artifact file) {
- PathFragment packageFragment = file.getArtifactOwner().getLabel().getPackageFragment();
+ PathFragment packageFragment =
+ file.getArtifactOwner().getLabel().getPackageIdentifier().getSourceRoot();
return file.getRootRelativePath().relativeTo(packageFragment).toString();
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommon.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommon.java
index 016b687086..509f379726 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommon.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommon.java
@@ -755,7 +755,8 @@ public final class ObjcCommon {
static Iterable<PathFragment> xcodeStructuredResourceDirs(Iterable<Artifact> artifacts) {
ImmutableSet.Builder<PathFragment> containers = new ImmutableSet.Builder<>();
for (Artifact artifact : artifacts) {
- PathFragment ownerRuleDirectory = artifact.getArtifactOwner().getLabel().getPackageFragment();
+ PathFragment ownerRuleDirectory =
+ artifact.getArtifactOwner().getLabel().getPackageIdentifier().getSourceRoot();
String containerName =
artifact.getRootRelativePath().relativeTo(ownerRuleDirectory).getSegment(0);
PathFragment rootExecPath = artifact.getRoot().getExecPath();