配置要使用特定构建工具版本构建的 Xcode 项目
Configuring Xcode project to be built with specific build tools version
在我的构建系统中,我使用 xcodebuild
构建多个项目。
我想为每个项目配置不同的 Xcode 安装。
我知道 sudo xcode-select --switch <path>
,但是:
- 这个选项是系统范围的,可能会与其他并行
构建。
- 它需要 root,我宁愿避免它(因为它是一个自动构建系统)。
- 项目内部没有配置。
有没有办法指定每个项目要使用的构建工具路径?
您可能可以直接从 Applications/Xcode.app/Contents/Developer/usr/bin
启动 xcodebuild
,因此修改路径您将使用不同的 Xcode 版本。
来自xcrun
的输出:
The active developer directory can be set using xcode-select
, or via the DEVELOPER_DIR environment variable. See the xcrun and xcode-select manual
pages for more information.
例如运行 xcodebuild 使用特定的 Xcode 安装:
$ DEVELOPER_DIR=/path/to/my/Xcode.app/Contents/Developer xcodebuild
在 bash 脚本中:
export DEVELOPER_DIR=/path/to/my/Xcode.app/Contents/Developer
xcodebuild
在我的构建系统中,我使用 xcodebuild
构建多个项目。
我想为每个项目配置不同的 Xcode 安装。
我知道 sudo xcode-select --switch <path>
,但是:
- 这个选项是系统范围的,可能会与其他并行 构建。
- 它需要 root,我宁愿避免它(因为它是一个自动构建系统)。
- 项目内部没有配置。
有没有办法指定每个项目要使用的构建工具路径?
您可能可以直接从 Applications/Xcode.app/Contents/Developer/usr/bin
启动 xcodebuild
,因此修改路径您将使用不同的 Xcode 版本。
来自xcrun
的输出:
The active developer directory can be set using
xcode-select
, or via the DEVELOPER_DIR environment variable. See the xcrun and xcode-select manual pages for more information.
例如运行 xcodebuild 使用特定的 Xcode 安装:
$ DEVELOPER_DIR=/path/to/my/Xcode.app/Contents/Developer xcodebuild
在 bash 脚本中:
export DEVELOPER_DIR=/path/to/my/Xcode.app/Contents/Developer
xcodebuild