From 10b8c19f78958c90db5439d6addfecb36b8a68f2 Mon Sep 17 00:00:00 2001 From: Dave Inglis Date: Tue, 30 Sep 2025 09:52:38 -0400 Subject: [PATCH] Create a new product type so the PIF remains platform agnostic Closes https://github.com/swiftlang/swift-build/issues/610 --- .../SWBApplePlatform/Specs/DarwinProductTypes.xcspec | 11 +++++++++++ Sources/SWBGenericUnixPlatform/Specs/Unix.xcspec | 11 +++++++++++ Sources/SWBWindowsPlatform/Specs/Windows.xcspec | 11 +++++++++++ Sources/SwiftBuild/ProjectModel/Targets.swift | 1 + 4 files changed, 34 insertions(+) diff --git a/Sources/SWBApplePlatform/Specs/DarwinProductTypes.xcspec b/Sources/SWBApplePlatform/Specs/DarwinProductTypes.xcspec index d6e43e3f..f3d32158 100644 --- a/Sources/SWBApplePlatform/Specs/DarwinProductTypes.xcspec +++ b/Sources/SWBApplePlatform/Specs/DarwinProductTypes.xcspec @@ -474,4 +474,15 @@ com.apple.package-type.mach-o-executable ); }, + { + _Domain = darwin; + Type = ProductType; + Identifier = org.swift.product-type.common.object; + BasedOn = com.apple.product-type.objfile; + Class = XCStandaloneExecutableProductType; + Description = "Object File"; + IconNamePrefix = "TargetPlugin"; + DefaultTargetName = "Object File"; + }, + ) diff --git a/Sources/SWBGenericUnixPlatform/Specs/Unix.xcspec b/Sources/SWBGenericUnixPlatform/Specs/Unix.xcspec index 9960251c..446d925b 100644 --- a/Sources/SWBGenericUnixPlatform/Specs/Unix.xcspec +++ b/Sources/SWBGenericUnixPlatform/Specs/Unix.xcspec @@ -80,4 +80,15 @@ Identifier = com.apple.product-type.framework.static; BasedOn = com.apple.product-type.framework; }, + + { + Domain = generic-unix; + Type = ProductType; + Identifier = org.swift.product-type.common.object; + BasedOn = com.apple.product-type.objfile; + Class = XCStandaloneExecutableProductType; + Description = "Object File"; + IconNamePrefix = "TargetPlugin"; + DefaultTargetName = "Object File"; + }, ) diff --git a/Sources/SWBWindowsPlatform/Specs/Windows.xcspec b/Sources/SWBWindowsPlatform/Specs/Windows.xcspec index 9c58f4f4..f65f22ed 100644 --- a/Sources/SWBWindowsPlatform/Specs/Windows.xcspec +++ b/Sources/SWBWindowsPlatform/Specs/Windows.xcspec @@ -105,4 +105,15 @@ }, ); }, + { + Domain = windows; + Type = ProductType; + Identifier = org.swift.product-type.common.object; + BasedOn = org.swift.product-type.library.object; + Class = XCStandaloneExecutableProductType; + Name = "Object Library"; + Description = "Object library"; + IconNamePrefix = "TargetLibrary"; + DefaultTargetName = "Object Library"; + }, ) diff --git a/Sources/SwiftBuild/ProjectModel/Targets.swift b/Sources/SwiftBuild/ProjectModel/Targets.swift index efd4749c..e04e722a 100644 --- a/Sources/SwiftBuild/ProjectModel/Targets.swift +++ b/Sources/SwiftBuild/ProjectModel/Targets.swift @@ -310,6 +310,7 @@ extension ProjectModel { public enum ProductType: String, Sendable, Codable, CaseIterable { case application = "com.apple.product-type.application" case staticArchive = "com.apple.product-type.library.static" + case commonObject = "org.swift.product-type.common.object" case objectFile = "com.apple.product-type.objfile" case dynamicLibrary = "com.apple.product-type.library.dynamic" case framework = "com.apple.product-type.framework"