From fca6cfba49a6f75917c2b8b0143263a7dea2d46b Mon Sep 17 00:00:00 2001 From: Brentley Jones Date: Wed, 3 Apr 2024 10:27:46 -0500 Subject: [PATCH] =?UTF-8?q?Add=20deprecation=20notice=20to=20`build=5Fmode?= =?UTF-8?q?=20=3D=20"xcode=E2=80=9D`=20docs=20(#2989)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Brentley Jones --- docs/bazel.md | 2 +- xcodeproj/internal/xcodeproj_macro.bzl | 30 +++++++++++++++++++------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/docs/bazel.md b/docs/bazel.md index 2438f03da6..f56710fb7e 100755 --- a/docs/bazel.md +++ b/docs/bazel.md @@ -101,7 +101,7 @@ xcodeproj( | associated_extra_files | Optional. A `dict` of files to be added to the project.

The key is a `string` value representing the label of the target the files should be associated with, and the value is a `list` of `File`s. These files won't be added to the project if the target is unfocused. | `{}` | | bazel_path | Optional. The path the `bazel` binary or wrapper script.

If the path is relative it will be resolved using the `PATH` environment variable that is set when generating the project. If you want to specify a path to a workspace-relative binary, you must prepend the path with `./` (e.g. `"./bazelw"`). | `"bazel"` | | bazel_env | Optional. A `dict` of environment variables to set when invoking `bazel_path`.

This is useful for setting environment variables that are required for Bazel actions to run successfully, such as `JAVA_HOME` or `ANDROID_HOME`. It's also useful if `bazel_path` itself (if it's a wrapper) needs certain environment variables.

The keys are the names of the environment variables, and the values are the values of the environment variables. If a value is `None`, the environment variable will be resolved from the current environment as the project is generated. If a value references environment variables, those will be resolved from the current environment as the project is generated. If you want to use a literal `$` in a value, you must escape it with two backslashes.

If project generation succeeds, but building inside of Xcode fails because of missing environment variables, you probably have to set them here.

If `PATH` is not specified, it will default to `/bin:/usr/bin`, so you don't have to specify it unless you want to use a different value. | `{"PATH": "/bin:/usr/bin"}` | -| build_mode | Optional. The build mode the generated project should use.

If this is set to `"xcode"`, the project will use the Xcode build system to build targets. Generated files and unfocused targets (see the `focused_targets` and `unfocused_targets` arguments) will be built with Bazel.

If this is set to `"bazel"`, the project will use Bazel to build targets, inside of Xcode. The Xcode build system still unavoidably orchestrates some things at a high level. | `"bazel"` | +| build_mode | Optional. The build mode the generated project should use.

| `"bazel"` | | config | Optional. The Bazel config to use when generating the project or invoking `bazel` inside of Xcode.

This is the basename of multiple configs. For example, if this is set to `"projectx_xcodeproj"`, then the following configs will be available for you to adjust in your `.bazelrc` file:



See the [usage guide](usage.md#bazel-configs) for more information on adjusting Bazel configs. | `"rules_xcodeproj"` | | default_xcode_configuration | Optional. The name of the the Xcode configuration to use when building, if not overridden by custom schemes.

If not set, the first Xcode configuration alphabetically will be used. Use [`xcode_configurations`](#xcodeproj-xcode_configurations) to adjust Xcode configurations. | `None` | | extra_files | Optional. A `list` of extra `File`s to be added to the project. | `[]` | diff --git a/xcodeproj/internal/xcodeproj_macro.bzl b/xcodeproj/internal/xcodeproj_macro.bzl index dab23c1b87..c48480ded3 100644 --- a/xcodeproj/internal/xcodeproj_macro.bzl +++ b/xcodeproj/internal/xcodeproj_macro.bzl @@ -121,14 +121,28 @@ def xcodeproj( prepend the path with `./` (e.g. `"./bazelw"`). build_mode: Optional. The build mode the generated project should use. - If this is set to `"xcode"`, the project will use the Xcode build - system to build targets. Generated files and unfocused targets (see - the `focused_targets` and `unfocused_targets` arguments) will be - built with Bazel. - - If this is set to `"bazel"`, the project will use Bazel to build - targets, inside of Xcode. The Xcode build system still unavoidably - orchestrates some things at a high level. + config: Optional. The Bazel config to use when generating the project or invoking `bazel` inside of Xcode.