From f3b6192ed3b443804fe70c85be5dd837bd3aa3e0 Mon Sep 17 00:00:00 2001 From: Tony Allevato Date: Tue, 11 Oct 2022 10:46:45 -0700 Subject: [PATCH] Pass `SwiftFormatRules` sources as inputs to `generate-pipeline-plugin`. This will cause the plug-in to only rerun when the rules files change (without this, it was rerunning on every build). --- .../generate-pipeline-plugin/GeneratePipelinePlugin.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Plugins/generate-pipeline-plugin/GeneratePipelinePlugin.swift b/Plugins/generate-pipeline-plugin/GeneratePipelinePlugin.swift index d3c75f64e..457b79d27 100644 --- a/Plugins/generate-pipeline-plugin/GeneratePipelinePlugin.swift +++ b/Plugins/generate-pipeline-plugin/GeneratePipelinePlugin.swift @@ -49,6 +49,10 @@ struct GeneratePipelinePlugin: BuildToolPlugin { .appending("GeneratedSources") .appending(generatedSourceName) + let rulesSources = + (try context.package.targets(named: ["SwiftFormatRules"]).first as? SwiftSourceModuleTarget)? + .sourceFiles.map(\.path) ?? [] + return [ .buildCommand( displayName: "Generating \(generatedSourceName) for \(target.name)", @@ -61,6 +65,7 @@ struct GeneratePipelinePlugin: BuildToolPlugin { "--target", target.name, ], + inputFiles: rulesSources, outputFiles: [outputFile] ) ]