Skip to content

Commit bc7ef85

Browse files
committed
feat(build): add --force arg to force rebuild a package
1 parent 41cead3 commit bc7ef85

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

src/commands/main.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::{
66
};
77

88
use flintpkg::{
9-
build::build,
9+
build::{build, force_build},
1010
chunks::{utils::clean_unused, verify_all_chunks},
1111
repo::{
1212
PackageManifest, get_package, read_manifest,
@@ -21,10 +21,15 @@ pub async fn build_cmd(
2121
repo_name: &str,
2222
build_manifest_path: &Path,
2323
chunk_store_path: &Path,
24+
force: bool,
2425
) -> Result<()> {
2526
let repo_path = resolve_repo(base_path, repo_name)?;
2627

27-
build(build_manifest_path, &repo_path, None, chunk_store_path).await?;
28+
if force {
29+
force_build(build_manifest_path, &repo_path, None, chunk_store_path).await?;
30+
} else {
31+
build(build_manifest_path, &repo_path, None, chunk_store_path).await?;
32+
}
2833

2934
clean_unused(base_path, chunk_store_path)?;
3035

src/commands/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,14 @@ pub async fn main_commands(
3232
Command::Build {
3333
build_manifest_path,
3434
repo_name,
35+
force,
3536
} => {
3637
build_cmd(
3738
base_path,
3839
&repo_name,
3940
&build_manifest_path,
4041
chunk_store_path,
42+
force,
4143
)
4244
.await?;
4345
}

src/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ enum Command {
4444
Build {
4545
build_manifest_path: PathBuf,
4646
repo_name: String,
47+
#[arg(long, short)]
48+
force: bool,
4749
},
4850
/// Install a package
4951
Install {

0 commit comments

Comments
 (0)