Skip to content

Commit

Permalink
rust: Remap source prefix to project root
Browse files Browse the repository at this point in the history
Reviewed By: shayne-fletcher, jsgf

Differential Revision: D47821554

fbshipit-source-id: 3cf26fe3dbb168362fa8b0e2dc1acb3cbf044b9d
  • Loading branch information
zertosh authored and facebook-github-bot committed Aug 1, 2023
1 parent d0f62c2 commit fdcc7f3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion prelude/rust/build.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,8 @@ def rust_compile(
predeclared_outputs: dict[Emit.type, "artifact"] = {},
extra_flags: list[[str, "resolved_macro"]] = [],
is_binary: bool = False) -> RustcOutput.type:
exec_is_windows = ctx.attrs._exec_os_type[OsLookup].platform == "windows"

toolchain_info = compile_ctx.toolchain_info

lints, clippy_lints = _lint_flags(compile_ctx)
Expand All @@ -361,7 +363,7 @@ def rust_compile(
# Report unused --extern crates in the notification stream.
["--json=unused-externs-silent", "-Wunused-crate-dependencies"] if toolchain_info.report_unused_deps else [],
common_args.args,
cmd_args("--remap-path-prefix=", compile_ctx.symlinked_srcs, "/=", ctx.label.package, "/", delimiter = ""),
cmd_args("--remap-path-prefix=", compile_ctx.symlinked_srcs, "/=", cmd_args(ctx.label.path).replace_regex("\\\\", "/") if exec_is_windows else ctx.label.path, "/", delimiter = ""),
compile_ctx.linker_args,
extra_flags,
)
Expand Down

0 comments on commit fdcc7f3

Please sign in to comment.