Skip to content

Commit

Permalink
refactor: properly cleanup directories and exit if there are actually…
Browse files Browse the repository at this point in the history
… no dependencies

Signed-off-by: Soc Virnyl Estela <[email protected]>
  • Loading branch information
uncomfyhalomacro committed Nov 6, 2024
1 parent aaa627d commit 5c5ff9f
Show file tree
Hide file tree
Showing 3 changed files with 327 additions and 243 deletions.
8 changes: 3 additions & 5 deletions cargo/src/cargo_commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use tracing::{debug, error, info, trace, warn, Level};
use crate::audit;
use crate::vendor::has_dependencies;
use crate::vendor::is_workspace;
use crate::vendor::workspace_has_dependencies;

fn cargo_command(
subcommand: &str,
Expand Down Expand Up @@ -47,10 +48,7 @@ pub fn cargo_fetch(curdir: &Path, manifest: &str, mut update: bool) -> io::Resul
if possible_lockfile.is_file() {
default_options.push("--locked".to_string());
} else {
warn!(
"⚠️ No lockfile present. This might UPDATE your dependencies. Overriding `update` from \
false to true."
);
warn!("⚠️ No lockfile present. This might UPDATE your dependencies. Overriding `update` from false to true.");
update = true;
}
}
Expand Down Expand Up @@ -121,7 +119,7 @@ pub fn cargo_vendor(

if is_workspace {
info!("ℹ️ This project is a WORKSPACE configuration.");
if !has_deps {
if !workspace_has_dependencies(&first_manifest)? {
warn!("⚠️ The WORKSPACE MANIFEST does not seem to contain workspace dependencies and dev-dependencies. Please check member dependencies.");
}
} else if !has_deps {
Expand Down
Loading

0 comments on commit 5c5ff9f

Please sign in to comment.