Browse Source

Don't build 3dsx for doctests

Basically, ensure we follow `should_build_3dsx` all the way through into
the callbacks.
pull/42/head
Ian Chamberlain 1 year ago
parent
commit
48aa7933a4
No known key found for this signature in database
GPG Key ID: AE5484D09405AA60
  1. 30
      src/command.rs

30
src/command.rs

@ -292,9 +292,9 @@ impl CargoCmd {
let config = if self.should_build_3dsx() { let config = if self.should_build_3dsx() {
eprintln!("Getting metadata"); eprintln!("Getting metadata");
get_metadata(messages) Some(get_metadata(messages))
} else { } else {
CTRConfig::default() None
}; };
// Run callback only for commands that use it // Run callback only for commands that use it
@ -336,12 +336,14 @@ impl Build {
/// Callback for `cargo 3ds build`. /// Callback for `cargo 3ds build`.
/// ///
/// This callback handles building the application as a `.3dsx` file. /// This callback handles building the application as a `.3dsx` file.
fn callback(&self, config: &CTRConfig, verbose: bool) { fn callback(&self, config: &Option<CTRConfig>, verbose: bool) {
eprintln!("Building smdh: {}", config.path_smdh().display()); if let Some(config) = config {
build_smdh(config, verbose); eprintln!("Building smdh: {}", config.path_smdh().display());
build_smdh(config, verbose);
eprintln!("Building 3dsx: {}", config.path_3dsx().display()); eprintln!("Building 3dsx: {}", config.path_3dsx().display());
build_3dsx(config, verbose); build_3dsx(config, verbose);
}
} }
} }
@ -390,12 +392,14 @@ impl Run {
/// Callback for `cargo 3ds run`. /// Callback for `cargo 3ds run`.
/// ///
/// This callback handles launching the application via `3dslink`. /// This callback handles launching the application via `3dslink`.
fn callback(&self, config: &CTRConfig, verbose: bool) { fn callback(&self, config: &Option<CTRConfig>, verbose: bool) {
// Run the normal "build" callback // Run the normal "build" callback
self.build_args.callback(config, verbose); self.build_args.callback(config, verbose);
eprintln!("Running 3dslink"); if let Some(cfg) = config {
link(config, self, verbose); eprintln!("Running 3dslink");
link(cfg, self, verbose);
}
} }
} }
@ -403,13 +407,13 @@ impl Test {
/// Callback for `cargo 3ds test`. /// Callback for `cargo 3ds test`.
/// ///
/// This callback handles launching the application via `3dslink`. /// This callback handles launching the application via `3dslink`.
fn callback(&self, config: &CTRConfig, verbose: bool) { fn callback(&self, config: &Option<CTRConfig>, verbose: bool) {
if self.no_run { if self.no_run {
// If the tests don't have to run, use the "build" callback // If the tests don't have to run, use the "build" callback
self.run_args.build_args.callback(config, verbose) self.run_args.build_args.callback(config, verbose);
} else { } else {
// If the tests have to run, use the "run" callback // If the tests have to run, use the "run" callback
self.run_args.callback(config, verbose) self.run_args.callback(config, verbose);
} }
} }
} }

Loading…
Cancel
Save