XCTest:运行测试失败,并在X内循环; CocoaPods和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有关(此框架使用迦太基链接),因此我猜想它与CocoaPods没有关系,但与为什么迦太基框架包含在其中的原因有关。测试包。

只需从“迦太基”构建阶段中删除“代码登录副本”即可。

Carthage test bundle build phases