Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions apple/internal/rule_factory.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,6 @@ A file that will be used in lcov export calls to limit the scope of files instru
""",
allow_single_file = True,
),
"bundle_name": attr.string(
mandatory = False,
doc = """
The desired name of the bundle (without the extension). If this attribute is not set, then the name
of the target will be used instead.
""",
),
}

def _create_apple_rule(
Expand Down Expand Up @@ -170,6 +163,23 @@ def _create_apple_test_rule(*, doc, implementation, platform_type):
# The aspect is withheld to avoid unnecessary overhead in this instance of `test_host`, and
# the provider is unnecessarily generic to accomodate any possible value of `test_host`.
rule_attrs.test_host_attrs(aspects = [], providers = [[AppleBundleInfo]]),
# Add bundle attributes to make them visible in documentation
rule_attrs.infoplist_attrs(default_infoplist = "//apple/testing:DefaultTestBundlePlist"),
{
"bundle_name": attr.string(
mandatory = False,
doc = """
The desired name of the bundle (without the extension). If this attribute is not set, then the name
of the target will be used instead.
""",
),
"frameworks": attr.label_list(
providers = [[AppleBundleInfo]],
doc = """
A list of framework targets that this target depends on.
""",
),
},
]

return rule(
Expand Down
6 changes: 3 additions & 3 deletions apple/internal/testing/apple_test_assembler.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ _BUNDLE_ATTRS = {
"base_bundle_id",
"bundle_id",
"bundle_id_suffix",
"bundle_name",
"families",
"frameworks",
"infoplists",
"linkopts",
"provisioning_profile",
"resources",
Expand All @@ -43,7 +40,10 @@ _BUNDLE_ATTRS = {
_SHARED_TEST_BUNDLE_ATTRS = {
x: None
for x in [
"bundle_name",
"features",
"frameworks",
"infoplists",
"minimum_os_version",
"tags",
"test_host",
Expand Down
12 changes: 8 additions & 4 deletions doc/rules-ios.md
Original file line number Diff line number Diff line change
Expand Up @@ -591,8 +591,8 @@ Outputs:
<pre>
load("@rules_apple//apple:ios.doc.bzl", "ios_ui_test")

ios_ui_test(<a href="#ios_ui_test-name">name</a>, <a href="#ios_ui_test-deps">deps</a>, <a href="#ios_ui_test-data">data</a>, <a href="#ios_ui_test-bundle_name">bundle_name</a>, <a href="#ios_ui_test-collect_code_coverage">collect_code_coverage</a>, <a href="#ios_ui_test-env">env</a>, <a href="#ios_ui_test-env_inherit">env_inherit</a>,
<a href="#ios_ui_test-minimum_deployment_os_version">minimum_deployment_os_version</a>, <a href="#ios_ui_test-minimum_os_version">minimum_os_version</a>, <a href="#ios_ui_test-platform_type">platform_type</a>, <a href="#ios_ui_test-runner">runner</a>,
ios_ui_test(<a href="#ios_ui_test-name">name</a>, <a href="#ios_ui_test-deps">deps</a>, <a href="#ios_ui_test-data">data</a>, <a href="#ios_ui_test-bundle_name">bundle_name</a>, <a href="#ios_ui_test-collect_code_coverage">collect_code_coverage</a>, <a href="#ios_ui_test-env">env</a>, <a href="#ios_ui_test-env_inherit">env_inherit</a>, <a href="#ios_ui_test-frameworks">frameworks</a>,
<a href="#ios_ui_test-infoplists">infoplists</a>, <a href="#ios_ui_test-minimum_deployment_os_version">minimum_deployment_os_version</a>, <a href="#ios_ui_test-minimum_os_version">minimum_os_version</a>, <a href="#ios_ui_test-platform_type">platform_type</a>, <a href="#ios_ui_test-runner">runner</a>,
<a href="#ios_ui_test-test_coverage_manifest">test_coverage_manifest</a>, <a href="#ios_ui_test-test_filter">test_filter</a>, <a href="#ios_ui_test-test_host">test_host</a>, <a href="#ios_ui_test-test_host_is_bundle_loader">test_host_is_bundle_loader</a>)
</pre>

Expand Down Expand Up @@ -622,6 +622,8 @@ of the attributes inherited by all test rules, please check the
| <a id="ios_ui_test-collect_code_coverage"></a>collect_code_coverage | Whether to collect code coverage for this test if `--collect_code_coverage=yes`. | Boolean | optional | `True` |
| <a id="ios_ui_test-env"></a>env | Dictionary of environment variables that should be set during the test execution. The values of the dictionary are subject to "Make" variable expansion. | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | optional | `{}` |
| <a id="ios_ui_test-env_inherit"></a>env_inherit | List of environment variables to inherit from the external environment. | List of strings | optional | `[]` |
| <a id="ios_ui_test-frameworks"></a>frameworks | A list of framework targets that this target depends on. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | `[]` |
| <a id="ios_ui_test-infoplists"></a>infoplists | A list of .plist files that will be merged to form the Info.plist for this target. At least one file must be specified. Please see [Info.plist Handling](https://github.com/bazelbuild/rules_apple/blob/master/doc/common_info.md#infoplist-handling) for what is supported. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | `["@rules_apple//apple/testing:DefaultTestBundlePlist"]` |
| <a id="ios_ui_test-minimum_deployment_os_version"></a>minimum_deployment_os_version | A required string indicating the minimum deployment OS version supported by the target, represented as a dotted version number (for example, "9.0"). This is different from `minimum_os_version`, which is effective at compile time. Ensure version specific APIs are guarded with `available` clauses. | String | optional | `""` |
| <a id="ios_ui_test-minimum_os_version"></a>minimum_os_version | A required string indicating the minimum OS version supported by the target, represented as a dotted version number (for example, "9.0"). | String | required | |
| <a id="ios_ui_test-platform_type"></a>platform_type | - | String | optional | `"ios"` |
Expand All @@ -639,8 +641,8 @@ of the attributes inherited by all test rules, please check the
<pre>
load("@rules_apple//apple:ios.doc.bzl", "ios_unit_test")

ios_unit_test(<a href="#ios_unit_test-name">name</a>, <a href="#ios_unit_test-deps">deps</a>, <a href="#ios_unit_test-data">data</a>, <a href="#ios_unit_test-bundle_name">bundle_name</a>, <a href="#ios_unit_test-collect_code_coverage">collect_code_coverage</a>, <a href="#ios_unit_test-env">env</a>, <a href="#ios_unit_test-env_inherit">env_inherit</a>,
<a href="#ios_unit_test-minimum_deployment_os_version">minimum_deployment_os_version</a>, <a href="#ios_unit_test-minimum_os_version">minimum_os_version</a>, <a href="#ios_unit_test-platform_type">platform_type</a>, <a href="#ios_unit_test-runner">runner</a>,
ios_unit_test(<a href="#ios_unit_test-name">name</a>, <a href="#ios_unit_test-deps">deps</a>, <a href="#ios_unit_test-data">data</a>, <a href="#ios_unit_test-bundle_name">bundle_name</a>, <a href="#ios_unit_test-collect_code_coverage">collect_code_coverage</a>, <a href="#ios_unit_test-env">env</a>, <a href="#ios_unit_test-env_inherit">env_inherit</a>, <a href="#ios_unit_test-frameworks">frameworks</a>,
<a href="#ios_unit_test-infoplists">infoplists</a>, <a href="#ios_unit_test-minimum_deployment_os_version">minimum_deployment_os_version</a>, <a href="#ios_unit_test-minimum_os_version">minimum_os_version</a>, <a href="#ios_unit_test-platform_type">platform_type</a>, <a href="#ios_unit_test-runner">runner</a>,
<a href="#ios_unit_test-test_coverage_manifest">test_coverage_manifest</a>, <a href="#ios_unit_test-test_filter">test_filter</a>, <a href="#ios_unit_test-test_host">test_host</a>, <a href="#ios_unit_test-test_host_is_bundle_loader">test_host_is_bundle_loader</a>)
</pre>

Expand Down Expand Up @@ -676,6 +678,8 @@ of the attributes inherited by all test rules, please check the
| <a id="ios_unit_test-collect_code_coverage"></a>collect_code_coverage | Whether to collect code coverage for this test if `--collect_code_coverage=yes`. | Boolean | optional | `True` |
| <a id="ios_unit_test-env"></a>env | Dictionary of environment variables that should be set during the test execution. The values of the dictionary are subject to "Make" variable expansion. | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | optional | `{}` |
| <a id="ios_unit_test-env_inherit"></a>env_inherit | List of environment variables to inherit from the external environment. | List of strings | optional | `[]` |
| <a id="ios_unit_test-frameworks"></a>frameworks | A list of framework targets that this target depends on. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | `[]` |
| <a id="ios_unit_test-infoplists"></a>infoplists | A list of .plist files that will be merged to form the Info.plist for this target. At least one file must be specified. Please see [Info.plist Handling](https://github.com/bazelbuild/rules_apple/blob/master/doc/common_info.md#infoplist-handling) for what is supported. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | `["@rules_apple//apple/testing:DefaultTestBundlePlist"]` |
| <a id="ios_unit_test-minimum_deployment_os_version"></a>minimum_deployment_os_version | A required string indicating the minimum deployment OS version supported by the target, represented as a dotted version number (for example, "9.0"). This is different from `minimum_os_version`, which is effective at compile time. Ensure version specific APIs are guarded with `available` clauses. | String | optional | `""` |
| <a id="ios_unit_test-minimum_os_version"></a>minimum_os_version | A required string indicating the minimum OS version supported by the target, represented as a dotted version number (for example, "9.0"). | String | required | |
| <a id="ios_unit_test-platform_type"></a>platform_type | - | String | optional | `"ios"` |
Expand Down
12 changes: 8 additions & 4 deletions doc/rules-macos.md
Original file line number Diff line number Diff line change
Expand Up @@ -643,8 +643,8 @@ i.e. `--features=-swift.no_generated_header`).
<pre>
load("@rules_apple//apple:macos.doc.bzl", "macos_ui_test")

macos_ui_test(<a href="#macos_ui_test-name">name</a>, <a href="#macos_ui_test-deps">deps</a>, <a href="#macos_ui_test-data">data</a>, <a href="#macos_ui_test-bundle_name">bundle_name</a>, <a href="#macos_ui_test-collect_code_coverage">collect_code_coverage</a>, <a href="#macos_ui_test-env">env</a>, <a href="#macos_ui_test-env_inherit">env_inherit</a>,
<a href="#macos_ui_test-minimum_deployment_os_version">minimum_deployment_os_version</a>, <a href="#macos_ui_test-minimum_os_version">minimum_os_version</a>, <a href="#macos_ui_test-platform_type">platform_type</a>, <a href="#macos_ui_test-runner">runner</a>,
macos_ui_test(<a href="#macos_ui_test-name">name</a>, <a href="#macos_ui_test-deps">deps</a>, <a href="#macos_ui_test-data">data</a>, <a href="#macos_ui_test-bundle_name">bundle_name</a>, <a href="#macos_ui_test-collect_code_coverage">collect_code_coverage</a>, <a href="#macos_ui_test-env">env</a>, <a href="#macos_ui_test-env_inherit">env_inherit</a>, <a href="#macos_ui_test-frameworks">frameworks</a>,
<a href="#macos_ui_test-infoplists">infoplists</a>, <a href="#macos_ui_test-minimum_deployment_os_version">minimum_deployment_os_version</a>, <a href="#macos_ui_test-minimum_os_version">minimum_os_version</a>, <a href="#macos_ui_test-platform_type">platform_type</a>, <a href="#macos_ui_test-runner">runner</a>,
<a href="#macos_ui_test-test_coverage_manifest">test_coverage_manifest</a>, <a href="#macos_ui_test-test_filter">test_filter</a>, <a href="#macos_ui_test-test_host">test_host</a>, <a href="#macos_ui_test-test_host_is_bundle_loader">test_host_is_bundle_loader</a>)
</pre>

Expand All @@ -665,6 +665,8 @@ Note: macOS UI tests are not currently supported in the default test runner.
| <a id="macos_ui_test-collect_code_coverage"></a>collect_code_coverage | Whether to collect code coverage for this test if `--collect_code_coverage=yes`. | Boolean | optional | `True` |
| <a id="macos_ui_test-env"></a>env | Dictionary of environment variables that should be set during the test execution. The values of the dictionary are subject to "Make" variable expansion. | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | optional | `{}` |
| <a id="macos_ui_test-env_inherit"></a>env_inherit | List of environment variables to inherit from the external environment. | List of strings | optional | `[]` |
| <a id="macos_ui_test-frameworks"></a>frameworks | A list of framework targets that this target depends on. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | `[]` |
| <a id="macos_ui_test-infoplists"></a>infoplists | A list of .plist files that will be merged to form the Info.plist for this target. At least one file must be specified. Please see [Info.plist Handling](https://github.com/bazelbuild/rules_apple/blob/master/doc/common_info.md#infoplist-handling) for what is supported. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | `["@rules_apple//apple/testing:DefaultTestBundlePlist"]` |
| <a id="macos_ui_test-minimum_deployment_os_version"></a>minimum_deployment_os_version | A required string indicating the minimum deployment OS version supported by the target, represented as a dotted version number (for example, "9.0"). This is different from `minimum_os_version`, which is effective at compile time. Ensure version specific APIs are guarded with `available` clauses. | String | optional | `""` |
| <a id="macos_ui_test-minimum_os_version"></a>minimum_os_version | A required string indicating the minimum OS version supported by the target, represented as a dotted version number (for example, "9.0"). | String | required | |
| <a id="macos_ui_test-platform_type"></a>platform_type | - | String | optional | `"macos"` |
Expand All @@ -682,8 +684,8 @@ Note: macOS UI tests are not currently supported in the default test runner.
<pre>
load("@rules_apple//apple:macos.doc.bzl", "macos_unit_test")

macos_unit_test(<a href="#macos_unit_test-name">name</a>, <a href="#macos_unit_test-deps">deps</a>, <a href="#macos_unit_test-data">data</a>, <a href="#macos_unit_test-bundle_name">bundle_name</a>, <a href="#macos_unit_test-collect_code_coverage">collect_code_coverage</a>, <a href="#macos_unit_test-env">env</a>, <a href="#macos_unit_test-env_inherit">env_inherit</a>,
<a href="#macos_unit_test-minimum_deployment_os_version">minimum_deployment_os_version</a>, <a href="#macos_unit_test-minimum_os_version">minimum_os_version</a>, <a href="#macos_unit_test-platform_type">platform_type</a>, <a href="#macos_unit_test-runner">runner</a>,
macos_unit_test(<a href="#macos_unit_test-name">name</a>, <a href="#macos_unit_test-deps">deps</a>, <a href="#macos_unit_test-data">data</a>, <a href="#macos_unit_test-bundle_name">bundle_name</a>, <a href="#macos_unit_test-collect_code_coverage">collect_code_coverage</a>, <a href="#macos_unit_test-env">env</a>, <a href="#macos_unit_test-env_inherit">env_inherit</a>, <a href="#macos_unit_test-frameworks">frameworks</a>,
<a href="#macos_unit_test-infoplists">infoplists</a>, <a href="#macos_unit_test-minimum_deployment_os_version">minimum_deployment_os_version</a>, <a href="#macos_unit_test-minimum_os_version">minimum_os_version</a>, <a href="#macos_unit_test-platform_type">platform_type</a>, <a href="#macos_unit_test-runner">runner</a>,
<a href="#macos_unit_test-test_coverage_manifest">test_coverage_manifest</a>, <a href="#macos_unit_test-test_filter">test_filter</a>, <a href="#macos_unit_test-test_host">test_host</a>, <a href="#macos_unit_test-test_host_is_bundle_loader">test_host_is_bundle_loader</a>)
</pre>

Expand All @@ -710,6 +712,8 @@ find more information about testing for Apple platforms
| <a id="macos_unit_test-collect_code_coverage"></a>collect_code_coverage | Whether to collect code coverage for this test if `--collect_code_coverage=yes`. | Boolean | optional | `True` |
| <a id="macos_unit_test-env"></a>env | Dictionary of environment variables that should be set during the test execution. The values of the dictionary are subject to "Make" variable expansion. | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | optional | `{}` |
| <a id="macos_unit_test-env_inherit"></a>env_inherit | List of environment variables to inherit from the external environment. | List of strings | optional | `[]` |
| <a id="macos_unit_test-frameworks"></a>frameworks | A list of framework targets that this target depends on. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | `[]` |
| <a id="macos_unit_test-infoplists"></a>infoplists | A list of .plist files that will be merged to form the Info.plist for this target. At least one file must be specified. Please see [Info.plist Handling](https://github.com/bazelbuild/rules_apple/blob/master/doc/common_info.md#infoplist-handling) for what is supported. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | `["@rules_apple//apple/testing:DefaultTestBundlePlist"]` |
| <a id="macos_unit_test-minimum_deployment_os_version"></a>minimum_deployment_os_version | A required string indicating the minimum deployment OS version supported by the target, represented as a dotted version number (for example, "9.0"). This is different from `minimum_os_version`, which is effective at compile time. Ensure version specific APIs are guarded with `available` clauses. | String | optional | `""` |
| <a id="macos_unit_test-minimum_os_version"></a>minimum_os_version | A required string indicating the minimum OS version supported by the target, represented as a dotted version number (for example, "9.0"). | String | required | |
| <a id="macos_unit_test-platform_type"></a>platform_type | - | String | optional | `"macos"` |
Expand Down
Loading