File tree Expand file tree Collapse file tree 3 files changed +9
-6
lines changed
utils/swift-xcodegen/Sources/SwiftXcodeGen Expand file tree Collapse file tree 3 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -285,7 +285,7 @@ struct SwiftTargets {
285285
286286 func getTargets( below path: RelativePath ) -> [ SwiftTarget ] {
287287 targets. filter { target in
288- guard let parent = target. buildRule? . parentPath, parent. hasPrefix ( path)
288+ guard let parent = target. buildRule? . parentPath, parent. starts ( with : path)
289289 else {
290290 return false
291291 }
Original file line number Diff line number Diff line change @@ -154,8 +154,9 @@ fileprivate final class ProjectGenerator {
154154 guard let path else { return true }
155155
156156 // Not very efficient, but excludedPaths should be small in practice.
157- guard let excluded = spec. excludedPaths. first ( where: { path. hasPrefix ( $0. path) } )
158- else {
157+ guard let excluded = spec. excludedPaths. first (
158+ where: { path. starts ( with: $0. path) }
159+ ) else {
159160 return true
160161 }
161162 if let description, let reason = excluded. reason {
@@ -238,7 +239,9 @@ fileprivate final class ProjectGenerator {
238239 group ( for: repoRelativePath. appending ( parentPath) ) != nil else {
239240 // If this isn't a child of an explicitly added reference, something
240241 // has probably gone wrong.
241- if !spec. referencesToAdd. contains ( where: { parentPath. hasPrefix ( $0. path) } ) {
242+ if !spec. referencesToAdd. contains (
243+ where: { parentPath. starts ( with: $0. path) }
244+ ) {
242245 log. warning ( """
243246 Target ' \( name) ' at ' \( repoRelativePath. appending ( parentPath) ) ' is \
244247 nested in a folder reference; skipping. This is likely an xcodegen bug.
Original file line number Diff line number Diff line change @@ -78,8 +78,8 @@ public extension PathProtocol {
7878 return exts. contains ( where: { ext == $0. rawValue } )
7979 }
8080
81- func hasPrefix ( _ other: Self ) -> Bool {
82- rawPath . hasPrefix ( other. rawPath )
81+ func starts ( with other: Self ) -> Bool {
82+ self . storage . starts ( with : other. storage )
8383 }
8484
8585 var components : FilePath . ComponentView {
You can’t perform that action at this time.
0 commit comments