How to emit errors/warnings from build tool plugins for Xcode log

I started by creating a simple CLI tool to detect build settings in a project's pbxproj file using XcodeProj. I figured when it's called from a plugin it could take advantage of the same "Warning: some warning text" magic that works in build script phases.

I was apparently wrong.

It should be said I'm treating the .executableTarget (the pbxproj build settings detector) as a .buildCommand and not a .prebuildCommand so it can be built from source for what I may mistakenly believe to be simplicity. I set this paragraph apart because I just know it will come back to haunt me.

After quite an adventure wrapping this tool in an Xcode build tool plugin (it's now in the same package as the plugin), it's not treating the output as proper warnings in Xcode's build log. I discovered Diagnostics.warn("...") but I can't figure out how to get from "output of this executable target" to Diagnostics.warn()?

I thought maybe there was somewhere to hook into the execution of the tool and convert, but I can't seem to find documentation pertaining to this particular scenario.

Just how completely wrongly am I holding this thing?

Hmm. I’m not sure I’ve put this under the correct tags (or how to change them) or if I’ve not expressed myself well enough to invite help. Is there anything I can add or do differently?

It sounds as if you're holding it correctly. For warnings from the plug-in code itself, Diagnostics.error() or Diagnostics.warning() is indeed the way to do it.

And for the command that's being run, what you're doing should work. But it's possible that Xcode is looking specifically for "warning" (with a lower-case 'w') when it parses output from the tool, so that would be one thing to try. If that doesn't work then that definitely warrants a bug report.