SPM plugins actions vs. buildplugins

Another question popped up when trying to do a simple wrapper for SwiftLint.

If using a command plugin, there doesn't seem to be any reasonable easy way to get the output from SwiftLint into Xcode? The Diagnostics API expects single-entries being generated.

In contrast, if using a build tool plugin, any tool generating output (like e.g. flatc) will generate warnings in Xcode, but this is based on generating output which is being processed.

So what would the recommended approach be to implement e.g. SwiftLint as a plugin? A command plugin seems like the better fit as there's not reason to add SwiftLint as a Dependency - instead just as for e.g. the DocC plugin one can just pull it in once and have it available. But how to get the warnings/errors propagated? I mean reading and parsing the output to then re-generate Diagnostics seems a bit overkill.

Am I missing something here?

1 Like