@@ -20,7 +20,7 @@ load("//rust/private:providers.bzl", "CrateInfo")
20
20
load ("//rust/private:rustdoc.bzl" , "rustdoc_compile_action" )
21
21
load ("//rust/private:utils.bzl" , "dedent" , "find_toolchain" , "transform_deps" )
22
22
23
- def _construct_writer_arguments (ctx , test_runner , opt_test_params , action , crate_info ):
23
+ def _construct_writer_arguments (ctx , test_runner , opt_test_params , action ):
24
24
"""Construct arguments and environment variables specific to `rustdoc_test_writer`.
25
25
26
26
This is largely solving for the fact that tests run from a runfiles directory
@@ -32,7 +32,6 @@ def _construct_writer_arguments(ctx, test_runner, opt_test_params, action, crate
32
32
test_runner (File): The test_runner output file declared by `rustdoc_test`.
33
33
opt_test_params (File): An output file we can optionally use to store params for `rustdoc`.
34
34
action (struct): Action arguments generated by `rustdoc_compile_action`.
35
- crate_info (CrateInfo): The provider of the crate who's docs are being tested.
36
35
37
36
Returns:
38
37
tuple: A tuple of `rustdoc_test_writer` specific inputs
@@ -64,29 +63,13 @@ def _construct_writer_arguments(ctx, test_runner, opt_test_params, action, crate
64
63
65
64
# Collect and dedupe all of the file roots in a list before appending
66
65
# them to args to prevent generating a large amount of identical args
67
- roots = []
68
- root = crate_info .output .root .path
69
- if not root in roots :
70
- roots .append (root )
71
- for dep in crate_info .deps .to_list () + crate_info .proc_macro_deps .to_list ():
72
- dep_crate_info = getattr (dep , "crate_info" , None )
73
- dep_dep_info = getattr (dep , "dep_info" , None )
74
- if dep_crate_info :
75
- root = dep_crate_info .output .root .path
76
- if not root in roots :
77
- roots .append (root )
78
- if dep_dep_info :
79
- for direct_dep in dep_dep_info .direct_crates .to_list ():
80
- root = direct_dep .dep .output .root .path
81
- if not root in roots :
82
- roots .append (root )
83
- for transitive_dep in dep_dep_info .transitive_crates .to_list ():
84
- root = transitive_dep .output .root .path
85
- if not root in roots :
86
- roots .append (root )
87
-
88
- for root in roots :
89
- writer_args .add ("--strip_substring={}/" .format (root ))
66
+ roots = {}
67
+ for input in action .inputs .to_list ():
68
+ roots [input .root .path ] = None
69
+
70
+ for root in roots .keys ():
71
+ if root :
72
+ writer_args .add ("--strip_substring={}/" .format (root ))
90
73
91
74
# Indicate that the rustdoc_test args are over.
92
75
writer_args .add ("--" )
@@ -165,7 +148,6 @@ def _rust_doc_test_impl(ctx):
165
148
test_runner = test_runner ,
166
149
opt_test_params = opt_test_params ,
167
150
action = action ,
168
- crate_info = crate_info ,
169
151
)
170
152
171
153
# Allow writer environment variables to override those from the action.
0 commit comments