Skip to content

Commit ceabc14

Browse files
committed
Dev CLI: Remove targets record file on clean.
Remove record file entirely on the start of an clean job instead of trying to update the record file, making clean command more reliable because updating the record file may fail more often than removing it.
1 parent 4c56636 commit ceabc14

File tree

6 files changed

+10
-21
lines changed

6 files changed

+10
-21
lines changed

cli/development-cli/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 0.4.1
2+
3+
## Changes:
4+
5+
* Clean command removes checksum records entirely, making it more reliable.
6+
17
# 0.4.0
28

39
## Changes:

cli/development-cli/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli/development-cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cargo-chipmunk"
3-
version = "0.4.0"
3+
version = "0.4.1"
44
authors = ["Ammar Abou Zor <ammar.abou.zor@accenture.com>"]
55
edition = "2021"
66
description = "CLI Tool for chipmunk application development"

cli/development-cli/src/build_state_records.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -259,15 +259,6 @@ impl BuildStateRecords {
259259
})
260260
}
261261

262-
/// Remove the target from the states records
263-
pub fn remove_state_if_exist(&mut self, target: Target) -> anyhow::Result<()> {
264-
self.involved_targets.insert(target);
265-
266-
self.states.remove(&target);
267-
268-
Ok(())
269-
}
270-
271262
/// Clears the states from previous build then calculates the states for the involved targets.
272263
fn update_records(&mut self) -> anyhow::Result<()> {
273264
self.states.clear();

cli/development-cli/src/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ async fn main_process(command: Command) -> Result<(), Error> {
152152
JobsState::init(JobsConfig::new(false));
153153
init_tracker(ui_mode);
154154
validate_dev_tools()?;
155+
156+
BuildStateRecords::remove_records_file()?;
155157
let targets = get_targets_or_all(target);
156158
let results = jobs_runner::run(&targets, JobType::Clean).await?;
157159
(JobType::Clean, results)

cli/development-cli/src/target/mod.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use std::{borrow::Cow, collections::BTreeSet, fmt::Display, iter, path::PathBuf,
99
use tokio::fs;
1010

1111
use crate::{
12-
build_state_records::BuildStateRecords,
1312
dev_tools::DevTool,
1413
fstools,
1514
job_type::JobType,
@@ -515,15 +514,6 @@ impl Target {
515514
pub async fn reset(&self) -> anyhow::Result<SpawnResult> {
516515
let job_def = JobDefinition::new(*self, JobType::Clean);
517516

518-
{
519-
// Clean doesn't differentiate between development and production, and both of them will be
520-
// cleaned from the files when the data are persisted.
521-
let mut checksum = BuildStateRecords::get(false)?.lock().map_err(|err| {
522-
anyhow::anyhow!("Error while acquiring items jobs mutex: Error {err}")
523-
})?;
524-
checksum.remove_state_if_exist(*self)?;
525-
}
526-
527517
let mut paths_to_remove = vec![self.cwd().join("dist")];
528518
let path = match self.kind() {
529519
TargetKind::Ts => self.cwd().join("node_modules"),

0 commit comments

Comments
 (0)