I'm trying to use the new build tool support in Swift 5.6 for an iOS project. I have a package which defines an executable, a plugin which runs that executable to generate some swift sources, and a library that builds those sources and depends on the plugin:
This all works so long as I'm targeting macOS, but I want to consume this library from an iOS app built with Xcode. First, Xcode seems to build the tool twice, once for arm64 and once for x86_64?
Thanks a lot for the detailed bug report here. Would you mind filing a bug with Apple as well (referencing this thread for the details if you don't want to repeat them in the bug report)?
Running into the same issue as well, except since my build tool depends on swift-argument-parser, it fails to build since swift-argument-parser doesn’t build for iOS.
This seems like it’s fixed in Xcode 14 now, thanks to whoever for resolving this!
Fixed: Dependencies of package plugins always build for the host, regardless of what platform the client of the package the plugin is being applied to is building for. (91438186)
Xcode 14(b4) improves this situation: the tool is now built for the host, and runs correctly. However, Xcode still tries to build each tool for the target (eg. iPhone simulator) as well, which doesn't work if the tool has Mac-specific code.