Skip to content

Commit 49d533d

Browse files
authored
Promote to public operation to compute PIF GUID for products (#9409)
### Motivation: Ensures external clients (e.g., Xcode) can reuse some PIF GUID operations implemented internally by SwiftPM. Without this patch, clients were instead duplicating the exact same code externally. ### Modifications: For now, this is a quick fix to ensure that we reuse this single function from SwiftBuildSupport/PackagePIFBuilder+Helpers.swift static func targetGUID( forProductName name: String, withId id: String, suffix: TargetSuffix? = nil ) -> GUID Related to rdar://165063807.
1 parent a5be296 commit 49d533d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Sources/SwiftBuildSupport/PackagePIFBuilder+Helpers.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ import enum SwiftBuild.ProjectModel
6161

6262
// MARK: - PIF GUID Helpers
6363

64-
enum TargetSuffix: String {
64+
public enum TargetSuffix: String {
6565
case testable, dynamic
6666

6767
func hasSuffix(id: GUID) -> Bool {
@@ -136,7 +136,7 @@ extension PackagePIFBuilder {
136136
///
137137
/// This format helps make sure that there is no collision with any other PIF targets,
138138
/// and in particular that a PIF target and a PIF product can have the same name (as they often do).
139-
static func targetGUID(forProductName name: String, withId id: String, suffix: TargetSuffix? = nil) -> GUID {
139+
public static func targetGUID(forProductName name: String, withId id: String, suffix: TargetSuffix? = nil) -> GUID {
140140
let suffixDescription: String = suffix.uniqueDescription(forName: name)
141141
return "PACKAGE-PRODUCT:\(id).\(name)\(suffixDescription)"
142142
}

Sources/SwiftBuildSupport/PackagePIFBuilder.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import struct SPMBuildCore.BuildParameters
3636

3737
import enum SwiftBuild.ProjectModel
3838

39-
typealias GUID = SwiftBuild.ProjectModel.GUID
39+
public typealias GUID = SwiftBuild.ProjectModel.GUID
4040
typealias BuildFile = SwiftBuild.ProjectModel.BuildFile
4141
typealias BuildConfig = SwiftBuild.ProjectModel.BuildConfig
4242
typealias BuildSettings = SwiftBuild.ProjectModel.BuildSettings

0 commit comments

Comments
 (0)