配置要使用特定构建工具版本构建的 Xcode 项目

Configuring Xcode project to be built with specific build tools version

在我的构建系统中,我使用 xcodebuild 构建多个项目。

我想为每个项目配置不同的 Xcode 安装。

我知道 sudo xcode-select --switch <path>,但是:

有没有办法指定每个项目要使用的构建工具路径?

您可能可以直接从 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