Skip to content

Commit d796beb

Browse files
authored
More Bazel 8 compatibility (#170)
Follow up on #169 In order to use Bazel 8 following changes are needed: * select proper `sysroot`s for some additional toolchains * `+` instead of `~` as `bzl_mod` path seperator (backwards compatibility to Bazel 7 can be achieved using `--incompatible_use_plus_in_repo_names`) for some more toolchains Tested in - [x] starling-core (Bazel 6) - [x] starling-core (Bazel 7) - [x] starling-core (Bazel 8)
1 parent dc9d99f commit d796beb

File tree

19 files changed

+53
-24
lines changed

19 files changed

+53
-24
lines changed

cc/toolchains/gcc_arm_embedded/BUILD.bazel

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ config(
115115
"//conditions:default": [],
116116
},
117117
),
118+
sysroot = select({
119+
"@rules_swiftnav//cc:_enable_bzlmod": "external/rules_swiftnav++swift_cc_toolchain_extension+gcc_arm_embedded_toolchain",
120+
"//conditions:default": "external/gcc_arm_embedded_toolchain",
121+
}),
118122
)
119123

120124
cc_toolchain(

cc/toolchains/gcc_arm_embedded/config.bzl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def _impl(ctx):
8080
flag_groups = ([
8181
flag_group(
8282
flags = [
83-
"--sysroot=external/gcc_arm_embedded_toolchain",
83+
"--sysroot={}".format(ctx.attr.sysroot),
8484
"-no-canonical-prefixes",
8585
"-fno-canonical-system-headers",
8686
"-fno-common",
@@ -167,6 +167,7 @@ config = rule(
167167
attrs = {
168168
"c_opts": attr.string_list(),
169169
"link_opts": attr.string_list(),
170+
"sysroot": attr.string(),
170171
},
171172
provides = [CcToolchainConfigInfo],
172173
)

cc/toolchains/llvm/aarch64-linux/wrappers/wrapper

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ fi
3535

3636
tool_name=$(basename "${BASH_SOURCE[0]}")
3737
toolchain_bindir=external/aarch64-linux-llvm/bin
38-
toolchain_bindir_as_bzlmod="external/rules_swiftnav~~swift_cc_toolchain_extension~aarch64-linux-llvm/bin"
38+
toolchain_bindir_as_bzlmod="external/rules_swiftnav++swift_cc_toolchain_extension+aarch64-linux-llvm/bin"
3939

4040
if [[ -f "${toolchain_bindir}"/"${tool_name}" ]]; then
4141
# We're running under _execroot_, call the real tool.

cc/toolchains/llvm20/aarch64-darwin/wrappers/wrapper

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ tool_name=$(basename "${BASH_SOURCE[0]}")
3737
# In case the tool label is changed, a change in here is very likely needed
3838
# This establishes backwards compatibility with the old WORKSPACE file
3939
toolchain_bindir=external/aarch64-darwin-llvm20/bin
40-
toolchain_bindir_as_bzlmod="external/rules_swiftnav~~swift_cc_toolchain_extension~aarch64-darwin-llvm20/bin"
40+
toolchain_bindir_as_bzlmod="external/rules_swiftnav++swift_cc_toolchain_extension+aarch64-darwin-llvm20/bin"
4141

4242
if [[ -f "${toolchain_bindir}"/"${tool_name}" ]]; then
4343
# We're running under _execroot_, call the real tool.

cc/toolchains/llvm20/aarch64-linux/wrappers/wrapper

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ tool_name=$(basename "${BASH_SOURCE[0]}")
3737
# In case the tool label is changed, a change in here is very likely needed
3838
# This establishes backwards compatibility with the old WORKSPACE file
3939
toolchain_bindir=external/aarch64-linux-llvm20/bin
40-
toolchain_bindir_as_bzlmod="external/rules_swiftnav~~swift_cc_toolchain_extension~aarch64-linux-llvm20/bin"
40+
toolchain_bindir_as_bzlmod="external/rules_swiftnav++swift_cc_toolchain_extension+aarch64-linux-llvm20/bin"
4141

4242
if [[ -f "${toolchain_bindir}"/"${tool_name}" ]]; then
4343
# We're running under _execroot_, call the real tool.

cc/toolchains/llvm20/x86_64-aarch64-linux/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ cc_toolchain_config(
103103
abi_version = "clang",
104104
builtin_sysroot = select({
105105
# Remove once bzlmod is enabled by default
106-
"@rules_swiftnav//cc:_enable_bzlmod": "external/rules_swiftnav~~swift_cc_toolchain_extension~aarch64-sysroot",
106+
"@rules_swiftnav//cc:_enable_bzlmod": "external/rules_swiftnav++swift_cc_toolchain_extension+aarch64-sysroot",
107107
"//conditions:default": "external/aarch64-sysroot",
108108
}),
109109
compiler = "clang",

cc/toolchains/llvm20/x86_64-aarch64-linux/wrappers/wrapper

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ tool_name=$(basename "${BASH_SOURCE[0]}")
3737
# In case the tool label is changed, a change in here is very likely needed
3838
# This establishes backwards compatibility with the old WORKSPACE file
3939
toolchain_bindir=external/x86_64-linux-llvm20/bin
40-
toolchain_bindir_as_bzlmod="external/rules_swiftnav~~swift_cc_toolchain_extension~x86_64-linux-llvm20/bin"
40+
toolchain_bindir_as_bzlmod="external/rules_swiftnav++swift_cc_toolchain_extension+x86_64-linux-llvm20/bin"
4141

4242
if [[ -f "${toolchain_bindir}"/"${tool_name}" ]]; then
4343
# We're running under _execroot_, call the real tool.

cc/toolchains/llvm20/x86_64-darwin/wrappers/wrapper

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ tool_name=$(basename "${BASH_SOURCE[0]}")
3737
# In case the tool label is changed, a change in here is very likely needed
3838
# This establishes backwards compatibility with the old WORKSPACE file
3939
toolchain_bindir=external/x86_64-darwin-llvm20/bin
40-
toolchain_bindir_as_bzlmod="external/rules_swiftnav~~swift_cc_toolchain_extension~x86_64-darwin-llvm20/bin"
40+
toolchain_bindir_as_bzlmod="external/rules_swiftnav++swift_cc_toolchain_extension+x86_64-darwin-llvm20/bin"
4141

4242
if [[ -f "${toolchain_bindir}"/"${tool_name}" ]]; then
4343
# We're running under _execroot_, call the real tool.

cc/toolchains/llvm20/x86_64-linux/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ cc_toolchain_config(
118118
builtin_sysroot = select({
119119
"@rules_swiftnav//cc:_use_libcpp": None,
120120
# Remove once bzlmod is enabled by default
121-
"@rules_swiftnav//cc:_enable_bzlmod": "external/rules_swiftnav~~swift_cc_toolchain_extension~x86_64-sysroot",
121+
"@rules_swiftnav//cc:_enable_bzlmod": "external/rules_swiftnav++swift_cc_toolchain_extension+x86_64-sysroot",
122122
"//conditions:default": "external/x86_64-sysroot",
123123
}),
124124
compiler = "clang",

cc/toolchains/llvm20/x86_64-linux/wrappers/wrapper

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ tool_name=$(basename "${BASH_SOURCE[0]}")
3737
# In case the tool label is changed, a change in here is very likely needed
3838
# This establishes backwards compatibility with the old WORKSPACE file
3939
toolchain_bindir=external/x86_64-linux-llvm20/bin
40-
toolchain_bindir_as_bzlmod="external/rules_swiftnav~~swift_cc_toolchain_extension~x86_64-linux-llvm20/bin"
40+
toolchain_bindir_as_bzlmod="external/rules_swiftnav++swift_cc_toolchain_extension+x86_64-linux-llvm20/bin"
4141

4242
if [[ -f "${toolchain_bindir}"/"${tool_name}" ]]; then
4343
# We're running under _execroot_, call the real tool.

0 commit comments

Comments
 (0)