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 {
53
53
#[ arg( short = 'F' , long) ]
54
54
features : Option < String > ,
55
55
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
+
56
64
/// Build the benchmarks with the specified profile
57
65
#[ arg( long, default_value = "release" ) ]
58
66
profile : String ,
@@ -75,8 +83,23 @@ pub fn run(args: impl Iterator<Item = OsString>) -> Result<()> {
75
83
Commands :: Build {
76
84
filters,
77
85
features,
86
+ all_features,
87
+ no_default_features,
78
88
profile,
79
89
} => {
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
+ } ;
80
103
let features =
81
104
features. map ( |f| f. split ( [ ' ' , ',' ] ) . map ( |s| s. to_string ( ) ) . collect_vec ( ) ) ;
82
105
build_benches (
@@ -86,6 +109,7 @@ pub fn run(args: impl Iterator<Item = OsString>) -> Result<()> {
86
109
profile,
87
110
cli. quiet ,
88
111
measurement_mode,
112
+ passthrough_flags,
89
113
)
90
114
}
91
115
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> {
11
11
filters : Filters ,
12
12
features : & ' a Option < Vec < String > > ,
13
13
profile : & ' a str ,
14
+ passthrough_flags : & ' a Vec < String > ,
14
15
}
15
16
16
17
struct BuiltBench {
@@ -124,6 +125,8 @@ impl BuildOptions<'_> {
124
125
cargo. arg ( "--features" ) . arg ( features. join ( "," ) ) ;
125
126
}
126
127
128
+ cargo. args ( self . passthrough_flags ) ;
129
+
127
130
cargo. arg ( "--profile" ) . arg ( self . profile ) ;
128
131
129
132
self . filters . package . add_cargo_args ( & mut cargo) ;
@@ -159,11 +162,13 @@ pub fn build_benches(
159
162
profile : String ,
160
163
quiet : bool ,
161
164
measurement_mode : MeasurementMode ,
165
+ passthrough_flags : Vec < String > ,
162
166
) -> Result < ( ) > {
163
167
let built_benches = BuildOptions {
164
168
filters,
165
169
features : & features,
166
170
profile : & profile,
171
+ passthrough_flags : & passthrough_flags,
167
172
}
168
173
. build ( metadata, quiet, measurement_mode) ?;
169
174
You can’t perform that action at this time.
0 commit comments