File tree Expand file tree Collapse file tree 1 file changed +7
-12
lines changed Expand file tree Collapse file tree 1 file changed +7
-12
lines changed Original file line number Diff line number Diff line change @@ -80,21 +80,16 @@ extension Package {
80
80
81
81
let cSources = walked. filter { isValidSource ( $0, validExtensions: Sources . validCExtensions) }
82
82
let swiftSources = walked. filter { isValidSource ( $0, validExtensions: Sources . validSwiftExtensions) }
83
-
84
- guard cSources. count > 0 || swiftSources. count > 0 else { throw Module . Error. NoSources ( path) }
85
- guard !( cSources. count > 0 && swiftSources. count > 0 ) else { throw Module . Error. MixedSources ( path) }
86
83
87
- let isSwiftModule = swiftSources . count > 0 //We've already made sure that it'll can be only either of the two.
88
- let sources = Sources ( paths : isSwiftModule ? swiftSources : cSources , root : path)
89
-
90
- if isSwiftModule {
91
- return SwiftModule ( name: name, sources: sources )
84
+ if !cSources . isEmpty {
85
+ guard swiftSources. isEmpty else { throw Module . Error . MixedSources ( path) }
86
+ //FIXME: Support executables for C languages
87
+ guard !cSources . contains ( { $0 . hasSuffix ( " main.c " ) } ) else { throw Module . Error . CExecutableNotSupportedYet ( path ) }
88
+ return ClangModule ( name: name, sources: Sources ( paths : cSources , root : path ) )
92
89
}
93
90
94
- //FIXME: Support executables for C languages
95
- guard !cSources. contains ( { $0. hasSuffix ( " main.c " ) } ) else { throw Module . Error. CExecutableNotSupportedYet ( path) }
96
-
97
- return ClangModule ( name: name, sources: sources)
91
+ guard !swiftSources. isEmpty else { throw Module . Error. NoSources ( path) }
92
+ return SwiftModule ( name: name, sources: Sources ( paths: swiftSources, root: path) )
98
93
}
99
94
100
95
func isValidSource( path: String ) -> Bool {
You can’t perform that action at this time.
0 commit comments