New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SR-13739] 'Unexpected duplicate tasks' error when using Swift Package with bundle resources linked from a Unit Test Target #4486
Comments
Comment by Eric Yanush (JIRA) I also have an open feedback item for this issue (FB8751233). |
Comment by Marco Eidinger (JIRA) I upvoted because this issue affects test targets for all apps which import any Swift Package that is bundling resources. My team is building a Swift Package with swift-tools-version 5.3 to bundle resources. We would like to make use of swift snapshot-testing on a test target of an example app consuming our Swift Package. But this will not work because of issue SR-13739 Edit: I also created a feedback item for this issue (FB8891315) |
Comment by David Xu (JIRA) I will upvote this issue since my app hit the same problem. |
Comment by Bill Zhou (JIRA) Looking for solution here |
Comment by Eric Yanush (JIRA) I'd encourage anyone else encountering this issue to file a bug via Feedback Assistant; Apple has stated in the past that the more radars (now feedback assistant items) they receive for a given issue, the quicker it gains visibility at Apple. |
Upvoted and reported in Feedback Assistant as FB8893830. |
Comment by Angelo Di Paolo (JIRA) Seeing the a similar issue except I'm not seeing it in a test target. I'm seeing this when adding a binary dependency package to a static framework target. error: Unexpected duplicate tasks:
1) Target 'Scanner' (project 'Scanner') has copy command from '/Users/adipaol/Library/Developer/Xcode/DerivedData/App-fbbprhzekdwjqlglulryiasshtmd/SourcePackages/artifacts/DMSDK/DMSDK.xcframework/ios-i386_x86_64-simulator/DMSDK.framework' to '/Users/adipaol/Library/Developer/Xcode/DerivedData/App-fbbprhzekdwjqlglulryiasshtmd/Build/Products/Debug-iphonesimulator/Scanner.framework/Frameworks/DMSDK.framework'
2) Target 'Scanner' (project 'Scanner') has copy command from '/Users/adipaol/Library/Developer/Xcode/DerivedData/App-fbbprhzekdwjqlglulryiasshtmd/SourcePackages/artifacts/DMSDK/DMSDK.xcframework/ios-i386_x86_64-simulator/DMSDK.framework' to '/Users/adipaol/Library/Developer/Xcode/DerivedData/App-fbbprhzekdwjqlglulryiasshtmd/Build/Products/Debug-iphonesimulator/Scanner.framework/Frameworks/DMSDK.framework' |
Comment by Dirko Swanepoel (JIRA) Also getting this on the app target. Unexpected duplicate tasks:
1) Target '[REDACTED]' (project '[REDACTED]') has copy command from '/Users/[REDACTED]/Library/Developer/Xcode/DerivedData/[REDACTED]-exyzolodqlyjnvcxnmutwlnnsrry/SourcePackages/artifacts/GoogleMapsUtils/GoogleMapsUtils.xcframework/ios-arm64_i386_x86_64-simulator/GoogleMapsUtils.framework' to '/Users/[REDACTED]/Library/Developer/Xcode/DerivedData/[REDACTED]-exyzolodqlyjnvcxnmutwlnnsrry/Build/Products/Debug-iphonesimulator/[REDACTED].app/Frameworks/GoogleMapsUtils.framework'
2) Target '[REDACTED]' (project '[REDACTED]') has copy command from '/Users/[REDACTED]/Library/Developer/Xcode/DerivedData/[REDACTED]-exyzolodqlyjnvcxnmutwlnnsrry/SourcePackages/artifacts/GoogleMapsUtils/GoogleMapsUtils.xcframework/ios-arm64_i386_x86_64-simulator/GoogleMapsUtils.framework' to '/Users/[REDACTED]/Library/Developer/Xcode/DerivedData/[REDACTED]-exyzolodqlyjnvcxnmutwlnnsrry/Build/Products/Debug-iphonesimulator/[REDACTED].app/Frameworks/GoogleMapsUtils.framework' |
Comment by Simon-Pierre Roy (JIRA) I also get this and created a feedback entry. But I discovered that removing `allow testing host application apis` from the test target (need to remove all code needing `@testable import APP_NAME`) will remove the duplicate copy task! This is not a real solution, since you can not test symbols in that app module. |
Still occurs in Xcode 12.4. |
Still occurs in Xcode 12.5 Beta 1 & 2 |
Still reproduces in Xcode 12.5 Beta 3 |
Comment by Pär Gregersson (JIRA) The only workaround I have found is to remove the framework from linked libraries and manually add the Edit: And if you need to link a swift package framework manually, try adding |
Comment by Eric Yanush (JIRA) I can confirm that the workaround gregersson (JIRA User) posted does work! Now that it's been suggested, I feel a bit foolish not having tried manually linking framework built by SwiftPM to the test target before now. |
Comment by F H (JIRA) I can confirm that the workaround gregersson (JIRA User) posted also fixes the issue `error: Unexpected duplicate tasks: 1) Command: ProcessXCFramework` |
I'm attempting to put this workaround in and it's not working for me. Even in the attached sample app, if I remove `SomethingKit` from the linked libraries to `MyAppTests` and add `-framework SomethingKit` to the `MyAppTests` build settings, I still get the duplicate tasks error. This is on Xcode 12.4. What am I doing wrong here? |
I was not able to work around the problem by adding I was able to work around it by not linking (Note that the Host Application for |
Comment by Rogerio de Paula Assis (JIRA) Thanks @mayoff that was the only solution that would allow us to successfully build and run our unit test target! |
This is still reproducing with Xcode 12.5 RC (12E262) |
Comment by Dave Paul (JIRA) +1. Not working as of Xcode 12.5 RC This is a major blocker for us moving to SPM. I tried the workarounds listed above and managed to get the tests running, only to crash due to runtime dependency issues. |
Comment by Joseph Ross (JIRA) I'm seeing the same issue after upgrading to Xcode 12.5. The interesting twist in my case is that the tests pass when I run from the Xcode GUI, but fail when I run the tests from the command line. |
This does not appear to reproduce with the Xcode 13 Beta 1 build! (13A5154h) |
Comment by Tassio Moreira Marques (JIRA) I'm facing the same issue with Appboy_iOS_SDK_AppboyKit.bundle in Xcode 12.5 (12E262). |
Comment by Eric Yanush (JIRA) tassiomm (JIRA User) this was fixed in Xcode 13, try upgrading to Xcode 13 and re-compiling. |
Comment by Tassio Moreira Marques (JIRA) e.yanush (JIRA User) man, that sucks. My code is not really ready for XCode 13. I was hoping I didn't really need that lol |
Attachment: Download
Additional Detail from JIRA
md5: 5f0ef4b08bb215cba06309b7378264e9
Issue Description:
Xcode fails to builds a test target linked to a framework that imports a Swift Package
See attached sample project. The error occurs when building the Test target, there's no errors for the App target.
This is an issue in both Xcode 12.0.1 and Xcode 12.2 beta 3.
I've also filed it as a Xcode bug (FB8802612)
The text was updated successfully, but these errors were encountered: