Use prebuildCommand for SwiftLint plugin (#4680)

This commit is contained in:
Roman Stetsenko 2023-02-02 18:25:25 +00:00 committed by GitHub
parent 325d0ee1e4
commit 843198d241
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 7 deletions

View File

@ -15,10 +15,12 @@ struct SwiftLintPlugin: BuildToolPlugin {
)
}
private func createBuildCommands(inputFiles: [Path],
packageDirectory: Path,
workingDirectory: Path,
tool: PluginContext.Tool) -> [Command] {
private func createBuildCommands(
inputFiles: [Path],
packageDirectory: Path,
workingDirectory: Path,
tool: PluginContext.Tool
) -> [Command] {
if inputFiles.isEmpty {
// Don't lint anything if there are no Swift source files in this target
return []
@ -37,13 +39,15 @@ struct SwiftLintPlugin: BuildToolPlugin {
}
arguments += inputFiles.map(\.string)
// We are not producing output files and this is needed only to not include cache files into bundle
let outputFilesDirectory = workingDirectory.appending("Output")
return [
.buildCommand(
.prebuildCommand(
displayName: "SwiftLint",
executable: tool.path,
arguments: arguments,
inputFiles: inputFiles,
outputFiles: [workingDirectory]
outputFilesDirectory: outputFilesDirectory
)
]
}