Skip to content

Commit

Permalink
Update Sources/XcodeProj/Objects/SwiftPackage/XCSwiftPackageProductDe…
Browse files Browse the repository at this point in the history
…pendency.swift


A more readable plugin definition

Co-authored-by: Kas <[email protected]>
  • Loading branch information
BarredEwe and kwridan authored Jul 14, 2023
1 parent a055d6b commit 371857a
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,14 @@ public class XCSwiftPackageProductDependency: PBXContainerItem, PlistSerializabl
let repository = decoder.context.objectReferenceRepository
let container = try decoder.container(keyedBy: CodingKeys.self)
let rawProductName = try container.decode(String.self, forKey: .productName)
productName = rawProductName.replacingOccurrences(of: "plugin:", with: "")
isPlugin = productName != rawProductName
let pluginPrefix = "plugin:"
if rawProductName.hasPrefix(pluginPrefix) {
productName = String(rawProductName.dropFirst(pluginPrefix.count))
isPlugin = true
} else {
productName = rawProductName
isPlugin = false
}

if let packageString: String = try container.decodeIfPresent(.package) {
packageReference = repository.getOrCreate(reference: packageString, objects: objects)
Expand Down

0 comments on commit 371857a

Please sign in to comment.