func createBuildCommands()

in Plugins/SwiftBuffetPlugin/Plugin.swift [35:52]


    func createBuildCommands(context: XcodePluginContext, target: XcodeTarget) throws -> [Command] {
        var commands: [Command] = []

        for sourceFile in target.inputFiles {
            if sourceFile.path.extension == "proto" {
                let outputPath = context.pluginWorkDirectory.appending("\(sourceFile.path.stem).swift")
                commands.append(.buildCommand(
                    displayName: "Generating Swift code for \(sourceFile.path.lastComponent)",
                    executable: try context.tool(named: "SwiftBuffet").path,
                    arguments: [sourceFile.path.string, outputPath.string],
                    inputFiles: [sourceFile.path],
                    outputFiles: [outputPath]
                ))
            }
        }

        return commands
    }