JamitLabs/Accio

Test target name conflict

jjorn opened this issue · 3 comments

jjorn commented

We have a test target i.e. named "Tests" in our project und define it like this:

targets: [
    .target(...),
    .testTarget(name: "Tests", dependencies: [SomeTestDependency], path: "Tests")
]

Then we import a framework via Accio. This framework contains a test target with the same name as we do:

targets: [
    .target(...),
    .testTarget(name: "Tests", dependencies: [TestDependencyA, TestDependencyB])
]

As a result, Accio does not work anymore:

✨  Generating dependency graph ...
❌  error: multiple targets named 'Tests' in: SomeTestDependency, MyProject

That's actually an issue with SwiftPM and the related discussion can be found here:
https://forums.swift.org/t/multiple-target-issue-with-spm/16696

I asked for further information there ...

Okay, this issue was clarified now on the thread:

  • Once SE-226 is implemented in SwiftPM, this issue will be resolved.
  • You can track progress of its implementation in SR-8658.

As far as I can see, this issue would even arise if we tried to manually remove any unnecessary targets from the manifest files of checked out projects (I didn't try though, so someone might try that). So I would say, this is something we can't fix without completely reimplementing dependency resolution ourselves, which is a non-goal of this project given SwiftPM already does it and improvements were already accepted by the community. Therefore I think we can close this.

If someone comes across this, please try one of the following workarounds:

  1. Fork the project which has the conflicting target name and remove it from the manifest there.
  2. Rename your conflicting target to prevent conflicts.

If anyone has an idea, how we could resolve this in Accio, feel free to comment and I'll reopen. Another way of speeding this up would to help implement SR-8658.

Ah, I think we could provide a link to this thread when someone comes across this issue like we did for #3. I'm reopnening this until such an output is implemented.