Skip to content

Commit

Permalink
add requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
KGB99 committed Aug 20, 2024
1 parent 73d6a7e commit a2783f0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 deletions.
7 changes: 3 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ 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 @@ -350,6 +349,7 @@ pub async fn get_build_output(
pub async fn run_build_from_args(
build_output: Vec<Output>,
tool_config: Configuration,
continue_on_fail: bool,
) -> miette::Result<()> {
let mut outputs: Vec<metadata::Output> = Vec::new();

Expand All @@ -361,11 +361,10 @@ pub async fn run_build_from_args(
}
Err(e) => {
tracing::error!("Error building package: {}", e);
if tool_config.cont_on_fail {
if continue_on_fail {
continue;
} else {
return Err(e);
}
return Err(e);
}
};
outputs.push(output);
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ async fn main() -> miette::Result<()> {
}

sort_build_outputs_topologically(&mut outputs, build_args.up_to.as_deref())?;
run_build_from_args(outputs, tool_config).await?;
run_build_from_args(outputs, tool_config, build_args.continue_on_fail).await?;
}
Ok(())
}
Expand Down
4 changes: 2 additions & 2 deletions src/opt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,8 @@ pub struct BuildOpts {

/// 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,
#[arg(long, default_value = "false", requires="recipe_dir")]
pub continue_on_fail: bool,
}

fn is_dir(dir: &str) -> Result<PathBuf, String> {
Expand Down
4 changes: 0 additions & 4 deletions src/tool_configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ 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 @@ -111,7 +108,6 @@ 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 a2783f0

Please sign in to comment.