XCTest:运行 测试在 X 内循环失败;在使用 CocoaPods 和 Carthage 的项目中构建可能会产生不可靠的结果

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

将我的项目升级到 Xcode 12 后,测试套件停止工作。测试目标不编译,失败:

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”

脚本是目标中的最后一个构建阶段,所以我有点迷路了。有什么线索吗?谢谢。

我找到了解决问题的方法。错误是提到 CodeSign 并且它与 Frameworks/CryptoSwift.framework 有关(这个框架是使用 Carthage 链接的),所以我猜它与 CocoaPods 无关,而是与 Carthage 框架包含在测试包。

只需从 Carthage 构建阶段删除“Code Sign On Copy”即可。