gmoraleda
(Guillermo Moraleda)
1
I created a build tool plugin to generate symbols from an asset catalog.
The plugin calls an executable target that generates a Colors.swift file.
The plugin works as expected.
My app target (the one that imports the package containing the plugin) has an iOS and a Watch App target, meaning the executable is called twice when compiling the app.
The error looks like this:
Multiple commands produce '/Users/g1intlv/Library/Developer/Xcode/DerivedData/Stage-asmtpprdyfhrcubtcapnpsvqjlkf/SourcePackages/plugins/stage.output/StageDesignSystem/GenerateColors/Colors.swift'
This is my plugin declaration:
.plugin(
name: "GenerateColors",
capability: .buildTool(),
dependencies: ["GenerateColorsExec"]
),
.executableTarget(
name: "GenerateColorsExec",
path: "Plugins/GenerateColorsExec"
),
Is this expected? A workaround could be to exclude the Watch App in the executable. Can I do that using some swift setting? I.e.
swiftSettings: [SwiftSetting]
I’ve had that problem twice so far without ever finding a workaround. I haven’t checked if it’s been fixed on Xcode 16.
There’s a couple open threads but the conclusion is mostly that SwiftPM won’t fix it because it only happens with Xcode.