File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
crates/cargo-codspeed/src Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,14 @@ enum Commands {
5353 #[ arg( short = 'F' , long) ]
5454 features : Option < String > ,
5555
56+ /// Activate all available features of all selected packages.
57+ #[ arg( long) ]
58+ all_features : bool ,
59+
60+ /// Do not activate the `default` feature of the selected packages.
61+ #[ arg( long) ]
62+ no_default_features : bool ,
63+
5664 /// Build the benchmarks with the specified profile
5765 #[ arg( long, default_value = "release" ) ]
5866 profile : String ,
@@ -75,8 +83,23 @@ pub fn run(args: impl Iterator<Item = OsString>) -> Result<()> {
7583 Commands :: Build {
7684 filters,
7785 features,
86+ all_features,
87+ no_default_features,
7888 profile,
7989 } => {
90+ let passthrough_flags = {
91+ let mut passthrough_flags = Vec :: new ( ) ;
92+
93+ if all_features {
94+ passthrough_flags. push ( "--all-features" . to_string ( ) ) ;
95+ }
96+
97+ if no_default_features {
98+ passthrough_flags. push ( "--no-default-features" . to_string ( ) ) ;
99+ }
100+
101+ passthrough_flags
102+ } ;
80103 let features =
81104 features. map ( |f| f. split ( [ ' ' , ',' ] ) . map ( |s| s. to_string ( ) ) . collect_vec ( ) ) ;
82105 build_benches (
@@ -86,6 +109,7 @@ pub fn run(args: impl Iterator<Item = OsString>) -> Result<()> {
86109 profile,
87110 cli. quiet ,
88111 measurement_mode,
112+ passthrough_flags,
89113 )
90114 }
91115 Commands :: Run { filters } => run_benches ( & metadata, filters, measurement_mode) ,
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ struct BuildOptions<'a> {
1111 filters : Filters ,
1212 features : & ' a Option < Vec < String > > ,
1313 profile : & ' a str ,
14+ passthrough_flags : & ' a Vec < String > ,
1415}
1516
1617struct BuiltBench {
@@ -124,6 +125,8 @@ impl BuildOptions<'_> {
124125 cargo. arg ( "--features" ) . arg ( features. join ( "," ) ) ;
125126 }
126127
128+ cargo. args ( self . passthrough_flags ) ;
129+
127130 cargo. arg ( "--profile" ) . arg ( self . profile ) ;
128131
129132 self . filters . package . add_cargo_args ( & mut cargo) ;
@@ -159,11 +162,13 @@ pub fn build_benches(
159162 profile : String ,
160163 quiet : bool ,
161164 measurement_mode : MeasurementMode ,
165+ passthrough_flags : Vec < String > ,
162166) -> Result < ( ) > {
163167 let built_benches = BuildOptions {
164168 filters,
165169 features : & features,
166170 profile : & profile,
171+ passthrough_flags : & passthrough_flags,
167172 }
168173 . build ( metadata, quiet, measurement_mode) ?;
169174
You can’t perform that action at this time.
0 commit comments