From 95f8896637f7cd2417007bacf5d209208656f01f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Pi=C3=B1era?= Date: Wed, 14 Jan 2026 15:57:59 +0100 Subject: [PATCH] fix: return true for supportsResources on commandLineTool, macro, and xpc Command line tools, macros, and XPC services can have resources embedded directly. When supportsResources returned false for these product types, Tuist's ResourcesProjectMapper would try to create a separate bundle target for them, which fails because these products cannot depend on bundles. This change makes supportsResources return true for commandLineTool, macro, and xpc, so resources are added directly to these targets instead of creating an invalid bundle dependency. --- Sources/XcodeGraph/Models/Target.swift | 12 ++-- .../XcodeGraphTests/Models/TargetTests.swift | 55 +++++++++++++++++++ 2 files changed, 61 insertions(+), 6 deletions(-) diff --git a/Sources/XcodeGraph/Models/Target.swift b/Sources/XcodeGraph/Models/Target.swift index 0d635e54..bdabad06 100644 --- a/Sources/XcodeGraph/Models/Target.swift +++ b/Sources/XcodeGraph/Models/Target.swift @@ -253,14 +253,14 @@ public struct Target: Equatable, Hashable, Comparable, Codable, Sendable { .stickerPackExtension, .appClip, .systemExtension, - .extensionKitExtension: - return true - - case .commandLineTool, + .extensionKitExtension, + .commandLineTool, .macro, - .dynamicLibrary, - .staticLibrary, .xpc: + return true + + case .dynamicLibrary, + .staticLibrary: return false } } diff --git a/Tests/XcodeGraphTests/Models/TargetTests.swift b/Tests/XcodeGraphTests/Models/TargetTests.swift index e1ea8f49..9c5cedcb 100644 --- a/Tests/XcodeGraphTests/Models/TargetTests.swift +++ b/Tests/XcodeGraphTests/Models/TargetTests.swift @@ -112,4 +112,59 @@ final class TargetTests: XCTestCase { // Then XCTAssertTrue(got) } + + func test_supportsResources_returns_true_for_command_line_tools() { + // Given + let target = Target.test(destinations: .macOS, product: .commandLineTool) + + // When + let got = target.supportsResources + + // Then + XCTAssertTrue(got) + } + + func test_supportsResources_returns_true_for_macros() { + // Given + let target = Target.test(destinations: .macOS, product: .macro) + + // When + let got = target.supportsResources + + // Then + XCTAssertTrue(got) + } + + func test_supportsResources_returns_true_for_xpc_services() { + // Given + let target = Target.test(destinations: .macOS, product: .xpc) + + // When + let got = target.supportsResources + + // Then + XCTAssertTrue(got) + } + + func test_supportsResources_returns_false_for_static_libraries() { + // Given + let target = Target.test(product: .staticLibrary) + + // When + let got = target.supportsResources + + // Then + XCTAssertFalse(got) + } + + func test_supportsResources_returns_false_for_dynamic_libraries() { + // Given + let target = Target.test(product: .dynamicLibrary) + + // When + let got = target.supportsResources + + // Then + XCTAssertFalse(got) + } }