【发布时间】:2022-06-17 16:16:14
【问题描述】:
我在使用 xcodebuild 命令时遇到了一些问题,希望看看是否有人遇到过类似的问题。
我正在使用 fastlane 扫描进行测试并让它创建代码覆盖,这将在 xcresult 文件中生成代码覆盖信息。在我将 xcargs 添加到组合之前,这一切都很好。
没有 xcargs,我可以在导出数据中的 Logs/Test 中的输出文件上运行 xcrun xccov view --report --json Run-Development-2022.06.09_13-05-00-+0200.xcresult,并获取 JSON 报告以供运行。
当我将 xcargs: "OTHER_SWIFT_FLAGS=\"$(inherited) -Xfrontend -debug-time-function-bodies\" SWIFT_OPTIMIZATION_LEVEL=\"-Owholemodule\"" 添加到 scan() 时,它只会将请求的参数添加到 xcodebuild 命令,但是当我运行上面的相同报告命令时,我在 JSON 文件中收到以下错误:
{
"code": 0,
"domain": "IDECoverageReportGenerationErrorDomain",
"localizedDescription": "Failed to generate coverage for target 'HeadlessUnitTests.xctest' at paths (\n \"\/Users...}\/HeadlessUnitTests.xctest\/HeadlessUnitTests\"\n):\nmalformed instrumentation profile data"
}
...
好像和xcargs的内容没什么关系,我试过去掉flags以及优化配置,但问题依旧。一起删除 xcargs 将再次起作用。
我的车道:
desc "Test: makes a clean build and runs all tests."
lane :test do
begin
scan(
workspace: WORKSPACE,
scheme: "Development",
configuration: "Debug",
clean: true,
devices: [DEVICE],
skip_detect_devices: true,
skip_slack: true,
code_coverage: true,
output_directory: './build/',
output_types: "junit",
buildlog_path: "#{ENV['GENERIC_FILE_STORAGE']}/build/logs",
xcargs: "OTHER_SWIFT_FLAGS=\"$(inherited) -Xfrontend -debug-time-function-bodies\" SWIFT_OPTIMIZATION_LEVEL=\"-Owholemodule\"")
rescue => ex
UI.user_error! ex
end
end
【问题讨论】:
标签: xcodebuild fastlane fastlane-scan