diff options
author | buildbreaker2021 <88653395+buildbreaker2021@users.noreply.github.com> | 2024-01-16 21:20:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-16 20:20:06 +0000 |
commit | 50b9ef36967d3adad5a1788bb65253ab4aaaf0dd (patch) | |
tree | dc63ab4e835fe6a7d18e926e8d6dbd24399d2241 | |
parent | 9a6f5c870ea75dc26256f52732dc6071fefb2a03 (diff) | |
download | bazelbuild-rules_rust-50b9ef36967d3adad5a1788bb65253ab4aaaf0dd.tar.gz |
Prepare rust rules for Starlark CcToolchainInfo. (#2424)
https://github.com/bazelbuild/rules_rust/issues/2425
-rw-r--r-- | rust/private/rustc.bzl | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/rust/private/rustc.bzl b/rust/private/rustc.bzl index ef3479e5..eff542eb 100644 --- a/rust/private/rustc.bzl +++ b/rust/private/rustc.bzl @@ -671,7 +671,15 @@ def collect_inputs( """ linker_script = getattr(file, "linker_script") if hasattr(file, "linker_script") else None - linker_depset = cc_toolchain.linker_files() + # TODO: As of writing this comment Bazel used Java CcToolchainInfo. + # However there is ongoing work to rewrite provider in Starlark. + # rules_rust is not coupled with Bazel release. Remove conditional and change to + # _linker_files once Starlark CcToolchainInfo is visible to Bazel. + # https://github.com/bazelbuild/rules_rust/issues/2425 + if hasattr(cc_toolchain, "_linker_files"): + linker_depset = cc_toolchain._linker_files + else: + linker_depset = cc_toolchain.linker_files() compilation_mode = ctx.var["COMPILATION_MODE"] use_pic = _should_use_pic(cc_toolchain, feature_configuration, crate_info.type, compilation_mode) |