@@ -64,6 +64,10 @@ def _assert_correct_dep_mapping(ctx):
64
64
),
65
65
)
66
66
67
+
68
+ def _rustc_output_name (name ):
69
+ return name + ".rustc-output"
70
+
67
71
def _determine_lib_name (name , crate_type , toolchain , lib_hash = None ):
68
72
"""See https://github.com/bazelbuild/rules_rust/issues/405
69
73
@@ -275,14 +279,22 @@ def _rust_library_common(ctx, crate_type):
275
279
toolchain ,
276
280
output_hash ,
277
281
)
282
+
278
283
rust_lib = ctx .actions .declare_file (rust_lib_name )
284
+ rust_lib_build_output = None
285
+ if ctx .attr ._process_wrapper :
286
+ rust_lib_build_output = ctx .actions .declare_file (_rustc_output_name (rust_lib_name ))
279
287
280
288
rust_metadata = None
289
+ rust_metadata_build_output = None
281
290
if can_build_metadata (toolchain , ctx , crate_type ) and not ctx .attr .disable_pipelining :
291
+ rust_metadata_name = paths .replace_extension (rust_lib_name , ".rmeta" )
292
+
282
293
rust_metadata = ctx .actions .declare_file (
283
- paths . replace_extension ( rust_lib_name , ".rmeta" ) ,
294
+ rust_metadata_name ,
284
295
sibling = rust_lib ,
285
296
)
297
+ rust_metadata_build_output = ctx .actions .declare_file (_rustc_output_name (rust_metadata_name ))
286
298
287
299
deps = transform_deps (ctx .attr .deps )
288
300
proc_macro_deps = transform_deps (ctx .attr .proc_macro_deps + get_import_macro_deps (ctx ))
@@ -300,7 +312,9 @@ def _rust_library_common(ctx, crate_type):
300
312
proc_macro_deps = depset (proc_macro_deps ),
301
313
aliases = ctx .attr .aliases ,
302
314
output = rust_lib ,
315
+ rust_lib_rustc_output = rust_lib_build_output ,
303
316
metadata = rust_metadata ,
317
+ rust_metadata_rustc_output = rust_metadata_build_output ,
304
318
edition = get_edition (ctx .attr , toolchain , ctx .label ),
305
319
rustc_env = ctx .attr .rustc_env ,
306
320
rustc_env_files = ctx .files .rustc_env_files ,
@@ -598,7 +612,7 @@ _common_attrs = {
598
612
The order that these files will be processed is unspecified, so
599
613
multiple definitions of a particular variable are discouraged.
600
614
601
- Note that the variables here are subject to
615
+ Note that the variables here are subject to
602
616
[workspace status](https://docs.bazel.build/versions/main/user-manual.html#workspace_status)
603
617
stamping should the `stamp` attribute be enabled. Stamp variables
604
618
should be wrapped in brackets in order to be resolved. E.g.
@@ -611,7 +625,7 @@ _common_attrs = {
611
625
List of compiler flags passed to `rustc`.
612
626
613
627
These strings are subject to Make variable expansion for predefined
614
- source/output path variables like `$location`, `$execpath`, and
628
+ source/output path variables like `$location`, `$execpath`, and
615
629
`$rootpath`. This expansion is useful if you wish to pass a generated
616
630
file of arguments to rustc: `@$(location //package:target)`.
617
631
""" ),
@@ -723,7 +737,7 @@ _rust_test_attrs = dict({
723
737
mandatory = False ,
724
738
default = True ,
725
739
doc = dedent ("""\
726
- Whether to use `libtest`. For targets using this flag, individual tests can be run by using the
740
+ Whether to use `libtest`. For targets using this flag, individual tests can be run by using the
727
741
[--test_arg](https://docs.bazel.build/versions/4.0.0/command-line-reference.html#flag--test_arg) flag.
728
742
E.g. `bazel test //src:rust_test --test_arg=foo::test::test_fn`.
729
743
""" ),
0 commit comments