fastlanegym - 指定衍生数据路径,但仍然在 XCode 默认位置创建 DerivedData

sto*_*uwg 6 xcode xcodebuild fastlane

我在 CI 服务器上使用 fastlane 设置,我先调用“gym”,然后调用“scan”。这两个命令都将衍生数据路径:参数传递到自定义路径。但实际发生的情况是,一旦gym启动,标准的~/Library/Developer/XCode/DerivedData路径以及我传递给gym的自定义路径就会被写入。这会导致稍后尝试使用clear_衍生数据清除 DerivedData 中的工件,但仅清除两个 DerivedData 文件夹之一。如何让 xcodebuild/gym 不写入默认的 ~/Library/Developer/XCode/DerivedData 路径?

我确实注意到gym命令的输出看起来与scan不同,因为gym的xcodebuild命令似乎没有像我期望的那样包含-衍生数据参数。以下是gym 控制台日志的输出:

15:34:03 [15:34:03]: -----------------
15:34:03 [15:34:03]: --- Step: gym ---
15:34:03 [15:34:03]: -----------------
15:34:04 [15:34:04]: $ xcodebuild -list -project ./randomprojecthere.xcodeproj -configuration Enterprise
15:34:05 [15:34:05]: $ xcodebuild clean -showBuildSettings -scheme randomprojecthere\ \(Enterprise\) -project ./randomprojecthere.xcodeproj -configuration Enterprise
15:34:06 
15:34:06 +----------------------+---------------------------------------------------------------------------+
15:34:06 |                                      Summary for gym 2.17.0                                      |
15:34:06 +----------------------+---------------------------------------------------------------------------+
15:34:06 | scheme               | randomprojecthere (Enterprise)                                                   |
15:34:06 | clean                | true                                                                      |
15:34:06 | configuration        | Enterprise                                                                |
15:34:06 | export_method        | enterprise                                                                |
15:34:06 | silent               | true                                                                      |
15:34:06 | output_directory     | /Users/userhere/.jenkins/jobs/UnifiediPad-Validation/builds/85       |
15:34:06 | derived_data_path    | /Users/userhere/.jenkins/jobs/UnifiediPad-Validation/builds/85/De... |
15:34:06 | archive_path         | /Users/userhere/.jenkins/jobs/UnifiediPad-Validation/builds/85/Ar... |
15:34:06 | output_name          | randomprojecthere                                                     |
15:34:06 | project              | ./randomprojecthere.xcodeproj                                         |
15:34:06 | destination          | generic/platform=iOS                                                      |
15:34:06 | use_legacy_build_api | false                                                                     |
15:34:06 | buildlog_path        | ~/Library/Logs/gym                                                        |
15:34:06 | xcode_path           | /Applications/Xcode.app                                                   |
15:34:06 +----------------------+---------------------------------------------------------------------------+
15:34:06 
Run Code Online (Sandbox Code Playgroud)

在这里进行扫描:

15:34:52 [15:34:52]: $ xcodebuild -list -project ./randomprojecthere.xcodeproj -configuration Debug
15:34:52 [15:34:52]: $ xcodebuild clean -showBuildSettings -scheme randomprojecthere\ \(Enterprise\) -project ./randomprojecthere.xcodeproj -configuration Debug
15:34:53 [15:34:53]: $ xcodebuild -list -project ./randomprojecthere.xcodeproj -configuration Debug
15:34:54 [15:34:54]: $ xcodebuild clean -showBuildSettings -scheme randomprojecthere\ \(Enterprise\) -project ./randomprojecthere.xcodeproj -configuration Debug
15:34:55 
15:34:55 +------------------------+-------------------------------------------------------------------------+
15:34:55 |                                     Summary for scan 2.17.0                                      |
15:34:55 +------------------------+-------------------------------------------------------------------------+
15:34:55 | device                 | iPad Air                                                                |
15:34:55 | scheme                 | randomprojecthere (Enterprise)                                                 |
15:34:55 | clean                  | false                                                                   |
15:34:55 | configuration          | Debug                                                                   |
15:34:55 | output_types           | junit                                                                   |
15:34:55 | output_directory       | /Users/userhere/.jenkins/workspace/UnifiediPad-Validation/test-... |
15:34:55 | derived_data_path      | /Users/userhere/.jenkins/jobs/UnifiediPad-Validation/builds/85/... |
15:34:55 | project                | ./randomprojecthere.xcodeproj                                       |
15:34:55 | skip_build             | false                                                                   |
15:34:55 | buildlog_path          | ~/Library/Logs/scan                                                     |
15:34:55 | include_simulator_logs | false                                                                   |
15:34:55 | open_report            | false                                                                   |
15:34:55 | skip_slack             | false                                                                   |
15:34:55 | slack_only_on_failure  | false                                                                   |
15:34:55 | use_clang_report_name  | false                                                                   |
15:34:55 | fail_build             | true                                                                    |
15:34:55 | xcode_path             | /Applications/Xcode.app                                                 |
15:34:55 +------------------------+-------------------------------------------------------------------------+
15:34:55 
15:34:55 [15:34:55]: $ set -o pipefail && env NSUnbufferedIO=YES xcodebuild -scheme randomprojecthere\ \(Enterprise\) -project ./randomprojecthere.xcodeproj -configuration Debug -destination 'platform=iOS Simulator,id=3EC3DEA8-6E4C-49E1-91B1-A7E57F44AE94' -derivedDataPath '/Users/userhere/.jenkins/jobs/UnifiediPad-Validation/builds/85/DerivedData' build test | tee '/Users/userhere/Library/Logs/scan/randomprojecthere-randomprojecthere (Enterprise).log' | xcpretty
Run Code Online (Sandbox Code Playgroud)

同样,这两个命令都传递了相同的导出数据路径自定义路径值:参数