@@ -384,12 +384,12 @@ class SourceGenerator {
384384 }
385385
386386 /// Checks whether the path is not in any default or TargetSource excludes
387- func isIncludedPath( _ path: Path , excludePaths: Set < Path > , includePaths: SortedArray < Path > ) -> Bool {
387+ func isIncludedPath( _ path: Path , excludePaths: Set < Path > , includePaths: SortedArray < Path > ? ) -> Bool {
388388 return !defaultExcludedFiles. contains ( where: { path. lastComponent == $0 } )
389389 && !( path. extension. map ( defaultExcludedExtensions. contains) ?? false )
390390 && !excludePaths. contains ( path)
391391 // If includes is empty, it's included. If it's not empty, the path either needs to match exactly, or it needs to be a direct parent of an included path.
392- && ( includePaths. value . isEmpty || _isIncludedPathSorted ( path, sortedPaths: includePaths ) )
392+ && ( includePaths. flatMap { _isIncludedPathSorted ( path, sortedPaths: $0 ) } ?? true )
393393 }
394394
395395 private func _isIncludedPathSorted( _ path: Path , sortedPaths: SortedArray < Path > ) -> Bool {
@@ -400,7 +400,7 @@ class SourceGenerator {
400400
401401
402402 /// Gets all the children paths that aren't excluded
403- private func getSourceChildren( targetSource: TargetSource , dirPath: Path , excludePaths: Set < Path > , includePaths: SortedArray < Path > ) throws -> [ Path ] {
403+ private func getSourceChildren( targetSource: TargetSource , dirPath: Path , excludePaths: Set < Path > , includePaths: SortedArray < Path > ? ) throws -> [ Path ] {
404404 try dirPath. children ( )
405405 . filter {
406406 if $0. isDirectory {
@@ -429,7 +429,7 @@ class SourceGenerator {
429429 isBaseGroup: Bool ,
430430 hasCustomParent: Bool ,
431431 excludePaths: Set < Path > ,
432- includePaths: SortedArray < Path > ,
432+ includePaths: SortedArray < Path > ? ,
433433 buildPhases: [ Path : BuildPhaseSpec ]
434434 ) throws -> ( sourceFiles: [ SourceFile ] , groups: [ PBXGroup ] ) {
435435
@@ -586,7 +586,7 @@ class SourceGenerator {
586586 let path = project. basePath + targetSource. path
587587 let excludePaths = getSourceMatches ( targetSource: targetSource, patterns: targetSource. excludes)
588588 // generate included paths. Excluded paths will override this.
589- let includePaths = getSourceMatches ( targetSource: targetSource, patterns: targetSource. includes)
589+ let includePaths = targetSource . includes . isEmpty ? nil : getSourceMatches ( targetSource: targetSource, patterns: targetSource. includes)
590590
591591 let type = resolvedTargetSourceType ( for: targetSource, at: path)
592592
@@ -655,7 +655,7 @@ class SourceGenerator {
655655 isBaseGroup: true ,
656656 hasCustomParent: hasCustomParent,
657657 excludePaths: excludePaths,
658- includePaths: SortedArray ( includePaths ) ,
658+ includePaths: includePaths . flatMap ( SortedArray . init ( _ : ) ) ,
659659 buildPhases: buildPhases
660660 )
661661
0 commit comments