Skip to content

Allow the customization of sysroot_src in the generated rust-project.… #3306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion rust/private/rust_analyzer.bzl
Original file line number Diff line number Diff line change
@@ -277,6 +277,7 @@ def _rust_analyzer_toolchain_impl(ctx):
proc_macro_srv = ctx.executable.proc_macro_srv,
rustc = ctx.executable.rustc,
rustc_srcs = ctx.attr.rustc_srcs,
rustc_srcs_path = ctx.attr.rustc_srcs_path,
)

return [toolchain]
@@ -302,6 +303,10 @@ rust_analyzer_toolchain = rule(
doc = "The source code of rustc.",
mandatory = True,
),
"rustc_srcs_path": attr.string(
doc = "The direct path to rustc srcs relative to rustc_srcs package root.",
default = "library"
)
},
)

@@ -315,8 +320,8 @@ def _rust_analyzer_detect_sysroot_impl(ctx):
)

rustc_srcs = rust_analyzer_toolchain.rustc_srcs
sysroot_src = rustc_srcs.label.package + "/" + rust_analyzer_toolchain.rustc_srcs_path

sysroot_src = rustc_srcs.label.package + "/library"
if rustc_srcs.label.workspace_root:
sysroot_src = _OUTPUT_BASE_TEMPLATE + rustc_srcs.label.workspace_root + "/" + sysroot_src
else: