diff --git a/src/command.rs b/src/command.rs index 78164ee..f06f6e7 100644 --- a/src/command.rs +++ b/src/command.rs @@ -162,7 +162,7 @@ pub struct New { impl CargoCmd { /// Returns the additional arguments run by the "official" cargo subcommand. - pub fn cargo_args(&self) -> Vec { + pub(crate) fn cargo_args(&self) -> Vec { match self { CargoCmd::Build(build) => build.passthrough.cargo_args(), CargoCmd::Run(run) => run.build_args.passthrough.cargo_args(), @@ -185,7 +185,7 @@ impl CargoCmd { /// This is not equivalent to the lowercase name of the [`CargoCmd`] variant. /// Commands may use different commands under the hood to function (e.g. [`CargoCmd::Run`] uses `build` /// if no custom runner is configured). - pub fn subcommand_name(&self) -> &str { + pub(crate) fn subcommand_name(&self) -> &str { match self { CargoCmd::Build(_) => "build", CargoCmd::Run(run) => { @@ -202,7 +202,7 @@ impl CargoCmd { } /// Whether or not this command should compile any code, and thus needs import the custom environment configuration (e.g. target spec). - pub fn should_compile(&self) -> bool { + pub(crate) fn should_compile(&self) -> bool { matches!( self, Self::Build(_) | Self::Run(_) | Self::Test(_) | Self::Passthrough(_) @@ -384,12 +384,12 @@ impl Callbacks for CargoCmd { impl RemainingArgs { /// Get the args to be passed to `cargo`. - pub fn cargo_args(&self) -> Vec { + pub(crate) fn cargo_args(&self) -> Vec { self.split_args().0 } /// Get the args to be passed to the executable itself (not `cargo`). - pub fn exe_args(&self) -> Vec { + pub(crate) fn exe_args(&self) -> Vec { self.split_args().1 } @@ -439,7 +439,7 @@ impl Callbacks for Run { impl Run { /// Get the args to pass to `3dslink` based on these options. - pub fn get_3dslink_args(&self) -> Vec { + pub(crate) fn get_3dslink_args(&self) -> Vec { let mut args = Vec::new(); if let Some(address) = self.address { @@ -487,7 +487,7 @@ impl Run { /// - `.cargo/config.toml` /// - Environment variables /// - Command-line `--config` overrides - pub fn use_custom_runner(&self) -> bool { + pub(crate) fn use_custom_runner(&self) -> bool { static HAS_RUNNER: OnceLock = OnceLock::new(); let &custom_runner_configured = HAS_RUNNER.get_or_init(|| { diff --git a/src/graph.rs b/src/graph.rs index 67e5cc8..1209d81 100644 --- a/src/graph.rs +++ b/src/graph.rs @@ -23,7 +23,7 @@ impl UnitGraph { /// build and the graph is output instead. /// /// See . - pub fn from_cargo(cargo_cmd: &Command, verbose: bool) -> Result> { + pub(crate) fn from_cargo(cargo_cmd: &Command, verbose: bool) -> Result> { // Since Command isn't Clone, copy it "by hand", by copying its args and envs let mut cmd = Command::new(cargo_cmd.get_program()); diff --git a/src/lib.rs b/src/lib.rs index 43d2753..cc9ab00 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -107,7 +107,7 @@ fn should_use_ctru_debuginfo(cargo_cmd: &Command, verbose: bool) -> bool { /// /// For "build" commands (which compile code, such as `cargo 3ds build` or `cargo 3ds clippy`), /// if there is no pre-built std detected in the sysroot, `build-std` will be used instead. -pub fn make_cargo_command(input: &Input, message_format: &Option) -> Command { +pub(crate) fn make_cargo_command(input: &Input, message_format: &Option) -> Command { let devkitpro = env::var("DEVKITPRO").expect("DEVKITPRO is not defined as an environment variable"); // TODO: should we actually prepend the user's RUSTFLAGS for linking order? not sure @@ -195,7 +195,7 @@ fn print_command(command: &Command) { } /// Finds the sysroot path of the current toolchain -pub fn find_sysroot() -> PathBuf { +pub(crate) fn find_sysroot() -> PathBuf { let sysroot = env::var("SYSROOT").ok().unwrap_or_else(|| { let rustc = env::var("RUSTC").unwrap_or_else(|_| "rustc".to_string()); @@ -253,7 +253,7 @@ pub fn check_rust_version(input: &Input) { /// Parses messages returned by "build" cargo commands (such as `cargo 3ds build` or `cargo 3ds run`). /// The returned [`CTRConfig`] is then used for further building in and execution /// in [`CTRConfig::build_smdh`], [`build_3dsx`], and [`link`]. -pub fn get_artifact_config(package: Package, artifact: Artifact) -> CTRConfig { +pub(crate) fn get_artifact_config(package: Package, artifact: Artifact) -> CTRConfig { // For now, assume a single "kind" per artifact. It seems to be the case // when a single executable is built anyway but maybe not in all cases. let name = match artifact.target.kind[0].as_ref() { @@ -287,7 +287,7 @@ pub fn get_artifact_config(package: Package, artifact: Artifact) -> CTRConfig { /// Builds the 3dsx using `3dsxtool`. /// This will fail if `3dsxtool` is not within the running directory or in a directory found in $PATH -pub fn build_3dsx(config: &CTRConfig, verbose: bool) { +pub(crate) fn build_3dsx(config: &CTRConfig, verbose: bool) { let mut command = Command::new("3dsxtool"); command .arg(&config.target_path) @@ -323,7 +323,7 @@ pub fn build_3dsx(config: &CTRConfig, verbose: bool) { /// Link the generated 3dsx to a 3ds to execute and test using `3dslink`. /// This will fail if `3dslink` is not within the running directory or in a directory found in $PATH -pub fn link(config: &CTRConfig, run_args: &Run, verbose: bool) { +pub(crate) fn link(config: &CTRConfig, run_args: &Run, verbose: bool) { let mut command = Command::new("3dslink"); command .arg(config.path_3dsx()) @@ -380,17 +380,17 @@ pub struct CTRConfig { impl CTRConfig { /// Get the path to the output `.3dsx` file. - pub fn path_3dsx(&self) -> Utf8PathBuf { + pub(crate) fn path_3dsx(&self) -> Utf8PathBuf { self.target_path.with_extension("3dsx") } /// Get the path to the output `.smdh` file. - pub fn path_smdh(&self) -> Utf8PathBuf { + pub(crate) fn path_smdh(&self) -> Utf8PathBuf { self.target_path.with_extension("smdh") } /// Get the absolute path to the romfs directory, defaulting to `romfs` if not specified. - pub fn romfs_dir(&self) -> Utf8PathBuf { + pub(crate) fn romfs_dir(&self) -> Utf8PathBuf { self.manifest_dir .join(self.romfs_dir.as_deref().unwrap_or(Utf8Path::new("romfs"))) } @@ -401,7 +401,7 @@ impl CTRConfig { /// Builds the smdh using `smdhtool`. /// This will fail if `smdhtool` is not within the running directory or in a directory found in $PATH - pub fn build_smdh(&self, verbose: bool) { + pub(crate) fn build_smdh(&self, verbose: bool) { let description = self .description .as_deref()