diff options
author | Dave MacLachlan <dmaclach@google.com> | 2015-09-21 22:39:51 +0000 |
---|---|---|
committer | Laszlo Csomor <laszlocsomor@google.com> | 2015-09-22 17:06:01 +0000 |
commit | 8e055ba53848bc78a95e54c0d91c021bcc82b9c4 (patch) | |
tree | 341cefa378dc4f43b17a999517ecbc6e70c65b1d /src/objc_tools | |
parent | be117336c9c8f4b663bdd33bab3bd27dce223673 (diff) |
Changes dylibs from being part of the xcodeproject file references to being arguments to OTHER_LDFLAGS. Command lines now use -l"name" to link libraries. This solves the problem that libraries in Xcode 7 now have .tbd files instead of dylibs in device builds and maintains backwards compatibility with Xcode 6.
Also modifies Bazel Objclink action to pass in libraries as -l"name" arguments.
RELNOTES:Adds support for dylibs on devices for Xcode 7.
--
MOS_MIGRATED_REVID=103589448
Diffstat (limited to 'src/objc_tools')
2 files changed, 14 insertions, 21 deletions
diff --git a/src/objc_tools/xcodegen/java/com/google/devtools/build/xcode/xcodegen/LibraryObjects.java b/src/objc_tools/xcodegen/java/com/google/devtools/build/xcode/xcodegen/LibraryObjects.java index f751d9d48b..11c738a33d 100644 --- a/src/objc_tools/xcodegen/java/com/google/devtools/build/xcode/xcodegen/LibraryObjects.java +++ b/src/objc_tools/xcodegen/java/com/google/devtools/build/xcode/xcodegen/LibraryObjects.java @@ -43,7 +43,6 @@ import java.util.LinkedHashSet; public final class LibraryObjects implements HasProjectNavigatorFiles { @VisibleForTesting static final String FRAMEWORK_FILE_TYPE = "wrapper.framework"; - @VisibleForTesting static final String DYLIB_FILE_TYPE = "compiled.mach-o.dylib"; private final LinkedHashMap<FileReference, PBXReference> fileToMainGroupReferences = new LinkedHashMap<>(); @@ -67,19 +66,6 @@ public final class LibraryObjects implements HasProjectNavigatorFiles { private BuildPhaseBuilder() {} // Don't allow instantiation from outside the enclosing class. /** - * Creates a new dylib library based on the passed name. - * - * @param name simple dylib without ".dylib" suffix, e.g. "libz" - */ - public BuildPhaseBuilder addDylib(String name) { - FileReference reference = - FileReference.of(String.format("usr/lib/%s.dylib", name), SourceTree.SDKROOT) - .withExplicitFileType(DYLIB_FILE_TYPE); - fileReferences.add(reference); - return this; - } - - /** * Creates a new SDK framework based on the passed name. * * @param name simple framework name without ".framework" suffix, e.g. "Foundation" diff --git a/src/objc_tools/xcodegen/java/com/google/devtools/build/xcode/xcodegen/XcodeprojGeneration.java b/src/objc_tools/xcodegen/java/com/google/devtools/build/xcode/xcodegen/XcodeprojGeneration.java index 2fae52f4c0..6e69f6fb19 100644 --- a/src/objc_tools/xcodegen/java/com/google/devtools/build/xcode/xcodegen/XcodeprojGeneration.java +++ b/src/objc_tools/xcodegen/java/com/google/devtools/build/xcode/xcodegen/XcodeprojGeneration.java @@ -348,14 +348,9 @@ public class XcodeprojGeneration { } } - private static PBXFrameworksBuildPhase buildLibraryInfo( + private static PBXFrameworksBuildPhase buildFrameworksInfo( LibraryObjects libraryObjects, TargetControl target) { BuildPhaseBuilder builder = libraryObjects.newBuildPhase(); - if (Containing.item(PRODUCT_TYPES_THAT_HAVE_A_BINARY, productType(target))) { - for (String dylib : target.getSdkDylibList()) { - builder.addDylib(dylib); - } - } for (String sdkFramework : target.getSdkFrameworkList()) { builder.addSdkFramework(sdkFramework); } @@ -374,6 +369,15 @@ public class XcodeprojGeneration { flags.add("$(WORKSPACE_ROOT)/" + importedLibrary); } } + if (Containing.item(PRODUCT_TYPES_THAT_HAVE_A_BINARY, productType(targetControl))) { + for (String dylib : targetControl.getSdkDylibList()) { + if (dylib.startsWith("lib")) { + dylib = dylib.substring(3); + } + flags.add("-l" + dylib); + } + } + return flags.build(); } @@ -530,7 +534,10 @@ public class XcodeprojGeneration { } target.setProductReference(productReference); - PBXFrameworksBuildPhase frameworksPhase = buildLibraryInfo(libraryObjects, targetControl); + // We only add frameworks here and not dylibs because of differences in how + // Xcode 6 and Xcode 7 specify dylibs in the project organizer. + // (Xcode 6 -> *.dylib, Xcode 7 -> *.tbd) + PBXFrameworksBuildPhase frameworksPhase = buildFrameworksInfo(libraryObjects, targetControl); PBXResourcesBuildPhase resourcesPhase = resources.resourcesBuildPhase(targetControl); for (String importedArchive : targetControl.getImportedLibraryList()) { |