CarthageDependencyResolver: ignore order-only dependencies (#1041)

* CarthageDependencyResolver: ignore target-only dependencies

* Update fixtures for expected changed in watchOS apps' FRAMEWORK_SEARCH_PATHS

* Update CHANGELOG.md
This commit is contained in:
Elliott Williams
2021-04-30 22:39:55 -07:00
committed by GitHub
parent 8d918c1e7e
commit fb559ba153
4 changed files with 27 additions and 24 deletions
+1
View File
@@ -22,6 +22,7 @@
- Fixed framework search paths when using `.xcframework`s. [#1015](https://github.com/yonaskolb/XcodeGen/pull/1015) @FranzBusch
- Fixed bug where schemes without a build target would crash instead of displaying an error [#1040](https://github.com/yonaskolb/XcodeGen/pull/1040) @dalemyers
- Fixed files with names ending in **Info.plist** (such as **GoogleServices-Info.plist**) from being omitted from the Copy Resources build phase. Now, only the resolved info plist file for each specific target is omitted. [#1027](https://github.com/yonaskolb/XcodeGen/pull/1027) @liamnichols
- Carthage frameworks are no longer embedded for "order-only" target dependencies. This avoid redundant embeds in situations where a target's sources _import_ a Carthage framework but do not have a binary dependency on it (like a test target which runs in a host app). [#1041](https://github.com/yonaskolb/XcodeGen/pull/1041) @elliottwilliams
#### Internal
- Build universal binaries for release. XcodeGen now runs natively on Apple Silicon. [#1024](https://github.com/yonaskolb/XcodeGen/pull/1024) @thii
@@ -68,6 +68,9 @@ public class CarthageDependencyResolver {
if let target = projectTarget as? Target {
for dependency in target.dependencies {
if case (false, false) = (dependency.link, dependency.embed ?? topLevelTarget.shouldEmbedCarthageDependencies) {
continue
}
guard !frameworks.contains(where: { $0.dependency == dependency }) else {
continue
}
@@ -2809,10 +2809,6 @@
00FD318C7418F3351FC00744 /* Test Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/watchOS",
);
INFOPLIST_FILE = App_watchOS/Info.plist;
PRODUCT_BUNDLE_IDENTIFIER = com.project.app.watch;
SDKROOT = watchos;
@@ -3333,10 +3329,6 @@
20803EC42C26E4EA13474E5A /* Production Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/watchOS",
);
INFOPLIST_FILE = App_watchOS/Info.plist;
PRODUCT_BUNDLE_IDENTIFIER = com.project.app.watch;
SDKROOT = watchos;
@@ -4704,10 +4696,6 @@
7B2A1BE6CA654E9903A4C680 /* Staging Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/watchOS",
);
INFOPLIST_FILE = App_watchOS/Info.plist;
PRODUCT_BUNDLE_IDENTIFIER = com.project.app.watch;
SDKROOT = watchos;
@@ -5457,10 +5445,6 @@
AABC1E325EADF86C5137D659 /* Production Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/watchOS",
);
INFOPLIST_FILE = App_watchOS/Info.plist;
PRODUCT_BUNDLE_IDENTIFIER = com.project.app.watch;
SDKROOT = watchos;
@@ -5965,10 +5949,6 @@
C4397CDA0D458BAD55C911B0 /* Staging Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/watchOS",
);
INFOPLIST_FILE = App_watchOS/Info.plist;
PRODUCT_BUNDLE_IDENTIFIER = com.project.app.watch;
SDKROOT = watchos;
@@ -6869,10 +6849,6 @@
F3AC6A112F81D0958A316D82 /* Test Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/watchOS",
);
INFOPLIST_FILE = App_watchOS/Info.plist;
PRODUCT_BUNDLE_IDENTIFIER = com.project.app.watch;
SDKROOT = watchos;
@@ -146,6 +146,29 @@ class CarthageDependencyResolverTests: XCTestCase {
try expect(related) == expectedDependencies
}
$0.it("skips dependencies which are not embedded") {
let resolver = CarthageDependencyResolver(project: makeTestProject())
let target = Target(name: "1", type: .application, platform: .iOS, dependencies: [
Dependency(type: .carthage(findFrameworks: false, linkType: .dynamic), reference: dependencyFixtureName, embed: false, link: false)
])
try expect(resolver.dependencies(for: target)) == []
}
$0.it("skips dependencies nested in targets which are not embedded") {
let nestedTarget = Target(name: "1", type: .framework, platform: .iOS, dependencies: [
Dependency(type: .carthage(findFrameworks: false, linkType: .dynamic), reference: dependencyFixtureName)
])
let resolver = CarthageDependencyResolver(project: makeTestProject(with: [nestedTarget]))
let target = Target(name: "2", type: .application, platform: .iOS, dependencies: [
Dependency(type: .target, reference: "1", embed: false, link: false)
])
try expect(resolver.dependencies(for: target)) == []
}
}
}