jpeg icon indicating copy to clipboard operation
jpeg copied to clipboard

`unit-test` product clashes with `swift-png`'s `unit-test` product (SwiftPM unhappy)

Open stackotter opened this issue 1 year ago • 2 comments

I'm building image loading into SwiftCrossUI which requires me to support a variety of different image formats. For PNG and JPEG I'm of course using your two awesome pure-swift libraries. However, I've had to fork jpeg and make a few changes in order to add both libraries to my Package.swift. Here's the error that SwiftPM spits out;

error: multiple packages ('jpeg' (from 'https://github.com/tayloraswift/jpeg'), 'swift-png' (from 'https://github.com/tayloraswift/swift-png')) declare products with a conflicting name: 'unit-test’; product names need to be unique across the package graph

The fix that I've done on my fork (which I'm happy to PR if it's the solution that you'd like to go with) was to remove all of the executable products and rename the underlying executable targets to the kebab case names that their corresponding products had originally. This doesn't change the behaviour of swift run (swift run unit-test still works as you'd expect), but it does of course require you to do swift build --target unit-test instead of swift build --product unit-test, which I don't see as much of an issue.

I've confirmed this issue with both Swift 5.9.2 and Swift 6.0.

stackotter avatar Sep 01 '24 09:09 stackotter

It'd make sense to apply your preferred fix to both jpeg and swift-png since it's kinda a symmetrical issue and could other existing projects of yours that follow the same pattern (I haven't checked but I assume that there's probably at least one other package of yours using this pattern)

stackotter avatar Sep 01 '24 09:09 stackotter

sounds good to me!

tayloraswift avatar Sep 02 '24 03:09 tayloraswift

these products were internalized in 2.0.0

tayloraswift avatar Nov 17 '24 21:11 tayloraswift