Skip to content

Commit a39d28e

Browse files
authored
fix: return true for supportsResources on commandLineTool, macro, and xpc (#454)
1 parent ae8a8a7 commit a39d28e

File tree

2 files changed

+61
-6
lines changed

2 files changed

+61
-6
lines changed

Sources/XcodeGraph/Models/Target.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -253,14 +253,14 @@ public struct Target: Equatable, Hashable, Comparable, Codable, Sendable {
253253
.stickerPackExtension,
254254
.appClip,
255255
.systemExtension,
256-
.extensionKitExtension:
257-
return true
258-
259-
case .commandLineTool,
256+
.extensionKitExtension,
257+
.commandLineTool,
260258
.macro,
261-
.dynamicLibrary,
262-
.staticLibrary,
263259
.xpc:
260+
return true
261+
262+
case .dynamicLibrary,
263+
.staticLibrary:
264264
return false
265265
}
266266
}

Tests/XcodeGraphTests/Models/TargetTests.swift

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,4 +112,59 @@ final class TargetTests: XCTestCase {
112112
// Then
113113
XCTAssertTrue(got)
114114
}
115+
116+
func test_supportsResources_returns_true_for_command_line_tools() {
117+
// Given
118+
let target = Target.test(destinations: .macOS, product: .commandLineTool)
119+
120+
// When
121+
let got = target.supportsResources
122+
123+
// Then
124+
XCTAssertTrue(got)
125+
}
126+
127+
func test_supportsResources_returns_true_for_macros() {
128+
// Given
129+
let target = Target.test(destinations: .macOS, product: .macro)
130+
131+
// When
132+
let got = target.supportsResources
133+
134+
// Then
135+
XCTAssertTrue(got)
136+
}
137+
138+
func test_supportsResources_returns_true_for_xpc_services() {
139+
// Given
140+
let target = Target.test(destinations: .macOS, product: .xpc)
141+
142+
// When
143+
let got = target.supportsResources
144+
145+
// Then
146+
XCTAssertTrue(got)
147+
}
148+
149+
func test_supportsResources_returns_false_for_static_libraries() {
150+
// Given
151+
let target = Target.test(product: .staticLibrary)
152+
153+
// When
154+
let got = target.supportsResources
155+
156+
// Then
157+
XCTAssertFalse(got)
158+
}
159+
160+
func test_supportsResources_returns_false_for_dynamic_libraries() {
161+
// Given
162+
let target = Target.test(product: .dynamicLibrary)
163+
164+
// When
165+
let got = target.supportsResources
166+
167+
// Then
168+
XCTAssertFalse(got)
169+
}
115170
}

0 commit comments

Comments
 (0)