Allow excluding dev inside binary packages

This commit is contained in:
Wildan M 2026-02-13 17:01:15 +07:00
parent 805cf349cc
commit 45b72dbbb4
No known key found for this signature in database
GPG Key ID: 01AC53185C679C79

View File

@ -576,6 +576,26 @@ fn parse_args(args: Vec<String>) -> anyhow::Result<(CliConfig, CliCommand, Vec<C
if command.is_building() || (command.is_pushing() && config.with_package_deps) {
// Pushing do not need dev deps, so does binary recipes at building
let include_dev = command.is_building();
if include_dev && default_rule == "source" {
// let's cover a very specific case, binary -> source -> binary -> dev
// in this case, we need to move that "source" to "binary", because
// that would include dev from its binary child, which is unnecessary
let mut i = 0;
while i < source_recipe_names.len() {
let name = &source_recipe_names[i];
match special_rules.get(name) {
Some(s) if s.as_str() == "source" => {
if binary_names.contains(name) {
let bin = source_recipe_names.remove(i);
binary_recipe_names.push(bin);
continue;
}
}
_ => {}
}
i += 1;
}
}
CookRecipe::get_build_deps_recursive(&source_recipe_names, include_dev)?
} else {
CookRecipe::from_list(source_recipe_names.clone())?