diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b2f73ab..f2470b6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,7 +43,7 @@ jobs: matrix: toolchain: # Oldest supported nightly - - nightly-2023-06-01 + - nightly-2024-02-18 - nightly continue-on-error: ${{ matrix.toolchain == 'nightly' }} diff --git a/Cargo.lock b/Cargo.lock index 701f000..a9aadc2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -271,9 +271,9 @@ dependencies = [ [[package]] name = "shlex" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "strsim" diff --git a/Cargo.toml b/Cargo.toml index de30cce..29efea0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,5 +18,5 @@ serde = { version = "1.0.139", features = ["derive"] } tee = "0.1.0" toml = "0.5.6" clap = { version = "4.0.15", features = ["derive", "wrap_help"] } -shlex = "1.1.0" +shlex = "1.3.0" serde_json = "1.0.108" diff --git a/src/command.rs b/src/command.rs index 02f998f..abeeeb5 100644 --- a/src/command.rs +++ b/src/command.rs @@ -555,9 +555,11 @@ impl New { let toml_path = project_path.join("Cargo.toml"); let romfs_path = project_path.join("romfs"); let main_rs_path = project_path.join("src/main.rs"); + let dummy_romfs_path = romfs_path.join("PUT_YOUR_ROMFS_FILES_HERE.txt"); - // Create the "romfs" directory + // Create the "romfs" directory, and place a dummy file within it. fs::create_dir(romfs_path).unwrap(); + fs::File::create(dummy_romfs_path).unwrap(); // Read the contents of `Cargo.toml` to a string let mut buf = String::new(); diff --git a/src/lib.rs b/src/lib.rs index 4d5b47a..5b6cb5c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -25,6 +25,7 @@ use crate::graph::UnitGraph; pub fn run_cargo(input: &Input, message_format: Option) -> (ExitStatus, Vec) { let mut command = make_cargo_command(input, &message_format); + // The unit graph is needed only when compiling a program. if input.cmd.should_compile() { let libctru = if should_use_ctru_debuginfo(&command, input.verbose) { "ctrud" @@ -184,10 +185,13 @@ fn print_command(command: &Command) { eprintln!( " {}={} \\", k.to_string_lossy(), - v.map_or_else(String::new, |s| shlex::quote(&s).to_string()) + v.map_or_else(String::new, |s| shlex::try_quote(&s).unwrap().to_string()) ); } - eprintln!(" {}\n", shlex::join(cmd_str.iter().map(String::as_str))); + eprintln!( + " {}\n", + shlex::try_join(cmd_str.iter().map(String::as_str)).unwrap() + ); } /// Finds the sysroot path of the current toolchain @@ -208,11 +212,13 @@ pub fn find_sysroot() -> PathBuf { /// Checks the current rust version and channel. /// Exits if the minimum requirement is not met. -pub fn check_rust_version() { +pub fn check_rust_version(input: &Input) { let rustc_version = rustc_version::version_meta().unwrap(); - if rustc_version.channel > Channel::Nightly { - eprintln!("cargo-3ds requires a nightly rustc version."); + // If the channel isn't nightly, we can't make use of the required unstable tools. + // However, `cargo 3ds new` doesn't have these requirements. + if rustc_version.channel > Channel::Nightly && input.cmd.should_compile() { + eprintln!("building with cargo-3ds requires a nightly rustc version."); eprintln!( "Please run `rustup override set nightly` to use nightly in the \ current directory, or use `cargo +nightly 3ds` to use it for a \ diff --git a/src/main.rs b/src/main.rs index 022e635..d43bf57 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,10 +5,11 @@ use cargo_3ds::{check_rust_version, run_cargo}; use clap::Parser; fn main() { - check_rust_version(); - let Cargo::Input(mut input) = Cargo::parse(); + // Depending on the command, we might have different base requirements for the Rust version. + check_rust_version(&input); + let message_format = match input.cmd.extract_message_format() { Ok(fmt) => fmt, Err(msg) => {