@@ -74,12 +74,10 @@ public func generate(
74
74
// Find non-source files in the source directories and root that should be added
75
75
// as a reference to the project.
76
76
var extraFiles = try findNonSourceFiles ( path: srcroot)
77
- if let sourcesExtraFiles = try ? findNonSourceFiles ( path: srcroot. appending ( component: " Sources " ) , recursively: true ) {
78
- extraFiles. append ( contentsOf: sourcesExtraFiles)
79
- }
80
- if let testsExtraFiles = try ? findNonSourceFiles ( path: srcroot. appending ( component: " Tests " ) , recursively: true ) {
81
- extraFiles. append ( contentsOf: testsExtraFiles)
82
- }
77
+ let sourcesExtraFiles = try findNonSourceFiles ( path: srcroot. appending ( component: " Sources " ) , recursively: true )
78
+ extraFiles. append ( contentsOf: sourcesExtraFiles)
79
+ let testsExtraFiles = try findNonSourceFiles ( path: srcroot. appending ( component: " Tests " ) , recursively: true )
80
+ extraFiles. append ( contentsOf: testsExtraFiles)
83
81
84
82
// Get the ignored files and exclude them
85
83
let ignoredFiles = try repositoryProvider. openCheckout ( at: srcroot) . getIgnoredFiles ( )
@@ -200,15 +198,17 @@ func findDirectoryReferences(path: AbsolutePath) throws -> [AbsolutePath] {
200
198
} )
201
199
}
202
200
203
- /// Finds the non-source files from `path` recursively
201
+ /// Finds the non-source files from `path`
202
+ /// - parameters:
203
+ /// - path: The path of the directory to get the files from
204
+ /// - recursively: Specifies if the directory at `path` should be searched recursively
204
205
func findNonSourceFiles( path: AbsolutePath , recursively: Bool = false ) throws -> [ AbsolutePath ] {
205
206
let filesFromPath = try walk ( path, recursively: recursively)
206
207
207
208
return filesFromPath. filter {
208
209
if !isFile( $0) { return false }
209
- if let `extension` = $0. extension {
210
- if SupportedLanguageExtension . cFamilyExtensions. contains ( `extension`) { return false }
211
- if SupportedLanguageExtension . swiftExtensions. contains ( `extension`) { return false }
210
+ if let `extension` = $0. extension, SupportedLanguageExtension . validExtensions. contains ( `extension`) {
211
+ return false
212
212
}
213
213
return true
214
214
}
0 commit comments