Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development CLI: Remove targets record file on Clean. #2231

Merged
merged 1 commit into from
Feb 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cli/development-cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 0.4.1

## Changes:

* Clean command removes checksum records entirely, making it more reliable.

# 0.4.0

## Changes:
Expand Down
2 changes: 1 addition & 1 deletion cli/development-cli/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cli/development-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cargo-chipmunk"
version = "0.4.0"
version = "0.4.1"
authors = ["Ammar Abou Zor <[email protected]>"]
edition = "2021"
description = "CLI Tool for chipmunk application development"
Expand Down
9 changes: 0 additions & 9 deletions cli/development-cli/src/build_state_records.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,15 +259,6 @@ impl BuildStateRecords {
})
}

/// Remove the target from the states records
pub fn remove_state_if_exist(&mut self, target: Target) -> anyhow::Result<()> {
self.involved_targets.insert(target);

self.states.remove(&target);

Ok(())
}

/// Clears the states from previous build then calculates the states for the involved targets.
fn update_records(&mut self) -> anyhow::Result<()> {
self.states.clear();
Expand Down
2 changes: 2 additions & 0 deletions cli/development-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ async fn main_process(command: Command) -> Result<(), Error> {
JobsState::init(JobsConfig::new(false));
init_tracker(ui_mode);
validate_dev_tools()?;

BuildStateRecords::remove_records_file()?;
let targets = get_targets_or_all(target);
let results = jobs_runner::run(&targets, JobType::Clean).await?;
(JobType::Clean, results)
Expand Down
10 changes: 0 additions & 10 deletions cli/development-cli/src/target/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use std::{borrow::Cow, collections::BTreeSet, fmt::Display, iter, path::PathBuf,
use tokio::fs;

use crate::{
build_state_records::BuildStateRecords,
dev_tools::DevTool,
fstools,
job_type::JobType,
Expand Down Expand Up @@ -515,15 +514,6 @@ impl Target {
pub async fn reset(&self) -> anyhow::Result<SpawnResult> {
let job_def = JobDefinition::new(*self, JobType::Clean);

{
// Clean doesn't differentiate between development and production, and both of them will be
// cleaned from the files when the data are persisted.
let mut checksum = BuildStateRecords::get(false)?.lock().map_err(|err| {
anyhow::anyhow!("Error while acquiring items jobs mutex: Error {err}")
})?;
checksum.remove_state_if_exist(*self)?;
}

let mut paths_to_remove = vec![self.cwd().join("dist")];
let path = match self.kind() {
TargetKind::Ts => self.cwd().join("node_modules"),
Expand Down
Loading