Skip to content

Commit 8bc3240

Browse files
authored
Merge pull request #22325 from github/jketema/update-bazel-deps
Bazel: Update to latest `rules_cc`, `rules_swift`, and `apple_support`
2 parents 9239f0c + 8ebd3bc commit 8bc3240

6 files changed

Lines changed: 35 additions & 10 deletions

File tree

.bazelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ build --compilation_mode opt
1111
common --override_module=semmle_code=%workspace%/misc/bazel/semmle_code_stub
1212

1313
build --repo_env=CC=clang --repo_env=CXX=clang++
14+
# The standalone Linux toolchain uses gold, which does not support the
15+
# LLD-specific -z nostart-stop-gc workaround enabled by rules_swift.
16+
build:linux --features=-swift.lld_gc_workaround
1417
# Disable Android SDK auto-detection (we don't use it, and rules_android has Bazel 9 compatibility issues)
1518
build --repo_env=ANDROID_HOME=
1619

MODULE.bazel

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ local_path_override(
1515
# see https://registry.bazel.build/ for a list of available packages
1616

1717
bazel_dep(name = "platforms", version = "1.0.0")
18-
bazel_dep(name = "rules_cc", version = "0.2.17")
18+
bazel_dep(name = "rules_cc", version = "0.2.20")
1919
bazel_dep(name = "rules_go", version = "0.60.0")
2020
bazel_dep(name = "rules_java", version = "9.6.1")
2121
bazel_dep(name = "rules_pkg", version = "1.2.0")
@@ -31,13 +31,13 @@ bazel_dep(name = "gazelle", version = "0.50.0")
3131
bazel_dep(name = "rules_dotnet", version = "0.21.5-codeql.1")
3232
bazel_dep(name = "googletest", version = "1.17.0.bcr.2")
3333
bazel_dep(name = "rules_rust", version = "0.69.0")
34-
bazel_dep(name = "rules_swift", version = "4.0.0-rc4")
34+
bazel_dep(name = "rules_swift", version = "4.0.0-rc5")
3535
bazel_dep(name = "swift-syntax", version = "603.0.2")
3636

3737
# Needed so we can `use_repo` `local_config_xcode` and
3838
# `local_config_apple_cc_toolchains` below (referenced by the per-target
3939
# Xcode-config transition in `unified/swift-syntax-rs/xcode_transition.bzl`).
40-
bazel_dep(name = "apple_support", version = "2.6.1")
40+
bazel_dep(name = "apple_support", version = "2.8.0")
4141
bazel_dep(name = "zstd", version = "1.5.7.bcr.1")
4242

4343
bazel_dep(name = "buildifier_prebuilt", version = "6.4.0", dev_dependency = True)
@@ -238,7 +238,7 @@ use_repo(
238238
swift = use_extension("@rules_swift//swift:extensions.bzl", "swift")
239239
swift.toolchain(
240240
name = "swift_toolchain",
241-
swift_version = "6.3.2",
241+
swift_version = "6.3.3",
242242
)
243243
use_repo(
244244
swift,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.3.2
1+
6.3.3

unified/swift-syntax-rs/BUILD.bazel

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ load("@rules_cc//cc:defs.bzl", "cc_library")
22
load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library", "rust_test")
33
load("//unified:platforms.bzl", "UNIFIED_SUPPORTED_PLATFORMS")
44
load(":swift_runtime.bzl", "swift_runtime_libs")
5+
load(":swift_runtime_linking.bzl", "swift_runtime_linking")
56
load(":xcode_transition.bzl", "xcode_transition_swift_library")
67

78
package(default_visibility = ["//visibility:public"])
@@ -11,15 +12,25 @@ swift_runtime_libs(
1112
toolchain = "@swift_toolchain_ubuntu22.04//:files",
1213
)
1314

14-
# The `$ORIGIN` runpath makes an executable look beside itself instead, so
15-
# we find the Swift runtime libraries we bundle with the extractor.
15+
swift_runtime_linking(
16+
name = "_swift_runtime_cc_info",
17+
target_compatible_with = ["@platforms//os:linux"],
18+
visibility = ["//visibility:private"],
19+
)
20+
21+
# On Linux, provide the downloaded Swift runtime at link time and look beside
22+
# the executable for the copies bundled with the extractor at runtime.
1623
cc_library(
17-
name = "swift_runtime_rpath",
24+
name = "swift_runtime_linking",
1825
linkopts = select({
1926
"@platforms//os:linux": ["-Wl,-rpath,$$ORIGIN"],
2027
"//conditions:default": [],
2128
}),
2229
target_compatible_with = UNIFIED_SUPPORTED_PLATFORMS,
30+
deps = select({
31+
"@platforms//os:linux": [":_swift_runtime_cc_info"],
32+
"//conditions:default": [],
33+
}),
2334
)
2435

2536
# Swift FFI shim: wraps swift-syntax and exposes a small C ABI.
@@ -46,7 +57,7 @@ rust_library(
4657
edition = "2024",
4758
target_compatible_with = UNIFIED_SUPPORTED_PLATFORMS,
4859
deps = [
49-
":swift_runtime_rpath",
60+
":swift_runtime_linking",
5061
":swift_syntax_ffi",
5162
],
5263
)

unified/swift-syntax-rs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ The build does not depend on any particular version manager. You need:
129129
- **Rust** — pinned to `1.88` by the repo-root [`rust-toolchain.toml`](../../rust-toolchain.toml),
130130
which `rustup` picks up automatically.
131131
- **Swift** — pinned to the version in [`.swift-version`](.swift-version)
132-
(currently `6.3.2`), used to build `swift-syntax` `603.0.2`. Install it any way
132+
(currently `6.3.3`), used to build `swift-syntax` `603.0.2`. Install it any way
133133
you like — [swift.org](https://www.swift.org/install/) or
134134
[swiftly](https://www.swift.org/swiftly/) (which reads `.swift-version`), or a
135135
system package. Just make sure `swift` (and `swiftc`) are on your `PATH`
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
"""Expose the selected Swift toolchain's dynamic runtime to native dependents."""
2+
3+
load("@rules_swift//swift:swift.bzl", "swift_common")
4+
5+
def _swift_runtime_linking_impl(ctx):
6+
return [swift_common.get_toolchain(ctx).dynamic_runtime_cc_info]
7+
8+
swift_runtime_linking = rule(
9+
implementation = _swift_runtime_linking_impl,
10+
toolchains = swift_common.use_toolchain(),
11+
)

0 commit comments

Comments
 (0)