I'm trying to get a basic build tool plugin working on Windows. I may be doing something wrong, but the nature of the problems is making me wonder if this feature works on Windows at all.
The first issue was that the resulting plugin exe fails to run because PackagePlugin.dll seems to be missing. I found it in the toolchain directory at
usr/lib/swift/pm/PluginAPI/PackagePlugin.dll -- perhaps it is being installed in the wrong place? (Same result for 5.6 and a recent 5.7 snapshot). After manually copying it, I got further.
But not much. At this point, every build attempt fails when it tries to invoke the plugin:
error: plugin process ended by an uncaught signal: 1033 <command: "C:\Users\eric\dev\swiftpm-buildtool-plugin-examples\Example 1 - SwiftGen\.build\plugins\cache\SwiftGenPlugin.exe">, <output: >
I am using the SwiftGen example from this repo as my starting point:
I've replaced the swiftgen binary with a Windows exe (at the moment, it's just a hello world), and updated the target triple in the
info.json file (to
x86_64-unknown-windows-msvc), but none of that seems to matter yet, as I don't think it's getting that far.
I've made quite a few attempts to modify the plugin itself to see if I can trigger any sort of different result. For example, intentionally putting errors in the code does cause a compilation failure, and when the code does compile, I can see the resulting plugin exe, so it's getting built. But no change to that code seems to make a difference when trying to run it. It apparently dies with an uncaught signal before it ever reaches the code in the plugin implementation.
I could go ahead and start trying to construct a bug report (for the apple/swift-package-manager repo on GitHub, I would assume), but I thought I would start with this forum message first. If there is a known case where a build tool plugin is working on Windows, I would like to compare against it and try to figure out what I might be doing wrong.