Skip to content

Commit 85f52b3

Browse files
authored
Merge branch 'MobileNativeFoundation:main' into pennig/calculate-output-groups
2 parents 8df9065 + 4b19da2 commit 85f52b3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1704
-607
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ the ruleset.
5757
- Cash App
5858
- Envoy Mobile
5959
- Ergatta
60+
- Faire Wholesale
6061
- Gojek
6162
- Lyft
6263
- [Mercari](https://engineering.mercari.com/en/blog/entry/20221215-16cdd59909/)
@@ -65,6 +66,7 @@ the ruleset.
6566
- [Slack](https://www.youtube.com/watch?v=wy3Q38VJ5uQ)
6667
- Snap
6768
- Spotify
69+
- Square
6870
- SwiftLint
6971
- Ten Ten
7072
- Tinder

buildbuddy.yaml

+4-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ x_templates:
2323
USE_BAZEL_VERSION: 7.x
2424
- &bazel_head
2525
env:
26-
USE_BAZEL_VERSION: last_green
26+
# See https://github.com/MobileNativeFoundation/rules_xcodeproj/pull/3029
27+
#
28+
# Temporary change to make CI pass until the fix is in `last_green`
29+
USE_BAZEL_VERSION: dd2464a5933e0a5a6765024573832717b71989bf
2730

2831
- &normal_resources
2932
resource_requests: { memory: 6GB }

docs/bazel.md

+29-3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ load("@rules_xcodeproj//xcodeproj:defs.bzl", "xcodeproj")
3333
- [`xcschemes.env_value`](#xcschemes.env_value)
3434
- [`xcschemes.pre_post_actions.build_script`](#xcschemes.pre_post_actions.build_script)
3535
- [`xcschemes.pre_post_actions.launch_script`](#xcschemes.pre_post_actions.launch_script)
36+
- [`xcschemes.autogeneration_config`](#xcschemes.autogeneration_config)
3637
- [Custom Xcode schemes (Legacy generation mode)](#custom-xcode-schemes-legacy-generation-mode)
3738
- [`xcode_schemes.scheme`](#xcode_schemes.scheme)
3839
- [`xcode_schemes.build_action`](#xcode_schemes.build_action)
@@ -60,9 +61,10 @@ load("@rules_xcodeproj//xcodeproj:defs.bzl", "xcodeproj")
6061
<pre>
6162
xcodeproj(<a href="#xcodeproj-name">name</a>, <a href="#xcodeproj-adjust_schemes_for_swiftui_previews">adjust_schemes_for_swiftui_previews</a>, <a href="#xcodeproj-associated_extra_files">associated_extra_files</a>, <a href="#xcodeproj-bazel_path">bazel_path</a>, <a href="#xcodeproj-bazel_env">bazel_env</a>,
6263
<a href="#xcodeproj-build_mode">build_mode</a>, <a href="#xcodeproj-config">config</a>, <a href="#xcodeproj-default_xcode_configuration">default_xcode_configuration</a>, <a href="#xcodeproj-extra_files">extra_files</a>,
63-
<a href="#xcodeproj-fail_for_invalid_extra_files_targets">fail_for_invalid_extra_files_targets</a>, <a href="#xcodeproj-focused_targets">focused_targets</a>, <a href="#xcodeproj-generation_mode">generation_mode</a>, <a href="#xcodeproj-install_directory">install_directory</a>,
64-
<a href="#xcodeproj-ios_device_cpus">ios_device_cpus</a>, <a href="#xcodeproj-ios_simulator_cpus">ios_simulator_cpus</a>, <a href="#xcodeproj-minimum_xcode_version">minimum_xcode_version</a>, <a href="#xcodeproj-post_build">post_build</a>, <a href="#xcodeproj-pre_build">pre_build</a>,
65-
<a href="#xcodeproj-project_name">project_name</a>, <a href="#xcodeproj-project_options">project_options</a>, <a href="#xcodeproj-scheme_autogeneration_mode">scheme_autogeneration_mode</a>, <a href="#xcodeproj-schemes">schemes</a>, <a href="#xcodeproj-target_name_mode">target_name_mode</a>,
64+
<a href="#xcodeproj-fail_for_invalid_extra_files_targets">fail_for_invalid_extra_files_targets</a>, <a href="#xcodeproj-focused_targets">focused_targets</a>, <a href="#xcodeproj-generation_mode">generation_mode</a>,
65+
<a href="#xcodeproj-import_index_build_indexstores">import_index_build_indexstores</a>, <a href="#xcodeproj-install_directory">install_directory</a>, <a href="#xcodeproj-ios_device_cpus">ios_device_cpus</a>, <a href="#xcodeproj-ios_simulator_cpus">ios_simulator_cpus</a>,
66+
<a href="#xcodeproj-minimum_xcode_version">minimum_xcode_version</a>, <a href="#xcodeproj-post_build">post_build</a>, <a href="#xcodeproj-pre_build">pre_build</a>, <a href="#xcodeproj-project_name">project_name</a>, <a href="#xcodeproj-project_options">project_options</a>,
67+
<a href="#xcodeproj-scheme_autogeneration_mode">scheme_autogeneration_mode</a>, <a href="#xcodeproj-scheme_autogeneration_config">scheme_autogeneration_config</a>, <a href="#xcodeproj-schemes">schemes</a>, <a href="#xcodeproj-target_name_mode">target_name_mode</a>,
6668
<a href="#xcodeproj-top_level_targets">top_level_targets</a>, <a href="#xcodeproj-tvos_device_cpus">tvos_device_cpus</a>, <a href="#xcodeproj-tvos_simulator_cpus">tvos_simulator_cpus</a>, <a href="#xcodeproj-unfocused_targets">unfocused_targets</a>,
6769
<a href="#xcodeproj-visionos_device_cpus">visionos_device_cpus</a>, <a href="#xcodeproj-visionos_simulator_cpus">visionos_simulator_cpus</a>, <a href="#xcodeproj-watchos_device_cpus">watchos_device_cpus</a>, <a href="#xcodeproj-watchos_simulator_cpus">watchos_simulator_cpus</a>,
6870
<a href="#xcodeproj-xcode_configurations">xcode_configurations</a>, <a href="#xcodeproj-xcschemes">xcschemes</a>, <a href="#xcodeproj-kwargs">kwargs</a>)
@@ -108,6 +110,7 @@ xcodeproj(
108110
| <a id="xcodeproj-fail_for_invalid_extra_files_targets"></a>fail_for_invalid_extra_files_targets | Optional. Determines wether, when processing targets, invalid extra files without labels will fail or just emit a warning. | `True` |
109111
| <a id="xcodeproj-focused_targets"></a>focused_targets | Optional. A `list` of target labels as `string` values.<br><br>If specified, only these targets will be included in the generated project; all other targets will be excluded, as if they were listed explicitly in the `unfocused_targets` argument. The labels must match transitive dependencies of the targets specified in the `top_level_targets` argument. | `[]` |
110112
| <a id="xcodeproj-generation_mode"></a>generation_mode | Optional. Determines how the project is generated.<br><br><ul> <li> `incremental`: The project is generated in pieces by multiple Bazel actions and then combined together. This allows for incremental generation where some of those pieces can be reused in subsequent project generations.<br><br> The way information is collected and processed has also changed compared to legacy generation mode. This has resulted in some bug fixes and improvements that don't exist in legacy generation mode.<br><br> **Note:** Only `build_mode = "bazel"` is supported in this mode.<br><br> **Note:** The [`xcschemes`](#xcodeproj-xcschemes) attribute is used instead of [`schemes`](#xcodeproj-schemes) in this mode. </li> <li> `legacy`: The project is generated by a monolith Bazel action.<br><br> This mode is deprecated and will be removed in a future version of **rules_xcodeproj**. </li> </ul> | `"incremental"` |
113+
| <a id="xcodeproj-import_index_build_indexstores"></a>import_index_build_indexstores | Optional. Whether to import the index stores generated by Index Build.<br><br>This is useful if you want to use the index stores generated by Index Build to speed up Xcode's indexing process. You may not want this enabled if the additional work (mainly disk IO) of importing the index stores is not worth it for your project.<br><br>This only applies when using `generation_mode = "incremental"`. | `True` |
111114
| <a id="xcodeproj-install_directory"></a>install_directory | Optional. The directory where the generated project will be written to.<br><br>The path is relative to the workspace root.<br><br>Defaults to the directory that the `xcodeproj` target is declared in (e.g. if the `xcodeproj` target is declared in `//foo/bar:BUILD` then the default value is `"foo/bar"`). Use `""` to have the project generated in the workspace root. | `None` |
112115
| <a id="xcodeproj-ios_device_cpus"></a>ios_device_cpus | Optional. The value to use for `--ios_multi_cpus` when building the transitive dependencies of the targets specified in the `top_level_targets` argument with the `"device"` `target_environment`.<br><br>**Warning:** Changing this value will affect the Starlark transition hash of all transitive dependencies of the targets specified in the `top_level_targets` argument with the `"device"` `target_environment`, even if they aren't iOS targets. | `"arm64"` |
113116
| <a id="xcodeproj-ios_simulator_cpus"></a>ios_simulator_cpus | Optional. The value to use for `--ios_multi_cpus` when building the transitive dependencies of the targets specified in the `top_level_targets` argument with the `"simulator"` `target_environment`.<br><br>If no value is specified, it defaults to the simulator cpu that goes with `--host_cpu` (i.e. `sim_arm64` on Apple Silicon and `x86_64` on Intel).<br><br>**Warning:** Changing this value will affect the Starlark transition hash of all transitive dependencies of the targets specified in the `top_level_targets` argument with the `"simulator"` `target_environment`, even if they aren't iOS targets. | `None` |
@@ -117,6 +120,7 @@ xcodeproj(
117120
| <a id="xcodeproj-project_name"></a>project_name | Optional. The name to use for the `.xcodeproj` file.<br><br>If not specified, the value of the `name` argument is used. | `None` |
118121
| <a id="xcodeproj-project_options"></a>project_options | Optional. A value returned by `project_options`. | `None` |
119122
| <a id="xcodeproj-scheme_autogeneration_mode"></a>scheme_autogeneration_mode | Optional. Specifies how Xcode schemes are automatically generated:<br><br><ul> <li> `auto`: If no custom schemes are specified, via `schemes`, an Xcode scheme will be created for every buildable target. If custom schemes are provided, no autogenerated schemes will be created. </li> <li> `none`: No schemes are automatically generated. </li> <li> `all`: A scheme is generated for every buildable target even if custom schemes are provided. </li> </ul> | `"auto"` |
123+
| <a id="xcodeproj-scheme_autogeneration_config"></a>scheme_autogeneration_config | Optional. A value returned by [`xcschemes.autogeneration_config`](#xcschemes.autogeneration_config).<br><br>Allows further configuration of `scheme_autogeneration_mode`. | `{}` |
120124
| <a id="xcodeproj-schemes"></a>schemes | Optional. A `list` of values returned by `xcode_schemes.scheme`.<br><br>This and the `scheme_autogeneration_mode` argument together customize how schemes for targets are generated, when using `generation_mode = "legacy"`.<br><br>Target labels listed in the schemes need to be from the transitive dependencies of the targets specified in the `top_level_targets` argument. | `[]` |
121125
| <a id="xcodeproj-target_name_mode"></a>target_name_mode | Optional. Specifies how Xcode targets names are represented:<br><br><ul> <li> `auto`: Use the product name if it is available and there is no collision. Otherwise select the target name from the label. And if there is a collision, use the full label. </li> <li> `label`: Always use full label for Xcode targets names. </li> </ul> | `"auto"` |
122126
| <a id="xcodeproj-top_level_targets"></a>top_level_targets | A `list` of a list of top-level targets.<br><br>Each target can be specified as either a `Label` (or label-like `string`), a value returned by `top_level_target`, or a value returned by `top_level_targets`. | none |
@@ -236,6 +240,28 @@ Defines a command-line argument.
236240
| <a id="xcschemes.arg-literal_string"></a>literal_string | Whether `value` should be interpreted as a literal string.<br><br>If `True`, any spaces will be escaped. This means that `value` will be passed to the launch target as a single string. If `False`, any spaces will not be escaped. This is useful to group multiple arguments under a single checkbox in Xcode. | `True` |
237241

238242

243+
<a id="xcschemes.autogeneration_config"></a>
244+
245+
## xcschemes.autogeneration_config
246+
247+
<pre>
248+
xcschemes.autogeneration_config(<a href="#xcschemes.autogeneration_config-scheme_name_exclude_patterns">scheme_name_exclude_patterns</a>)
249+
</pre>
250+
251+
Creates a value for the [`scheme_autogeneration_config`](xcodeproj-scheme_autogeneration_config) attribute of `xcodeproj`.
252+
253+
**PARAMETERS**
254+
255+
256+
| Name | Description | Default Value |
257+
| :------------- | :------------- | :------------- |
258+
| <a id="xcschemes.autogeneration_config-scheme_name_exclude_patterns"></a>scheme_name_exclude_patterns | A `list` of regex patterns used to skip creating matching autogenerated schemes.<br><br>Example:<br><br><pre><code class="language-starlark">xcodeproj(&#10; ...&#10; scheme_name_exclude_patterns = xcschemes.autogeneration_config(&#10; scheme_name_exclude_patterns = [&#10; ".*somePattern.*",&#10; "^AnotherPattern.*",&#10; ],&#10; )&#10;)</code></pre> | `None` |
259+
260+
**RETURNS**
261+
262+
An opaque value for the [`scheme_autogeneration_config`](xcodeproj-scheme_autogeneration_config) attribute of `xcodeproj`.
263+
264+
239265
<a id="xcschemes.diagnostics"></a>
240266

241267
## xcschemes.diagnostics

examples/integration/BUILD

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ load(
1010
"FAIL_FOR_INVALID_EXTRA_FILES_TARGETS",
1111
"PRE_BUILD",
1212
"PROJECT_OPTIONS",
13+
"SCHEME_AUTOGENERATION_CONFIG",
1314
"SCHEME_AUTOGENERATION_MODE",
1415
"UNFOCUSED_TARGETS",
1516
"XCODEPROJ_TARGETS",
@@ -68,6 +69,7 @@ string_flag(
6869
pre_build = PRE_BUILD,
6970
project_name = "Integration",
7071
project_options = PROJECT_OPTIONS,
72+
scheme_autogeneration_config = SCHEME_AUTOGENERATION_CONFIG,
7173
scheme_autogeneration_mode = SCHEME_AUTOGENERATION_MODE,
7274
schemes = get_xcode_schemes(),
7375
tags = ["manual"],
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
"""Targets meant to match scheme auto-generation exclude patterns"""
2+
3+
load(
4+
"@build_bazel_rules_swift//swift:swift.bzl",
5+
"swift_library",
6+
)
7+
8+
swift_library(
9+
name = "UndesiredScheme_Swift",
10+
srcs = ["UndesiredScheme.swift"],
11+
visibility = ["//iOSApp/Source:__pkg__"],
12+
)
13+
14+
swift_library(
15+
name = "UnwantedScheme_Swift",
16+
srcs = ["UnwantedScheme.swift"],
17+
visibility = ["//iOSApp/Source:__pkg__"],
18+
)

examples/integration/Lib/UndesiredSchemes/UndesiredScheme.swift

Whitespace-only changes.

examples/integration/Lib/UndesiredSchemes/UnwantedScheme.swift

Whitespace-only changes.

examples/integration/iOSApp/Source/BUILD

+2
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ swift_library(
142142
tags = ["manual"],
143143
visibility = ["//iOSApp/Test:__subpackages__"],
144144
deps = [
145+
"//Lib/UndesiredSchemes:UndesiredScheme_Swift",
146+
"//Lib/UndesiredSchemes:UnwantedScheme_Swift",
145147
"//UI",
146148
"//iOSApp/Source/CoreUtilsMixed/MixedAnswer",
147149
"//iOSApp/Source/CoreUtilsObjC",

0 commit comments

Comments
 (0)