Skip to content

Commit 1b80aae

Browse files
authored
[7.x] Fix *_build_test rules with bazel 9.x (#2893)
This will be part of a point release just to do one last release that supports 7.x all the way to 9.x (cherry picked from commit 5d249ab)
1 parent e0eab89 commit 1b80aae

File tree

8 files changed

+244
-1
lines changed

8 files changed

+244
-1
lines changed

.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
rolling
1+
9.x

apple/internal/testing/build_test_rules.bzl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ number (for example, `"9.0"`).
121121
),
122122
},
123123
doc = doc,
124+
exec_groups = {
125+
"test": exec_group(),
126+
},
124127
implementation = _apple_build_test_rule_impl,
125128
test = True,
126129
cfg = transition_support.apple_rule_transition,

test/starlark_tests/BUILD

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ load(":generate_import_framework_tests.bzl", "generate_import_framework_test_sui
1818
load(":ios_app_clip_tests.bzl", "ios_app_clip_test_suite")
1919
load(":ios_application_resources_test.bzl", "ios_application_resources_test_suite")
2020
load(":ios_application_tests.bzl", "ios_application_test_suite")
21+
load(":ios_build_test_tests.bzl", "ios_build_test_test_suite")
2122
load(":ios_dynamic_framework_tests.bzl", "ios_dynamic_framework_test_suite")
2223
load(":ios_extension_tests.bzl", "ios_extension_test_suite")
2324
load(":ios_framework_tests.bzl", "ios_framework_test_suite")
@@ -29,6 +30,7 @@ load(":ios_ui_test_tests.bzl", "ios_ui_test_test_suite")
2930
load(":ios_unit_test_tests.bzl", "ios_unit_test_test_suite")
3031
load(":macos_application_resources_tests.bzl", "macos_application_resources_test_suite")
3132
load(":macos_application_tests.bzl", "macos_application_test_suite")
33+
load(":macos_build_test_tests.bzl", "macos_build_test_test_suite")
3234
load(":macos_bundle_tests.bzl", "macos_bundle_test_suite")
3335
load(":macos_command_line_application_tests.bzl", "macos_command_line_application_test_suite")
3436
load(":macos_dylib_tests.bzl", "macos_dylib_test_suite")
@@ -42,15 +44,18 @@ load(":macos_unit_test_tests.bzl", "macos_unit_test_test_suite")
4244
load(":order_file_tests.bzl", "order_file_test_suite")
4345
load(":tvos_application_swift_tests.bzl", "tvos_application_swift_test_suite")
4446
load(":tvos_application_tests.bzl", "tvos_application_test_suite")
47+
load(":tvos_build_test_tests.bzl", "tvos_build_test_test_suite")
4548
load(":tvos_dynamic_framework_tests.bzl", "tvos_dynamic_framework_test_suite")
4649
load(":tvos_extension_tests.bzl", "tvos_extension_test_suite")
4750
load(":tvos_framework_tests.bzl", "tvos_framework_test_suite")
4851
load(":tvos_static_framework_tests.bzl", "tvos_static_framework_test_suite")
4952
load(":tvos_ui_test_tests.bzl", "tvos_ui_test_test_suite")
5053
load(":tvos_unit_test_tests.bzl", "tvos_unit_test_test_suite")
5154
load(":visionos_application_tests.bzl", "visionos_application_test_suite")
55+
load(":visionos_build_test_tests.bzl", "visionos_build_test_test_suite")
5256
load(":watchos_application_swift_tests.bzl", "watchos_application_swift_test_suite")
5357
load(":watchos_application_tests.bzl", "watchos_application_test_suite")
58+
load(":watchos_build_test_tests.bzl", "watchos_build_test_test_suite")
5459
load(":watchos_dynamic_framework_tests.bzl", "watchos_dynamic_framework_test_suite")
5560
load(":watchos_extension_tests.bzl", "watchos_extension_test_suite")
5661
load(":watchos_framework_tests.bzl", "watchos_framework_test_suite")
@@ -100,6 +105,8 @@ ios_application_test_suite(name = "ios_application")
100105

101106
ios_app_clip_test_suite(name = "ios_app_clip")
102107

108+
ios_build_test_test_suite(name = "ios_build_test")
109+
103110
ios_extension_test_suite(name = "ios_extension")
104111

105112
ios_framework_test_suite(name = "ios_framework")
@@ -118,6 +125,8 @@ ios_ui_test_test_suite(name = "ios_ui_test")
118125

119126
ios_unit_test_test_suite(name = "ios_unit_test")
120127

128+
macos_build_test_test_suite(name = "macos_build_test")
129+
121130
macos_application_resources_test_suite(name = "macos_application_resources")
122131

123132
macos_application_test_suite(name = "macos_application")
@@ -147,6 +156,8 @@ macos_unit_test_test_suite(name = "macos_unit_test")
147156

148157
order_file_test_suite(name = "order_file")
149158

159+
tvos_build_test_test_suite(name = "tvos_build_test")
160+
150161
tvos_application_swift_test_suite(name = "tvos_application_swift")
151162

152163
tvos_application_test_suite(name = "tvos_application")
@@ -163,8 +174,12 @@ tvos_ui_test_test_suite(name = "tvos_ui_test")
163174

164175
tvos_unit_test_test_suite(name = "tvos_unit_test")
165176

177+
visionos_build_test_test_suite(name = "visionos_build_test")
178+
166179
visionos_application_test_suite(name = "visionos_application")
167180

181+
watchos_build_test_test_suite(name = "watchos_build_test")
182+
168183
watchos_application_swift_test_suite(name = "watchos_application_swift")
169184

170185
watchos_application_test_suite(name = "watchos_application")
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Copyright 2026 The Bazel Authors. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
"""ios_build_test Starlark tests."""
16+
17+
load(
18+
"//apple:ios.bzl",
19+
"ios_build_test",
20+
)
21+
load(
22+
":common.bzl",
23+
"common",
24+
)
25+
26+
def ios_build_test_test_suite(name):
27+
"""Test suite for ios_build_test.
28+
29+
Args:
30+
name: the base name to be used in things created by this macro
31+
"""
32+
33+
ios_build_test(
34+
name = "{}_builds_simple_library".format(name),
35+
minimum_os_version = common.min_os_ios.baseline,
36+
targets = [
37+
"//test/starlark_tests/resources:objc_lib_with_sdk_dylibs",
38+
],
39+
tags = [name],
40+
)
41+
42+
native.test_suite(
43+
name = name,
44+
tags = [name],
45+
)
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Copyright 2026 The Bazel Authors. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
"""macos_build_test Starlark tests."""
16+
17+
load(
18+
"//apple:macos.bzl",
19+
"macos_build_test",
20+
)
21+
load(
22+
":common.bzl",
23+
"common",
24+
)
25+
26+
def macos_build_test_test_suite(name):
27+
"""Test suite for macos_build_test.
28+
29+
Args:
30+
name: the base name to be used in things created by this macro
31+
"""
32+
33+
macos_build_test(
34+
name = "{}_builds_simple_library".format(name),
35+
minimum_os_version = common.min_os_macos.baseline,
36+
targets = [
37+
"//test/starlark_tests/resources:objc_lib_with_sdk_dylibs",
38+
],
39+
tags = [name],
40+
)
41+
42+
native.test_suite(
43+
name = name,
44+
tags = [name],
45+
)
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Copyright 2026 The Bazel Authors. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
"""tvos_build_test Starlark tests."""
16+
17+
load(
18+
"//apple:tvos.bzl",
19+
"tvos_build_test",
20+
)
21+
load(
22+
":common.bzl",
23+
"common",
24+
)
25+
26+
def tvos_build_test_test_suite(name):
27+
"""Test suite for tvos_build_test.
28+
29+
Args:
30+
name: the base name to be used in things created by this macro
31+
"""
32+
33+
tvos_build_test(
34+
name = "{}_builds_simple_library".format(name),
35+
minimum_os_version = common.min_os_tvos.baseline,
36+
targets = [
37+
"//test/starlark_tests/resources:objc_lib_with_sdk_dylibs",
38+
],
39+
tags = [name],
40+
)
41+
42+
native.test_suite(
43+
name = name,
44+
tags = [name],
45+
)
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Copyright 2026 The Bazel Authors. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
"""visionos_build_test Starlark tests."""
16+
17+
load(
18+
"//apple:visionos.bzl",
19+
"visionos_build_test",
20+
)
21+
load(
22+
":common.bzl",
23+
"common",
24+
)
25+
26+
def visionos_build_test_test_suite(name):
27+
"""Test suite for visionos_build_test.
28+
29+
Args:
30+
name: the base name to be used in things created by this macro
31+
"""
32+
33+
visionos_build_test(
34+
name = "{}_builds_simple_library".format(name),
35+
minimum_os_version = common.min_os_visionos.baseline,
36+
targets = [
37+
"//test/starlark_tests/resources:objc_lib_with_sdk_dylibs",
38+
],
39+
tags = [name],
40+
)
41+
42+
native.test_suite(
43+
name = name,
44+
tags = [name],
45+
)
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Copyright 2026 The Bazel Authors. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
"""watchos_build_test Starlark tests."""
16+
17+
load(
18+
"//apple:watchos.bzl",
19+
"watchos_build_test",
20+
)
21+
load(
22+
":common.bzl",
23+
"common",
24+
)
25+
26+
def watchos_build_test_test_suite(name):
27+
"""Test suite for watchos_build_test.
28+
29+
Args:
30+
name: the base name to be used in things created by this macro
31+
"""
32+
33+
watchos_build_test(
34+
name = "{}_builds_simple_library".format(name),
35+
minimum_os_version = common.min_os_watchos.baseline,
36+
targets = [
37+
"//test/starlark_tests/resources:objc_lib_with_sdk_dylibs",
38+
],
39+
tags = [name],
40+
)
41+
42+
native.test_suite(
43+
name = name,
44+
tags = [name],
45+
)

0 commit comments

Comments
 (0)