Skip to content

Commit

Permalink
Fix rust_doc_test using execpath paths instead of rootpath (#1129)
Browse files Browse the repository at this point in the history
  • Loading branch information
UebelAndre authored and cfredric committed Feb 16, 2022
1 parent f1f3416 commit 83803fd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions rust/private/rustdoc.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ def rustdoc_compile_action(
toolchain,
crate_info,
output = None,
rustdoc_flags = []):
rustdoc_flags = [],
is_test = False):
"""Create a struct of information needed for a `rustdoc` compile action based on crate passed to the rustdoc rule.
Args:
Expand All @@ -57,6 +58,7 @@ def rustdoc_compile_action(
crate_info (CrateInfo): The provider of the crate passed to a rustdoc rule.
output (File, optional): An optional output a `rustdoc` action is intended to produce.
rustdoc_flags (list, optional): A list of `rustdoc` specific flags.
is_test (bool, optional): If True, the action will be configured for `rust_doc_test` targets
Returns:
struct: A struct of some `ctx.actions.run` arguments.
Expand Down Expand Up @@ -102,7 +104,7 @@ def rustdoc_compile_action(
attr = ctx.attr,
file = ctx.file,
toolchain = toolchain,
tool_path = toolchain.rust_doc.path,
tool_path = toolchain.rust_doc.short_path if is_test else toolchain.rust_doc.path,
cc_toolchain = cc_toolchain,
feature_configuration = feature_configuration,
crate_info = rustdoc_crate_info,
Expand Down
1 change: 1 addition & 0 deletions rust/private/rustdoc_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def _rust_doc_test_impl(ctx):
toolchain = find_toolchain(ctx),
crate_info = crate_info,
rustdoc_flags = rustdoc_flags,
is_test = True,
)

tools = action.tools + [ctx.executable._process_wrapper]
Expand Down

0 comments on commit 83803fd

Please sign in to comment.