Skip to content

Commit 7967e45

Browse files
authored
Changes to fix apple_support for Bazel 9 (#497)
Needed to land: bazelbuild/rules_apple#2868
1 parent a3de364 commit 7967e45

File tree

9 files changed

+76
-96
lines changed

9 files changed

+76
-96
lines changed

.bazelci/presubmit.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ tasks:
4949

5050
macos_latest:
5151
name: "Current LTS"
52-
bazel: last_rc # TODO: switch back to latest once 9.x is released
52+
bazel: last_rc
5353
<<: *common
5454

55-
# TODO: Re-enable once >10.0.0-pre.20251105.2 is available https://github.com/bazelbuild/bazel/issues/27749
55+
# TODO: Enable ASAP when we remove usage of `//command_line_option:incompatible_enable_apple_toolchain_resolution`
5656
# macos_rolling:
5757
# name: "Latest Rolling"
5858
# bazel: rolling
@@ -66,10 +66,11 @@ tasks:
6666
- test/shell/layering_check_test.sh
6767
- test/shell/header_parsing_test.sh
6868

69-
macos_last_green:
70-
name: "Last Green Bazel"
71-
bazel: last_green
72-
<<: *common
69+
# TODO: Enable ASAP when we remove usage of `//command_line_option:incompatible_enable_apple_toolchain_resolution`
70+
# macos_last_green:
71+
# name: "Last Green Bazel"
72+
# bazel: last_green
73+
# <<: *common
7374

7475
linux_latest:
7576
name: "Current LTS"

MODULE.bazel

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,7 @@ module(
1010
bazel_dep(name = "bazel_features", version = "1.27.0")
1111
bazel_dep(name = "bazel_skylib", version = "1.3.0")
1212
bazel_dep(name = "platforms", version = "0.0.9")
13-
bazel_dep(name = "rules_cc", version = "0.2.13")
14-
15-
# NOTE: Not inherited but ok since this is only for tests
16-
single_version_override(
17-
module_name = "rules_cc",
18-
patch_strip = 1,
19-
patches = [
20-
# https://github.com/bazelbuild/rules_cc/pull/518
21-
"//test:rules_cc.patch",
22-
],
23-
)
13+
bazel_dep(name = "rules_cc", version = "0.2.15")
2414

2515
apple_cc_configure = use_extension("//crosstool:setup.bzl", "apple_cc_configure_extension")
2616
use_repo(apple_cc_configure, "local_config_apple_cc", "local_config_apple_cc_toolchains")

test/rules_cc.patch

Lines changed: 0 additions & 14 deletions
This file was deleted.

test/xcode_config_test.bzl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
load("@bazel_features//:features.bzl", "bazel_features")
1818
load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts")
1919
load("//xcode:available_xcodes.bzl", "available_xcodes")
20-
load("//xcode:xcode_config.bzl", "xcode_config")
21-
load("//xcode:xcode_version.bzl", "xcode_version")
2220
load(
23-
"//xcode/private:providers.bzl",
21+
"//xcode:providers.bzl",
2422
"XcodeVersionPropertiesInfo",
25-
) # buildifier: disable=bzl-visibility
23+
)
24+
load("//xcode:xcode_config.bzl", "xcode_config")
25+
load("//xcode:xcode_version.bzl", "xcode_version")
2626
load(":test_helpers.bzl", "FIXTURE_TAGS", "find_action", "make_all_tests")
2727

2828
visibility("private")

test/xcode_version_test.bzl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616

1717
load("@bazel_features//:features.bzl", "bazel_features")
1818
load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts")
19-
load("//xcode:xcode_version.bzl", "xcode_version")
2019
load(
21-
"//xcode/private:providers.bzl",
20+
"//xcode:providers.bzl",
2221
"XcodeVersionPropertiesInfo",
23-
) # buildifier: disable=bzl-visibility
22+
)
23+
load("//xcode:xcode_version.bzl", "xcode_version")
2424
load(":test_helpers.bzl", "FIXTURE_TAGS", "make_all_tests")
2525

2626
visibility("private")

xcode/private/providers.bzl

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -33,62 +33,6 @@ The default Xcode version from `available_xcodes`.
3333
},
3434
)
3535

