File tree 2 files changed +13
-2
lines changed
2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -958,6 +958,7 @@ def construct_arguments(
958
958
compilation_mode = get_compilation_mode_opts (ctx , toolchain )
959
959
rustc_flags .add (compilation_mode .opt_level , format = "--codegen=opt-level=%s" )
960
960
rustc_flags .add (compilation_mode .debug_info , format = "--codegen=debuginfo=%s" )
961
+ rustc_flags .add (compilation_mode .strip_level , format = "--codegen=strip=%s" )
961
962
962
963
# For determinism to help with build distribution and such
963
964
if remap_path_prefix != None :
Original file line number Diff line number Diff line change @@ -464,10 +464,12 @@ def _rust_toolchain_impl(ctx):
464
464
list: A list containing the target's toolchain Provider info
465
465
"""
466
466
compilation_mode_opts = {}
467
- for k , v in ctx .attr .opt_level .items ():
467
+ for k , opt_level in ctx .attr .opt_level .items ():
468
468
if not k in ctx .attr .debug_info :
469
469
fail ("Compilation mode {} is not defined in debug_info but is defined opt_level" .format (k ))
470
- compilation_mode_opts [k ] = struct (debug_info = ctx .attr .debug_info [k ], opt_level = v )
470
+ if not k in ctx .attr .strip_level :
471
+ fail ("Compilation mode {} is not defined in strip_level but is defined opt_level" .format (k ))
472
+ compilation_mode_opts [k ] = struct (debug_info = ctx .attr .debug_info [k ], opt_level = opt_level , strip_level = ctx .attr .strip_level [k ])
471
473
for k , v in ctx .attr .debug_info .items ():
472
474
if not k in ctx .attr .opt_level :
473
475
fail ("Compilation mode {} is not defined in opt_level but is defined debug_info" .format (k ))
@@ -738,6 +740,14 @@ rust_toolchain = rule(
738
740
"opt" : "3" ,
739
741
},
740
742
),
743
+ "strip_level" : attr .string_dict (
744
+ doc = "Rustc strip levels." ,
745
+ default = {
746
+ "dbg" : "none" ,
747
+ "fastbuild" : "none" ,
748
+ "opt" : "debuginfo" ,
749
+ },
750
+ ),
741
751
"per_crate_rustc_flags" : attr .string_list (
742
752
doc = "Extra flags to pass to rustc in non-exec configuration" ,
743
753
),
You can’t perform that action at this time.
0 commit comments