diff options
author | Michael Thvedt <mthvedt@google.com> | 2015-08-18 15:00:06 +0000 |
---|---|---|
committer | Lukacs Berki <lberki@google.com> | 2015-08-20 14:44:19 +0000 |
commit | ca3061ae13e605529b7600830964ad3db3642c6d (patch) | |
tree | 0aad9c405f7bdca78ad3a4b3466200b10ab1ca78 /src/main/java/com/google/devtools/build | |
parent | 3f610e837d08eaa72d5ead62a7215365e14a24cb (diff) |
Deduplicate XCode target names in the dependencies propagated to XCode projects.
--
MOS_MIGRATED_REVID=100924958
Diffstat (limited to 'src/main/java/com/google/devtools/build')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/objc/XcodeProvider.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/XcodeProvider.java b/src/main/java/com/google/devtools/build/lib/rules/objc/XcodeProvider.java index 58db685f08..96a124c290 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/XcodeProvider.java +++ b/src/main/java/com/google/devtools/build/lib/rules/objc/XcodeProvider.java @@ -556,6 +556,10 @@ public final class XcodeProvider implements TransitiveInfoProvider { .addSupportFile(buildFilePath); if (CAN_LINK_PRODUCT_TYPES.contains(productType)) { + // For builds with --ios_multi_cpus set, we may have several copies of some XCodeProviders + // in the dependencies (one per cpu architecture). We deduplicate the corresponding + // xcode target names with a LinkedHashSet before adding to the TargetControl. + Set<DependencyControl> dependencySet = new LinkedHashSet<>(); for (XcodeProvider dependency : propagatedDependencies) { // Only add a library target to a binary's dependencies if it has source files to compile // and it is not from the "non_propagated_deps" attribute. Xcode cannot build targets @@ -572,11 +576,16 @@ public final class XcodeProvider implements TransitiveInfoProvider { boolean hasSources = dependency.compilationArtifacts.isPresent() && dependency.compilationArtifacts.get().getArchive().isPresent(); if (hasSources || (dependency.productType == XcodeProductType.BUNDLE)) { - targetControl.addDependency(DependencyControl.newBuilder() - .setTargetLabel(dependency.dependencyXcodeTargetName()) + String dependencyXcodeTargetName = dependency.dependencyXcodeTargetName(); + dependencySet.add(DependencyControl.newBuilder() + .setTargetLabel(dependencyXcodeTargetName) .build()); } } + + for (DependencyControl dependencyControl : dependencySet) { + targetControl.addDependency(dependencyControl); + } } for (XcodeProvider justTestHost : testHost.asSet()) { targetControl.addDependency(DependencyControl.newBuilder() |