XCTest: running tests fails with Cycle inside X; building could produce unreliable results in project with CocoaPods and Carthage

こ雲淡風輕ζ 提交于 2020-12-13 03:39:56

问题


After upgrading my project to Xcode 12, the test suite stopped working. The tests target doesn't compile, fails with:

Cycle inside <redacted>Tests; building could produce unreliable results. This usually can be resolved by moving the shell script phase '[CP] Embed Pods Frameworks' so that it runs before the build phase that depends on its outputs.
Cycle details:
→ Target '<redacted>Tests' has copy command from '/Applications/Xcode12.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/XCTAutomationSupport.framework' to '<redacted>/Library/Developer/Xcode/DerivedData/<redacted>-bxjgdjscysiavpfrzmquaqdkncsl/Build/Products/Debug-iphonesimulator/<redacted>.app/Frameworks/XCTAutomationSupport.framework'
○ Target '<redacted>Tests': CodeSign <redacted>/Library/Developer/Xcode/DerivedData/<redacted>-bxjgdjscysiavpfrzmquaqdkncsl/Build/Products/Debug-iphonesimulator/<redacted>.app/PlugIns/<redacted>Tests.xctest/Frameworks/CryptoSwift.framework
○ That command depends on command in Target '<redacted>Tests': script phase “[CP] Embed Pods Frameworks”

The script is the last build phase in the target so I'm a bit lost. Any clue? Thank you.


回答1:


I found my issue. The error is mentioning CodeSign and it is related with Frameworks/CryptoSwift.framework (this framework is linked using Carthage), so I guessed that it has nothing to do with CocoaPods but with the why that Carthage frameworks are included in the test bundle.

Just remove the "Code Sign On Copy" from the Carthage build phase.



来源:https://stackoverflow.com/questions/64556134/xctest-running-tests-fails-with-cycle-inside-x-building-could-produce-unreliab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!