diff --git a/crates/moon/src/cli/build.rs b/crates/moon/src/cli/build.rs index f86de79e..3073c659 100644 --- a/crates/moon/src/cli/build.rs +++ b/crates/moon/src/cli/build.rs @@ -115,7 +115,7 @@ fn run_build_internal( cli.quiet, )?; - let original_target_dir = target_dir; + let raw_target_dir = target_dir; let mut moonc_opt = super::get_compiler_flags(source_dir, &cmd.build_flags)?; moonc_opt.build_opt.deny_warn = cmd.build_flags.deny_warn; let run_mode = RunMode::Build; @@ -125,13 +125,18 @@ fn run_build_internal( let moonbuild_opt = MoonbuildOpt { source_dir: source_dir.to_path_buf(), + raw_target_dir: raw_target_dir.to_path_buf(), target_dir, sort_input, run_mode, quiet: cli.quiet, verbose: cli.verbose, build_graph: cli.build_graph, - ..Default::default() + test_opt: None, + fmt_opt: None, + args: vec![], + output_json: false, + no_parallelize: false, }; let module = moonutil::scan::scan( @@ -168,7 +173,7 @@ fn run_build_internal( &moonbuild_opt, ®_cfg, &module, - original_target_dir, + raw_target_dir, ) } else { entry::run_build(&moonc_opt, &moonbuild_opt, &module) diff --git a/crates/moon/src/cli/bundle.rs b/crates/moon/src/cli/bundle.rs index e4e38e10..03765976 100644 --- a/crates/moon/src/cli/bundle.rs +++ b/crates/moon/src/cli/bundle.rs @@ -123,15 +123,24 @@ fn run_bundle_internal( let run_mode = RunMode::Bundle; let sort_input = cmd.build_flags.sort_input; + let raw_target_dir = target_dir.to_path_buf(); let target_dir = mk_arch_mode_dir(source_dir, target_dir, &moonc_opt, run_mode)?; let _lock = FileLock::lock(&target_dir)?; let moonbuild_opt = MoonbuildOpt { source_dir: source_dir.to_path_buf(), + raw_target_dir, target_dir, sort_input, run_mode, - ..Default::default() + test_opt: None, + fmt_opt: None, + args: vec![], + verbose: cli.verbose, + quiet: cli.quiet, + output_json: false, + no_parallelize: false, + build_graph: false, }; let module = moonutil::scan::scan( false, diff --git a/crates/moon/src/cli/check.rs b/crates/moon/src/cli/check.rs index 017840e4..4ee3c64a 100644 --- a/crates/moon/src/cli/check.rs +++ b/crates/moon/src/cli/check.rs @@ -132,7 +132,7 @@ fn run_check_internal( cli.quiet, )?; - let original_target_dir = target_dir; + let raw_target_dir = target_dir; let mut moonc_opt = get_compiler_flags(source_dir, &cmd.build_flags)?; moonc_opt.build_opt.deny_warn = cmd.build_flags.deny_warn; let run_mode = RunMode::Check; @@ -143,6 +143,7 @@ fn run_check_internal( let moonbuild_opt = MoonbuildOpt { source_dir: source_dir.to_path_buf(), + raw_target_dir: raw_target_dir.to_path_buf(), target_dir: target_dir.clone(), sort_input, run_mode, @@ -150,7 +151,10 @@ fn run_check_internal( verbose: cli.verbose, output_json: cmd.output_json, build_graph: cli.build_graph, - ..Default::default() + test_opt: None, + fmt_opt: None, + args: vec![], + no_parallelize: false, }; let module = moonutil::scan::scan( @@ -187,7 +191,7 @@ fn run_check_internal( &moonbuild_opt, ®_cfg, &module, - original_target_dir, + raw_target_dir, ) } else { let pid_path = target_dir.join(MOON_PID_NAME); diff --git a/crates/moon/src/cli/doc.rs b/crates/moon/src/cli/doc.rs index 8a808cf6..d30dc691 100644 --- a/crates/moon/src/cli/doc.rs +++ b/crates/moon/src/cli/doc.rs @@ -82,13 +82,22 @@ pub fn run_doc(cli: UniversalFlags, cmd: DocSubcommand) -> anyhow::Result { )?; let run_mode = RunMode::Check; + let raw_target_dir = target_dir.to_path_buf(); let target_dir = mk_arch_mode_dir(&source_dir, &target_dir, &moonc_opt, run_mode)?; let moonbuild_opt = MoonbuildOpt { source_dir: source_dir.clone(), + raw_target_dir, target_dir, sort_input: true, run_mode, - ..Default::default() + test_opt: None, + fmt_opt: None, + args: vec![], + verbose: cli.verbose, + quiet: cli.quiet, + output_json: false, + no_parallelize: false, + build_graph: false, }; let module = moonutil::scan::scan( diff --git a/crates/moon/src/cli/fmt.rs b/crates/moon/src/cli/fmt.rs index 801de61d..178e52d8 100644 --- a/crates/moon/src/cli/fmt.rs +++ b/crates/moon/src/cli/fmt.rs @@ -46,6 +46,7 @@ pub fn run_fmt(cli: &UniversalFlags, cmd: FmtSubcommand) -> anyhow::Result let moonc_opt = MooncOpt::default(); let run_mode = RunMode::Format; + let raw_target_dir = target_dir.to_path_buf(); let target_dir = mk_arch_mode_dir(&source_dir, &target_dir, &moonc_opt, run_mode)?; let _lock = FileLock::lock(&target_dir)?; @@ -59,12 +60,18 @@ pub fn run_fmt(cli: &UniversalFlags, cmd: FmtSubcommand) -> anyhow::Result let moonbuild_opt = MoonbuildOpt { source_dir, + raw_target_dir, target_dir: target_dir.clone(), sort_input: cmd.sort_input, run_mode, fmt_opt: Some(FmtOpt { check: cmd.check }), build_graph: cli.build_graph, - ..Default::default() + test_opt: None, + args: vec![], + verbose: cli.verbose, + quiet: cli.quiet, + output_json: false, + no_parallelize: false, }; let module = moonutil::scan::scan( diff --git a/crates/moon/src/cli/generate_test_driver.rs b/crates/moon/src/cli/generate_test_driver.rs index 156971dd..89680e83 100644 --- a/crates/moon/src/cli/generate_test_driver.rs +++ b/crates/moon/src/cli/generate_test_driver.rs @@ -130,9 +130,11 @@ pub fn generate_test_driver( &RegistryConfig::load(), cli.quiet, )?; + let raw_target_dir = target_dir.to_path_buf(); let moonbuild_opt = MoonbuildOpt { source_dir, + raw_target_dir, target_dir: target_dir.clone(), test_opt: Some(TestOpt { filter_package: filter_package.clone(), @@ -145,7 +147,12 @@ pub fn generate_test_driver( fmt_opt: None, sort_input, run_mode, - ..Default::default() + args: vec![], + verbose: cli.verbose, + quiet: cli.quiet, + output_json: false, + no_parallelize: false, + build_graph: false, }; let module = moonutil::scan::scan( diff --git a/crates/moon/src/cli/info.rs b/crates/moon/src/cli/info.rs index 48109b36..7e2c610e 100644 --- a/crates/moon/src/cli/info.rs +++ b/crates/moon/src/cli/info.rs @@ -69,6 +69,7 @@ pub fn run_info(cli: UniversalFlags, cmd: InfoSubcommand) -> anyhow::Result })?; let module_name = &mod_desc.name; let mut moonc_opt = MooncOpt::default(); + let raw_target_dir = target_dir.to_path_buf(); let target_dir = mk_arch_mode_dir( source_dir.as_path(), target_dir.as_path(), @@ -82,10 +83,18 @@ pub fn run_info(cli: UniversalFlags, cmd: InfoSubcommand) -> anyhow::Result } let moonbuild_opt = MoonbuildOpt { source_dir: source_dir.clone(), + raw_target_dir, target_dir: target_dir.clone(), sort_input: false, run_mode: RunMode::Check, - ..Default::default() + test_opt: None, + fmt_opt: None, + args: vec![], + verbose: cli.verbose, + quiet: cli.quiet, + output_json: false, + no_parallelize: false, + build_graph: false, }; let module = moonutil::scan::scan( @@ -107,11 +116,7 @@ pub fn run_info(cli: UniversalFlags, cmd: InfoSubcommand) -> anyhow::Result &resolved_env, &dir_sync_result, &moonc_opt, - &MoonbuildOpt { - source_dir: source_dir.clone(), - target_dir, - ..Default::default() - }, + &moonbuild_opt, )?; let runtime = tokio::runtime::Runtime::new()?; diff --git a/crates/moon/src/cli/run.rs b/crates/moon/src/cli/run.rs index 4fbe01e2..00f3ee4e 100644 --- a/crates/moon/src/cli/run.rs +++ b/crates/moon/src/cli/run.rs @@ -226,6 +226,7 @@ pub fn run_run_internal(cli: &UniversalFlags, cmd: RunSubcommand) -> anyhow::Res let mut moonc_opt = super::get_compiler_flags(&source_dir, &cmd.build_flags)?; let run_mode = RunMode::Run; + let raw_target_dir = target_dir.to_path_buf(); let target_dir = mk_arch_mode_dir(&source_dir, &target_dir, &moonc_opt, run_mode)?; let _lock = FileLock::lock(&target_dir)?; @@ -260,6 +261,7 @@ pub fn run_run_internal(cli: &UniversalFlags, cmd: RunSubcommand) -> anyhow::Res } let moonbuild_opt = MoonbuildOpt { source_dir, + raw_target_dir, target_dir, sort_input, run_mode, @@ -267,7 +269,10 @@ pub fn run_run_internal(cli: &UniversalFlags, cmd: RunSubcommand) -> anyhow::Res quiet: true, verbose: cli.verbose, build_graph: cli.build_graph, - ..Default::default() + test_opt: None, + fmt_opt: None, + output_json: false, + no_parallelize: false, }; let module = moonutil::scan::scan( diff --git a/crates/moon/src/cli/test.rs b/crates/moon/src/cli/test.rs index bdb05dd7..c1b09f52 100644 --- a/crates/moon/src/cli/test.rs +++ b/crates/moon/src/cli/test.rs @@ -162,6 +162,7 @@ fn run_test_internal( moonc_opt.link_opt.debug_flag = !cmd.release; let run_mode = RunMode::Test; + let raw_target_dir = target_dir.to_path_buf(); let target_dir = mk_arch_mode_dir(source_dir, target_dir, &moonc_opt, run_mode)?; let _lock = FileLock::lock(&target_dir)?; @@ -180,6 +181,7 @@ fn run_test_internal( let filter_index = cmd.index; let moonbuild_opt = MoonbuildOpt { source_dir: source_dir.to_path_buf(), + raw_target_dir, target_dir: target_dir.clone(), test_opt: Some(TestOpt { filter_package: filter_package.clone(), @@ -195,7 +197,9 @@ fn run_test_internal( verbose: cli.verbose, no_parallelize: cmd.no_parallelize, build_graph: cli.build_graph, - ..Default::default() + fmt_opt: None, + args: vec![], + output_json: false, }; let mut module = moonutil::scan::scan( diff --git a/crates/moonutil/src/common.rs b/crates/moonutil/src/common.rs index cd8254f2..85e601ee 100644 --- a/crates/moonutil/src/common.rs +++ b/crates/moonutil/src/common.rs @@ -343,9 +343,10 @@ impl LinkCoreFlags { } } -#[derive(Debug, Clone, Default)] +#[derive(Debug, Clone)] pub struct MoonbuildOpt { pub source_dir: PathBuf, + pub raw_target_dir: PathBuf, pub target_dir: PathBuf, pub test_opt: Option, pub sort_input: bool,