Merge pull request #558 from KhaosT/fix-embed-watch-target

Fix Carthage dependencies for watchOS target
This commit is contained in:
Yonas Kolb 2019-04-09 21:47:45 +10:00 committed by GitHub
commit 17db27bb9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 19 deletions

View File

@ -13,6 +13,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

View File

@ -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.type == .watch2Extension))
let directlyEmbedCarthage = target.directlyEmbedCarthageDependencies ?? targetSupportsDirectEmbed
func getEmbedSettings(dependency: Dependency, codeSign: Bool) -> [String: Any] {
var embedAttributes: [String] = []
@ -612,7 +614,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
@ -1004,6 +1006,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 {

View File

@ -1171,7 +1171,6 @@
buildPhases = (
91C895DE8170C96A75D29426BA2BC597 /* Sources */,
B7B71FA7D279029BF7A7FC7C08E41BB0 /* Resources */,
261B4BE58AA60B68A81874E3318793F3 /* Carthage */,
C765431E5FF4B02F59DE79B068D2CB68 /* Embed App Extensions */,
);
buildRules = (
@ -1190,6 +1189,7 @@
buildPhases = (
AE7971E1CA54D23C264E6541EA9BAE1B /* Sources */,
4A6E8F3A477AA5F67A8EB733DFAD8387 /* Resources */,
8F8EE32AFABD8FEF976253259FA39ABC /* Carthage */,
);
buildRules = (
);
@ -1629,22 +1629,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;
@ -1733,6 +1717,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;