lux_cli/
build.rs

1use clap::Args;
2use eyre::Result;
3use lux_lib::{
4    config::Config,
5    lockfile::LocalPackage,
6    operations::{self},
7    project::Project,
8};
9
10#[derive(Args, Default)]
11pub struct Build {
12    /// Ignore the project's lockfile and don't create one.
13    #[arg(long)]
14    no_lock: bool,
15
16    /// Build only the dependencies
17    #[arg(long)]
18    only_deps: bool,
19}
20
21/// Returns `Some` if the `only_deps` arg is set to `false`.
22pub async fn build(data: Build, config: Config) -> Result<Option<LocalPackage>> {
23    let project = Project::current_or_err()?;
24    let result = operations::BuildProject::new(&project, &config)
25        .no_lock(data.no_lock)
26        .only_deps(data.only_deps)
27        .build()
28        .await?;
29    Ok(result)
30}