Skip to content

Commit

Permalink
Warn less (#3145)
Browse files Browse the repository at this point in the history
We were accidentally warning on all of the paths to track, where we
should only be warning on the _external_ paths to track.
  • Loading branch information
illicitonion authored Dec 30, 2024
1 parent c06feef commit cdfb735
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions crate_universe/src/cli/generate.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! The cli entrypoint for the `generate` subcommand
use std::collections::BTreeSet;
use std::fs;
use std::path::{Path, PathBuf};
use std::sync::Arc;
Expand Down Expand Up @@ -233,14 +234,18 @@ fn write_paths_to_track<
source_annotations: SourceAnnotations,
unused_patches: UnusedPatches,
) -> Result<()> {
let paths_to_track: std::collections::BTreeSet<_> = source_annotations
let source_annotation_manifests: BTreeSet<_> = source_annotations
.filter_map(|v| {
if let SourceAnnotation::Path { path } = v {
Some(path.join("Cargo.toml"))
} else {
None
}
})
.collect();
let paths_to_track: BTreeSet<_> = source_annotation_manifests
.iter()
.cloned()
.chain(manifests)
.collect();
std::fs::write(
Expand All @@ -250,8 +255,8 @@ fn write_paths_to_track<
.context("Failed to write paths to track")?;

let mut warnings = Vec::new();
for path_to_track in &paths_to_track {
warnings.push(format!("Build is not hermetic - path dependency pulling in crate at {path_to_track} is being used."));
for source_annotation_manifest in &source_annotation_manifests {
warnings.push(format!("Build is not hermetic - path dependency pulling in crate at {source_annotation_manifest} is being used."));
}
for unused_patch in unused_patches {
warnings.push(format!("You have a [patch] Cargo.toml entry that is being ignored by cargo. Unused patch: {} {}{}", unused_patch.name, unused_patch.version, if let Some(source) = unused_patch.source.as_ref() { format!(" ({})", source) } else { String::new() }));
Expand Down

0 comments on commit cdfb735

Please sign in to comment.