Skip to content

Commit 6a85ca0

Browse files
committed
Updated test fixtures and docs
Signed-off-by: longsview <[email protected]>
1 parent 6016fc9 commit 6a85ca0

File tree

2 files changed

+52
-6
lines changed

2 files changed

+52
-6
lines changed

docs/bazel.md

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,12 +240,36 @@ Defines a command-line argument.
240240
| <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` |
241241

242242

243+
<a id="xcschemes.autogeneration.test"></a>
244+
245+
## xcschemes.autogeneration.test
246+
247+
<pre>
248+
xcschemes.autogeneration.test(<a href="#xcschemes.autogeneration.test-options">options</a>)
249+
</pre>
250+
251+
Creates a value for the `test` argument of `xcschemes.autogeneration_config`.
252+
253+
**PARAMETERS**
254+
255+
256+
| Name | Description | Default Value |
257+
| :------------- | :------------- | :------------- |
258+
| <a id="xcschemes.autogeneration.test-options"></a>options | Test options for autogeneration.<br><br>Defaults to `None`. | `None` |
259+
260+
**RETURNS**
261+
262+
An opaque value for the
263+
[`test`](user-content-xcschemes.autogeneration_config-test)
264+
argument of `xcschemes.autogeneration_config`.
265+
266+
243267
<a id="xcschemes.autogeneration_config"></a>
244268

245269
## xcschemes.autogeneration_config
246270

247271
<pre>
248-
xcschemes.autogeneration_config(<a href="#xcschemes.autogeneration_config-scheme_name_exclude_patterns">scheme_name_exclude_patterns</a>)
272+
xcschemes.autogeneration_config(<a href="#xcschemes.autogeneration_config-scheme_name_exclude_patterns">scheme_name_exclude_patterns</a>, <a href="#xcschemes.autogeneration_config-test">test</a>)
249273
</pre>
250274

251275
Creates a value for the [`scheme_autogeneration_config`](xcodeproj-scheme_autogeneration_config) attribute of `xcodeproj`.
@@ -255,7 +279,8 @@ Creates a value for the [`scheme_autogeneration_config`](xcodeproj-scheme_autoge
255279

256280
| Name | Description | Default Value |
257281
| :------------- | :------------- | :------------- |
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` |
282+
| <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` |
283+
| <a id="xcschemes.autogeneration_config-test"></a>test | Options to use for the test action.<br><br>Example:<br><br>```starlark xcodeproj( ... scheme_autogeneration_config = xcschemes.autogeneration_config( test = xcschemes.autogeneration.test( options = xcschemes.test_options( app_language = "en", app_region = "US", ) ) ) ) | `None` |
259284

260285
**RETURNS**
261286

@@ -499,8 +524,8 @@ Defines a custom scheme.
499524
## xcschemes.test
500525

501526
<pre>
502-
xcschemes.test(<a href="#xcschemes.test-args">args</a>, <a href="#xcschemes.test-build_targets">build_targets</a>, <a href="#xcschemes.test-diagnostics">diagnostics</a>, <a href="#xcschemes.test-env">env</a>, <a href="#xcschemes.test-env_include_defaults">env_include_defaults</a>, <a href="#xcschemes.test-test_targets">test_targets</a>,
503-
<a href="#xcschemes.test-use_run_args_and_env">use_run_args_and_env</a>, <a href="#xcschemes.test-xcode_configuration">xcode_configuration</a>)
527+
xcschemes.test(<a href="#xcschemes.test-args">args</a>, <a href="#xcschemes.test-build_targets">build_targets</a>, <a href="#xcschemes.test-diagnostics">diagnostics</a>, <a href="#xcschemes.test-env">env</a>, <a href="#xcschemes.test-env_include_defaults">env_include_defaults</a>, <a href="#xcschemes.test-test_options">test_options</a>,
528+
<a href="#xcschemes.test-test_targets">test_targets</a>, <a href="#xcschemes.test-use_run_args_and_env">use_run_args_and_env</a>, <a href="#xcschemes.test-xcode_configuration">xcode_configuration</a>)
504529
</pre>
505530

