From a5f0a9f7eef3e68386951dc0a3b1197d98553d28 Mon Sep 17 00:00:00 2001 From: Tian Zhang Date: Thu, 4 Apr 2019 22:41:38 -0700 Subject: [PATCH 1/3] Fix ITMS-90539 Fix embed condition Revert "Fix embed condition" This reverts commit fc586863aad7cda8fc506e02bed10717dae66638. separate condition --- Sources/XcodeGenKit/PBXProjGenerator.swift | 12 +++++-- .../Project.xcodeproj/project.pbxproj | 34 +++++++++---------- 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/Sources/XcodeGenKit/PBXProjGenerator.swift b/Sources/XcodeGenKit/PBXProjGenerator.swift index 6d819c74..5ea1bb1b 100644 --- a/Sources/XcodeGenKit/PBXProjGenerator.swift +++ b/Sources/XcodeGenKit/PBXProjGenerator.swift @@ -420,7 +420,9 @@ public class PBXProjGenerator { let targetDependencies = (target.transitivelyLinkDependencies ?? project.options.transitivelyLinkDependencies) ? getAllDependenciesPlusTransitiveNeedingEmbedding(target: target) : target.dependencies - let directlyEmbedCarthage = target.directlyEmbedCarthageDependencies ?? !(target.platform.requiresSimulatorStripping && target.type.isApp) + let targetSupportsDirectEmbed = !(target.platform.requiresSimulatorStripping && + ((target.type.isApp && target.platform != .watchOS) || target.type == .watch2Extension )) + let directlyEmbedCarthage = target.directlyEmbedCarthageDependencies ?? targetSupportsDirectEmbed func getEmbedSettings(dependency: Dependency, codeSign: Bool) -> [String: Any] { var embedAttributes: [String] = [] @@ -606,7 +608,7 @@ public class PBXProjGenerator { for dependency in carthageDependencies { guard target.type != .staticLibrary else { break } - let embed = dependency.embed ?? target.shouldEmbedDependencies + let embed = dependency.embed ?? target.shouldEmbedCarthageDependencies var platformPath = Path(carthageResolver.buildPath(for: target.platform)) var frameworkPath = platformPath + dependency.reference @@ -998,6 +1000,12 @@ extension Target { var shouldEmbedDependencies: Bool { return type.isApp || type.isTest } + + var shouldEmbedCarthageDependencies: Bool { + return (type.isApp && platform != .watchOS) + || type == .watch2Extension + || type.isTest + } } extension Platform { diff --git a/Tests/Fixtures/TestProject/Project.xcodeproj/project.pbxproj b/Tests/Fixtures/TestProject/Project.xcodeproj/project.pbxproj index dc91f913..e79b85cd 100644 --- a/Tests/Fixtures/TestProject/Project.xcodeproj/project.pbxproj +++ b/Tests/Fixtures/TestProject/Project.xcodeproj/project.pbxproj @@ -1125,7 +1125,6 @@ buildPhases = ( 91C895DE8170C96A75D29426BA2BC597 /* Sources */, B7B71FA7D279029BF7A7FC7C08E41BB0 /* Resources */, - 261B4BE58AA60B68A81874E3318793F3 /* Carthage */, C765431E5FF4B02F59DE79B068D2CB68 /* Embed App Extensions */, ); buildRules = ( @@ -1144,6 +1143,7 @@ buildPhases = ( AE7971E1CA54D23C264E6541EA9BAE1B /* Sources */, 4A6E8F3A477AA5F67A8EB733DFAD8387 /* Resources */, + 8F8EE32AFABD8FEF976253259FA39ABC /* Carthage */, ); buildRules = ( ); @@ -1580,22 +1580,6 @@ shellPath = /bin/sh; shellScript = "ditto \"${SCRIPT_INPUT_FILE_0}\" \"${SCRIPT_OUTPUT_FILE_0}\"\n"; }; - 261B4BE58AA60B68A81874E3318793F3 /* Carthage */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "$(SRCROOT)/Carthage/Build/watchOS/Result.framework", - ); - name = Carthage; - outputPaths = ( - "$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/Result.framework", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "carthage copy-frameworks\n"; - }; 37182EC208DBF03DB1BAF452E1D2C836 /* Carthage */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -1684,6 +1668,22 @@ shellPath = /bin/sh; shellScript = "echo \"You ran a script\"\n"; }; + 8F8EE32AFABD8FEF976253259FA39ABC /* Carthage */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(SRCROOT)/Carthage/Build/watchOS/Result.framework", + ); + name = Carthage; + outputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/Result.framework", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "carthage copy-frameworks\n"; + }; BA454AAC926EDFCDA9226CBCACCBEDB1 /* MyScript */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; From 09801e4b41e8c53851e3b4b51f3102265cf9ba7d Mon Sep 17 00:00:00 2001 From: Tian Zhang Date: Thu, 4 Apr 2019 23:47:15 -0700 Subject: [PATCH 2/3] Remove unnecessary condition --- Sources/XcodeGenKit/PBXProjGenerator.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/XcodeGenKit/PBXProjGenerator.swift b/Sources/XcodeGenKit/PBXProjGenerator.swift index 5ea1bb1b..defd077a 100644 --- a/Sources/XcodeGenKit/PBXProjGenerator.swift +++ b/Sources/XcodeGenKit/PBXProjGenerator.swift @@ -421,7 +421,7 @@ public class PBXProjGenerator { getAllDependenciesPlusTransitiveNeedingEmbedding(target: target) : target.dependencies let targetSupportsDirectEmbed = !(target.platform.requiresSimulatorStripping && - ((target.type.isApp && target.platform != .watchOS) || target.type == .watch2Extension )) + (target.type.isApp || target.type == .watch2Extension)) let directlyEmbedCarthage = target.directlyEmbedCarthageDependencies ?? targetSupportsDirectEmbed func getEmbedSettings(dependency: Dependency, codeSign: Bool) -> [String: Any] { From dc9a55bdc8d4d2f95dfa749687b634f5bb7d1999 Mon Sep 17 00:00:00 2001 From: Tian Zhang Date: Mon, 8 Apr 2019 09:25:57 -0700 Subject: [PATCH 3/3] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 89918ff3..9138b532 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ #### Fixed - Fixed `optional` file sources not being added to the project [#557](https://github.com/yonaskolb/XcodeGen/pull/557) @yonaskolb - Fixed order of file generation. Plists are now generated before the project is generated so that the project includes the generated plists [#544](https://github.com/yonaskolb/XcodeGen/issues/544) @tomquist +- Addressed an issue that causes Carthage depencencies incorrectly embedded in WatchKit app bundle instead of WatchKit app extension [#558](https://github.com/yonaskolb/XcodeGen/pull/558) @KhaosT ## 2.4.0