File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,9 @@ pub struct BuildArgs {
93
93
94
94
#[ arg( long, default_value = "release" , help = "Build profile" ) ]
95
95
pub profile : String ,
96
+
97
+ #[ arg( long, default_value = "false" , help = "use --offline in cargo build" ) ]
98
+ pub offline : bool ,
96
99
}
97
100
98
101
#[ derive( Clone , Default , clap:: Args ) ]
@@ -127,6 +130,9 @@ pub(crate) fn build(build_args: &BuildArgs) -> Result<Option<PathBuf>> {
127
130
. with_features ( build_args. features . clone ( ) )
128
131
. with_profile ( build_args. profile . clone ( ) ) ;
129
132
guest_options. target_dir = build_args. target_dir . clone ( ) ;
133
+ if build_args. offline {
134
+ guest_options. options = vec ! [ "--offline" . to_string( ) ] ;
135
+ }
130
136
131
137
let pkg = get_package ( & build_args. manifest_dir ) ;
132
138
// We support builds of libraries with 0 or >1 executables.
@@ -215,6 +221,7 @@ mod tests {
215
221
exe_commit_output : PathBuf :: from ( DEFAULT_EXE_COMMIT_PATH ) ,
216
222
profile : "dev" . to_string ( ) ,
217
223
target_dir : Some ( target_dir. to_path_buf ( ) ) ,
224
+ offline : false ,
218
225
} ;
219
226
build ( & build_args) ?;
220
227
assert ! (
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ pub struct GuestOptions {
17
17
/// Target directory
18
18
pub target_dir : Option < PathBuf > ,
19
19
/// Custom options to pass as args to `cargo build`.
20
- pub ( crate ) options : Vec < String > ,
20
+ pub options : Vec < String > ,
21
21
}
22
22
23
23
impl GuestOptions {
You can’t perform that action at this time.
0 commit comments