506531
Defines the Test action.
@@ -515,11 +540,31 @@ Defines the Test action.
515540
| <a id="xcschemes.test-diagnostics"></a>diagnostics | The diagnostics to enable when testing.<br><br>Can be `None` or a value returned by [`xcschemes.diagnostics`](#xcschemes.diagnostics). If `None`, `xcschemes.diagnostics()` will be used, which means no diagnostics will be enabled. | `None` |
516541
| <a id="xcschemes.test-env"></a>env | Environment variables to use when testing.<br><br>If set to `"inherit"`, then the environment variables will be supplied by the test targets (e.g. [`ios_unit_test.env`](https://github.com/bazelbuild/rules_apple/blob/master/doc/rules-ios.md#ios_unit_test-env)), as long as every test target has the same environment variables. Otherwise, the `dict` of environment variables will be set as provided, and `None` or `{}` will result in no environment variables.<br><br>Each value of the `dict` can either be a string or a value returned by [`xcschemes.env_value`](#xcschemes.env_value). If a value is a string, it will be transformed into `xcschemes.env_value(value)`. For example, <pre><code>xcschemes.test(&#10; env = {&#10; "VAR1": "value 1",&#10; "VAR 2": xcschemes.env_value("value2", enabled = False),&#10; },&#10;)</code></pre> will be transformed into: <pre><code>xcschemes.test(&#10; env = {&#10; "VAR1": xcschemes.env_value("value 1"),&#10; "VAR 2": xcschemes.env_value("value2", enabled = False),&#10; },&#10;)</code></pre> | `"inherit"` |
517542
| <a id="xcschemes.test-env_include_defaults"></a>env_include_defaults | Whether to include the rules_xcodeproj provided default Bazel environment variables (e.g. `BUILD_WORKING_DIRECTORY` and `BUILD_WORKSPACE_DIRECTORY`), in addition to any set by [`env`](#xcschemes.test-env). | `True` |
543+
| <a id="xcschemes.test-test_options"></a>test_options | <p align="center"> - </p> | `None` |
518544
| <a id="xcschemes.test-test_targets"></a>test_targets | The test targets to build, and possibly run, when testing.<br><br>Each element of the `list` can be a label string or a value returned by [`xcschemes.test_target`](#xcschemes.test_target). If an element is a label string, it will be transformed into `xcschemes.test_target(label_str)`. For example, <pre><code>xcschemes.test(&#10; test_targets = [&#10; "//App:Test1",&#10; xcschemes.test_target(&#10; "//App:Test2",&#10; &hellip;&#10; ),&#10; ],&#10;)</code></pre> will be transformed into: <pre><code>xcschemes.test(&#10; test_targets = [&#10; xcschemes.test_target("//App:Test1"),&#10; xcschemes.test_target(&#10; "//App:Test2",&#10; &hellip;&#10; ),&#10; ],&#10;)</code></pre> | `[]` |
519545
| <a id="xcschemes.test-use_run_args_and_env"></a>use_run_args_and_env | Whether the `Use the Run action's arguments and environment variables` checkbox is checked.<br><br>If `True`, command-line arguments and environment variables will still be set as defined by [`args`](#xcschemes.test-args) and [`env`](#xcschemes.test-env), but will be ignored by Xcode unless you manually uncheck this checkbox in the scheme. If `None`, `True` will be used if [`args`](#xcschemes.test-args) and [`env`](#xcschemes.test-env) are both `"inherit"`, otherwise `False` will be used.<br><br>A value of `True` will be ignored (i.e. treated as `False`) if [`run.launch_target`](#xcschemes.run-launch_target) is not set to a target. | `None` |
520546
| <a id="xcschemes.test-xcode_configuration"></a>xcode_configuration | The name of the Xcode configuration to use to build the targets referenced in the Test action (i.e in the [`build_targets`](#xcschemes.test-build_targets) and [`test_targets`](#xcschemes.test-test_targets) attributes).<br><br>If not set, the value of [`xcodeproj.default_xcode_configuration`](#xcodeproj-default_xcode_configuration) is used. | `None` |
521547

522548

549+
<a id="xcschemes.test_options"></a>
550+
551+
## xcschemes.test_options
552+
553+
<pre>
554+
xcschemes.test_options(<a href="#xcschemes.test_options-app_language">app_language</a>, <a href="#xcschemes.test_options-app_region">app_region</a>)
555+
</pre>
556+
557+
Defines the test options for a custom scheme.
558+
559+
**PARAMETERS**
560+
561+
562+
| Name | Description | Default Value |
563+
| :------------- | :------------- | :------------- |
564+
| <a id="xcschemes.test_options-app_language"></a>app_language | Language to set in scheme.<br><br>Defaults to system settings if not set. | `None` |
565+
| <a id="xcschemes.test_options-app_region"></a>app_region | Region to set in scheme.<br><br>Defaults to system settings if not set. | `None` |
566+
567+
523568
<a id="xcschemes.test_target"></a>
524569

525570
## xcschemes.test_target
@@ -836,7 +881,7 @@ A `struct` representing an Xcode scheme.
836881

837882
<pre>
838883
xcode_schemes.test_action(<a href="#xcode_schemes.test_action-targets">targets</a>, <a href="#xcode_schemes.test_action-args">args</a>, <a href="#xcode_schemes.test_action-build_configuration">build_configuration</a>, <a href="#xcode_schemes.test_action-diagnostics">diagnostics</a>, <a href="#xcode_schemes.test_action-env">env</a>,
839-
<a href="#xcode_schemes.test_action-expand_variables_based_on">expand_variables_based_on</a>, <a href="#xcode_schemes.test_action-pre_actions">pre_actions</a>, <a href="#xcode_schemes.test_action-post_actions">post_actions</a>)
884+
<a href="#xcode_schemes.test_action-expand_variables_based_on">expand_variables_based_on</a>, <a href="#xcode_schemes.test_action-options">options</a>, <a href="#xcode_schemes.test_action-pre_actions">pre_actions</a>, <a href="#xcode_schemes.test_action-post_actions">post_actions</a>)
840885
</pre>
841886

842887
Constructs a test action for an Xcode scheme.
@@ -852,6 +897,7 @@ Constructs a test action for an Xcode scheme.
852897
| <a id="xcode_schemes.test_action-diagnostics"></a>diagnostics | Optional. A value returned by `xcode_schemes.diagnostics`. | `None` |
853898
| <a id="xcode_schemes.test_action-env"></a>env | Optional. A `dict` of `string` values that will be set as environment variables when the target is executed.<br><br>If both this and `args` are `None` (not just empty), then the launch action's environment variables will be inherited. | `None` |
854899
| <a id="xcode_schemes.test_action-expand_variables_based_on"></a>expand_variables_based_on | Optional. One of the specified test target labels.<br><br>If no value is provided, one of the test targets will be selected. If no expansion context is desired, use the `string` value `none`. | `None` |
900+
| <a id="xcode_schemes.test_action-options"></a>options | Optional. A value returned by `xcode_schemes.test_options`. | `None` |
855901
| <a id="xcode_schemes.test_action-pre_actions"></a>pre_actions | Optional. A `sequence` of `struct` values as created by `xcode_schemes.pre_post_action`. | `[]` |
856902
| <a id="xcode_schemes.test_action-post_actions"></a>post_actions | Optional. A `sequence` of `struct` values as created by `xcode_schemes.pre_post_action`. | `[]` |
857903

xcodeproj/internal/xcschemes/xcschemes.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1223,7 +1223,7 @@ def _autogeneration_test(*, options = None):
12231223
"""
12241224

12251225
return struct(
1226-
test_options = test_options,
1226+
test_options = options,
12271227
)
12281228

12291229
def _autogeneration_config(*, scheme_name_exclude_patterns = None, test = None):

0 commit comments

Comments
 (0)