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. 20
      src/command.rs

20
src/command.rs

@ -292,9 +292,9 @@ impl CargoCmd { @@ -292,9 +292,9 @@ impl CargoCmd {
let config = if self.should_build_3dsx() {
eprintln!("Getting metadata");
get_metadata(messages)
Some(get_metadata(messages))
} else {
CTRConfig::default()
None
};
// Run callback only for commands that use it
@ -336,7 +336,8 @@ impl Build { @@ -336,7 +336,8 @@ impl Build {
/// Callback for `cargo 3ds build`.
///
/// 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) {
if let Some(config) = config {
eprintln!("Building smdh: {}", config.path_smdh().display());
build_smdh(config, verbose);
@ -344,6 +345,7 @@ impl Build { @@ -344,6 +345,7 @@ impl Build {
build_3dsx(config, verbose);
}
}
}
impl Run {
/// Get the args to pass to `3dslink` based on these options.
@ -390,12 +392,14 @@ impl Run { @@ -390,12 +392,14 @@ impl Run {
/// Callback for `cargo 3ds run`.
///
/// 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
self.build_args.callback(config, verbose);
if let Some(cfg) = config {
eprintln!("Running 3dslink");
link(config, self, verbose);
link(cfg, self, verbose);
}
}
}
@ -403,13 +407,13 @@ impl Test { @@ -403,13 +407,13 @@ impl Test {
/// Callback for `cargo 3ds test`.
///
/// 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 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 {
// 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