自动将所有依赖项的代码覆盖率设置为 false 的解决方案是在终端上运行以下命令(请转到项目的目录):
grep -lR "codeCoverageEnabled" --include *.xcscheme --null Carthage | xargs -0 sed -i '' -e 's/codeCoverageEnabled = "YES"/codeCoverageEnabled = "NO"/g'
这会将代码覆盖率设置为“否”,并且 iTunes 连接不会抱怨。
使一切正常工作的顺序如下
- Run
carthage update --platform iOS --no-use-binaries --no-build
。这将更新并下载所有依赖项。
当Carthage开始编译时,可以按ctrl+c取消。
- 运行上述命令将代码覆盖率设置为NO
- 现在一切就绪,运行
carthage build --platform iOS
。这将构建代码覆盖率为 NO 的所有内容
您现在可以存档并上传到 iTC。
该命令是由https://github.com/gunterhager https://github.com/gunterhager,所以功劳归于他
作为替代方案快车道用户,将以下内容添加到您的 fastlane 文件中,这将使一切自动化:
desc "Update Carthage"
lane :update_carthage do
carthage(
command: "update", # One of: build, bootstrap, update, archive. (default: bootstrap)
use_binaries: false, # Check out dependency repositories even when prebuilt frameworks exist
no_build: true, # When bootstrapping Carthage do not build
platform: "iOS" # Define which platform to build for (one of ‘all’, ‘Mac’, ‘iOS’, ‘watchOS’, ‘tvOS‘, or comma-separated values of the formers except for ‘all’)
)
sh("grep -lR 'codeCoverageEnabled' --include *.xcscheme --null Carthage | xargs -0 sed -i '' -e 's/codeCoverageEnabled = 'YES'/codeCoverageEnabled = 'NO'/g'")
carthage(
command: "build", # One of: build, bootstrap, update, archive. (default: bootstrap)
platform: "iOS" # Define which platform to build for (one of ‘all’, ‘Mac’, ‘iOS’, ‘watchOS’, ‘tvOS‘, or comma-separated values of the formers except for ‘all’)
)
end