36-
def _xcode_version_properties_info_init(
37-
*,
38-
xcode_version,
39-
default_ios_sdk_version = "8.4",
40-
default_macos_sdk_version = "10.11",
41-
default_tvos_sdk_version = "9.0",
42-
default_watchos_sdk_version = "2.0",
43-
default_visionos_sdk_version = "1.0",
44-
sdk_variant_info = None):
45-
# Ensure that all fields get default values if they weren't specified.
46-
return {
47-
"xcode_version": xcode_version,
48-
"default_ios_sdk_version": default_ios_sdk_version,
49-
"default_macos_sdk_version": default_macos_sdk_version,
50-
"default_tvos_sdk_version": default_tvos_sdk_version,
51-
"default_watchos_sdk_version": default_watchos_sdk_version,
52-
"default_visionos_sdk_version": default_visionos_sdk_version,
53-
"sdk_variant_info": sdk_variant_info,
54-
}
55-
56-
XcodeVersionPropertiesInfo, _new_xcode_version_properties_info = provider(
57-
doc = """\
58-
Information about a specific Xcode version, such as its default SDK versions.
59-
""",
60-
fields = {
61-
"xcode_version": """\
62-
A string representing the Xcode version number, or `None` if it is unknown.
63-
""",
64-
"default_ios_sdk_version": """\
65-
A string representing the default iOS SDK version number for this version of
66-
Xcode, or `None` if it is unknown.
67-
""",
68-
"default_macos_sdk_version": """\
69-
A string representing the default macOS SDK version number for this version of
70-
Xcode, or `None` if it is unknown.
71-
""",
72-
"default_tvos_sdk_version": """\
73-
A string representing the default tvOS SDK version number for this version of
74-
Xcode, or `None` if it is unknown.
75-
""",
76-
"default_watchos_sdk_version": """\
77-
A string representing the default watchOS SDK version number for this version of
78-
Xcode, or `None` if it is unknown.
79-
""",
80-
"default_visionos_sdk_version": """\
81-
A string representing the default visionOS SDK version number for this version
82-
of Xcode, or `None` if it is unknown.
83-
""",
84-
"sdk_variant_info": """\
85-
The `XcodeSdkVariantInfo` provider for the SDK in this version of Xcode to
86-
build with under the current target configuration, or `None` if it is unknown.
87-
""",
88-
},
89-
init = _xcode_version_properties_info_init,
90-
)
91-
9236
XcodeVersionRuleInfo = provider(
9337
doc = """\
9438
The information in a single target of the `xcode_version` rule. A single target

xcode/providers.bzl

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,59 @@ XcodeSdkVariantInfo = provider(
110110
""",
111111
},
112112
)
113+
114+
def _xcode_version_properties_info_init(
115+
*,
116+
xcode_version,
117+
default_ios_sdk_version = "8.4",
118+
default_macos_sdk_version = "10.11",
119+
default_tvos_sdk_version = "9.0",
120+
default_watchos_sdk_version = "2.0",
121+
default_visionos_sdk_version = "1.0",
122+
sdk_variant_info = None):
123+
# Ensure that all fields get default values if they weren't specified.
124+
return {
125+
"xcode_version": xcode_version,
126+
"default_ios_sdk_version": default_ios_sdk_version,
127+
"default_macos_sdk_version": default_macos_sdk_version,
128+
"default_tvos_sdk_version": default_tvos_sdk_version,
129+
"default_watchos_sdk_version": default_watchos_sdk_version,
130+
"default_visionos_sdk_version": default_visionos_sdk_version,
131+
"sdk_variant_info": sdk_variant_info,
132+
}
133+
134+
XcodeVersionPropertiesInfo, _new_xcode_version_properties_info = provider(
135+
doc = """\
136+
Information about a specific Xcode version, such as its default SDK versions.
137+
""",
138+
fields = {
139+
"xcode_version": """\
140+
A string representing the Xcode version number, or `None` if it is unknown.
141+
""",
142+
"default_ios_sdk_version": """\
143+
A string representing the default iOS SDK version number for this version of
144+
Xcode, or `None` if it is unknown.
145+
""",
146+
"default_macos_sdk_version": """\
147+
A string representing the default macOS SDK version number for this version of
148+
Xcode, or `None` if it is unknown.
149+
""",
150+
"default_tvos_sdk_version": """\
151+
A string representing the default tvOS SDK version number for this version of
152+
Xcode, or `None` if it is unknown.
153+
""",
154+
"default_watchos_sdk_version": """\
155+
A string representing the default watchOS SDK version number for this version of
156+
Xcode, or `None` if it is unknown.
157+
""",
158+
"default_visionos_sdk_version": """\
159+
A string representing the default visionOS SDK version number for this version
160+
of Xcode, or `None` if it is unknown.
161+
""",
162+
"sdk_variant_info": """\
163+
The `XcodeSdkVariantInfo` provider for the SDK in this version of Xcode to
164+
build with under the current target configuration, or `None` if it is unknown.
165+
""",
166+
},
167+
init = _xcode_version_properties_info_init,
168+
)

xcode/xcode_config.bzl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,13 @@
1515
"""Implementation of the `xcode_config` build rule."""
1616

1717
load("@bazel_features//:features.bzl", "bazel_features")
18+
load(
19+
"@build_bazel_apple_support//xcode:providers.bzl",
20+
"XcodeVersionPropertiesInfo",
21+
)
1822
load(
1923
"@build_bazel_apple_support//xcode/private:providers.bzl",
2024
"AvailableXcodesInfo",
21-
"XcodeVersionPropertiesInfo",
2225
"XcodeVersionRuleInfo",
2326
)
2427

xcode/xcode_version.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ load("@bazel_features//:features.bzl", "bazel_features")
1818
load(
1919
"@build_bazel_apple_support//xcode:providers.bzl",
2020
"XcodeSdkVariantInfo",
21+
"XcodeVersionPropertiesInfo",
2122
)
2223
load(
2324
"@build_bazel_apple_support//xcode/private:providers.bzl",
24-
"XcodeVersionPropertiesInfo",
2525
"XcodeVersionRuleInfo",
2626
)
2727

0 commit comments

Comments
 (0)