Skip to content

Commit

Permalink
Merge pull request #168 from boozook/cargo/meta-info
Browse files Browse the repository at this point in the history
Add option to allow opt-out meta info file
  • Loading branch information
boozook authored Oct 6, 2023
2 parents b175d2e + 22c5c09 commit e6ef141
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 25 deletions.
38 changes: 19 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cargo/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cargo-playdate"
version = "0.3.7"
version = "0.3.8"
readme = "README.md"
description = "Build tool for neat yellow console."
keywords = ["playdate", "build", "cargo", "plugin", "cargo-subcommand"]
Expand Down
2 changes: 2 additions & 0 deletions cargo/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ pub fn initialize_from(args: impl IntoIterator<Item = impl Into<OsString> + AsRe

// zip flag for package:
let zip = matches.flag("zip");
let no_info_meta = matches.flag("no-info-file");

// shorthand for panic behavior:
let prevent_unwinding = matches.flag("no-unwinding");
Expand Down Expand Up @@ -288,6 +289,7 @@ pub fn initialize_from(args: impl IntoIterator<Item = impl Into<OsString> + AsRe
mounting,
no_wait,
zip,
no_info_meta,
prevent_unwinding,
create_path,
create_full_config,
Expand Down
17 changes: 13 additions & 4 deletions cargo/src/cli/opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,16 @@ pub fn special_args_for(cmd: &Cmd) -> Vec<Arg> {
match cmd {
Cmd::Build => shorthands_for(cmd),
Cmd::Run => {
let mut vec = mount();
vec.append(&mut shorthands_for(cmd));
vec.push(flag_no_wait());
vec
let mut args = mount();
args.append(&mut shorthands_for(cmd));
args.push(flag_no_wait());
args.push(flag_no_info_file());
args
},
Cmd::Package => {
let mut args = special_args_for(&Cmd::Build);
args.push(flag_zip_package());
args.push(flag_no_info_file());
args
},
Cmd::Assets => vec![flag_pdc_skip_unknown()],
Expand Down Expand Up @@ -282,6 +284,13 @@ fn flag_zip_package() -> Arg {
.action(ArgAction::SetTrue)
}

fn flag_no_info_file() -> Arg {
let name = "no-info-file";
Arg::new(&name).long(&name)
.help(format!("Opt-out inclusion info file with builder version into the produced package"))
.action(ArgAction::SetTrue)
}

fn flag_no_unwinding() -> Arg {
let name = "no-unwinding";
const SHORT: &str =
Expand Down
3 changes: 3 additions & 0 deletions cargo/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ pub struct Config<'cfg> {
pub no_wait: bool,

pub zip: bool,
pub no_info_meta: bool,

pub prevent_unwinding: bool,

Expand Down Expand Up @@ -82,6 +83,7 @@ impl<'cfg> Config<'cfg> {
mounting: Option<Mount>,
no_wait: bool,
zip: bool,
no_info_meta: bool,
prevent_unwinding: bool,
create_path: Option<PathBuf>,
create_full_config: bool,
Expand All @@ -108,6 +110,7 @@ impl<'cfg> Config<'cfg> {
mounting,
no_wait,
zip,
no_info_meta,
prevent_unwinding,
create_path,
create_full_config,
Expand Down
4 changes: 3 additions & 1 deletion cargo/src/package/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ fn package_single_target<'p>(config: &Config,

// finally call pdc and pack:
let mut artifact = execute_pdc(config, &product.layout)?;
ar::add_info_meta(&artifact)?;
if !config.no_info_meta {
ar::add_info_meta(&artifact)?;
}
if config.zip {
artifact = ar::build(artifact)?;
}
Expand Down

0 comments on commit e6ef141

Please sign in to comment.