@@ -2,6 +2,7 @@ load("@rules_cc//cc:defs.bzl", "cc_library")
22load ("@rules_rust//rust:defs.bzl" , "rust_binary" , "rust_library" , "rust_test" )
33load ("//unified:platforms.bzl" , "UNIFIED_SUPPORTED_PLATFORMS" )
44load (":swift_runtime.bzl" , "swift_runtime_libs" )
5+ load (":swift_runtime_linking.bzl" , "swift_runtime_linking" )
56load (":xcode_transition.bzl" , "xcode_transition_swift_library" )
67
78package (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.
1623cc_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)
0 commit comments