pub fn build<'a>(
metadata: &'a Metadata,
package: Option<&Package>,
target: Option<&Target>,
profile: Option<&str>,
use_cross: bool,
target_triple: Option<&str>
) -> Result<impl Iterator<Item = Result<Utf8PathBuf>> + 'a>Expand description
Executes a cargo build command and returns paths to the build artifacts.
Examples
// executes cargo build
let workspace = cli_xtask::workspace::current();
for bin in cli_xtask::cargo::build(workspace, None, None, None, false, None)? {
let bin = bin?;
println!("{bin}");
}
// executes cross build --profile target --bin foo --target aarch64-unknown-linux-gnu
let workspace = cli_xtask::workspace::current();
let package = workspace.root_package().unwrap();
let target = package.targets.iter().find(|t| t.name == "foo").unwrap();
for bin in cli_xtask::cargo::build(
workspace,
Some(&package),
Some(target),
Some("release"),
true,
Some("aarch64-unknown-linux-gnu"),
)? {
let bin = bin?;
println!("{bin}");
}