@@ -177,39 +177,13 @@ struct GeneratorCommand: CommandPlugin {
177177
178178 let targetName = targetNames [ 0 ]
179179
180- var inputFiles : PackagePlugin . FileList ?
181- for target in context. xcodeProject. targets {
182- if target. product? . name == targetName {
183- Diagnostics . remark ( " Found target \( targetName) \n " )
184- inputFiles = target. inputFiles
185- }
186- }
187-
188- // This is some additional validation that the Xcode target has Swift source files.
189- // However, this appears to not work for all Xcode targets, so just print warnings
190- // and continue anyhow as the generator might still find source files (it looks based on the directory).
191- if inputFiles == nil {
192- // File list can be empty, but should never be nil
193- Diagnostics . warning ( " Target \( targetName) has no files, generator might fail \n " )
194- } else {
195- var swiftSourceFiles : [ String ] = [ ]
196- for inputFile in inputFiles! {
197- if inputFile. path. string. hasSuffix ( " .swift " ) {
198- swiftSourceFiles. append ( inputFile. path. string)
199- }
200- }
201-
202- if swiftSourceFiles. isEmpty {
203- // Just warn instead of error in case this is run on a target that has no Swift files
204- Diagnostics . warning (
205- " No Swift files found in Target \( targetName) , model might be empty \n " )
206- }
207- }
208-
209180 let targetPath = context. xcodeProject. directory
210181 let codeFilePath = buildEntityInfoFilePath ( targetName: targetName)
211182 let modelFilePath = buildModelJsonFilePath ( targetName: targetName)
212183
184+ // Note: not finding source files via context.xcodeProject.targets[0].inputFiles as for some projects not all
185+ // files appear to exist there (possibly related to "buildable folders"), just pass the target directory to
186+ // the generator and let it find source files.
213187 runGenerator (
214188 generator: tool, targetPath: targetPath, codeFilePath: codeFilePath,
215189 modelFilePath: modelFilePath)
0 commit comments