Skip to content

Commit

Permalink
begin adding cont_on_fail option
Browse files Browse the repository at this point in the history
  • Loading branch information
KGB99 committed Aug 20, 2024
1 parent a28628b commit 73d6a7e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ pub fn get_tool_config(
use_bz2: args.common.use_bz2,
render_only: args.render_only,
skip_existing: args.skip_existing,
cont_on_fail: args.cont_on_fail,
..Configuration::default()
})
}
Expand Down Expand Up @@ -360,7 +361,11 @@ pub async fn run_build_from_args(
}
Err(e) => {
tracing::error!("Error building package: {}", e);
return Err(e);
if tool_config.cont_on_fail {
continue;
} else {
return Err(e);
}
}
};
outputs.push(output);
Expand Down
5 changes: 5 additions & 0 deletions src/opt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,11 @@ pub struct BuildOpts {
/// Extra metadata to include in about.json
#[arg(long, value_parser = parse_key_val)]
pub extra_meta: Option<Vec<(String, Value)>>,

/// Whether to continue building upon the failure of one recipe
/// Only relevant when building multiple recipes with `--recipe-dir`
#[arg(long, default_value = "false")]
pub cont_on_fail: bool,
}

fn is_dir(dir: &str) -> Result<PathBuf, String> {
Expand Down
4 changes: 4 additions & 0 deletions src/tool_configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ pub struct Configuration {
/// Whether to skip existing packages
pub skip_existing: SkipExisting,

/// Whether to continue building on failure of a package
pub cont_on_fail: bool,

/// The channel configuration to use when parsing channels.
pub channel_config: ChannelConfig,

Expand Down Expand Up @@ -108,6 +111,7 @@ impl Default for Configuration {
use_bz2: true,
render_only: false,
skip_existing: SkipExisting::None,
cont_on_fail: false,
channel_config: ChannelConfig::default_with_root_dir(
std::env::current_dir().unwrap_or_else(|_err| PathBuf::from("/")),
),
Expand Down

0 comments on commit 73d6a7e

Please sign in to comment.