diff --git a/crate_universe/src/cli/generate.rs b/crate_universe/src/cli/generate.rs index 4ec2638bb4..c7a3105528 100644 --- a/crate_universe/src/cli/generate.rs +++ b/crate_universe/src/cli/generate.rs @@ -119,9 +119,12 @@ pub fn generate(opt: GenerateOptions) -> Result<()> { // Write the outputs to disk write_outputs(normalized_outputs, opt.dry_run)?; + let splicing_manifest = SplicingManifest::try_from_path(&opt.splicing_manifest)?; + write_paths_to_track( &opt.paths_to_track, &opt.warnings_output_path, + splicing_manifest.manifests.keys(), context .crates .values() @@ -164,9 +167,12 @@ pub fn generate(opt: GenerateOptions) -> Result<()> { &opt.nonhermetic_root_bazel_workspace_dir, )?; + let splicing_manifest = SplicingManifest::try_from_path(&opt.splicing_manifest)?; + write_paths_to_track( &opt.paths_to_track, &opt.warnings_output_path, + splicing_manifest.manifests.keys(), annotations.lockfile.crates.values(), cargo_lockfile.patch.unused.iter(), )?; @@ -189,8 +195,6 @@ pub fn generate(opt: GenerateOptions) -> Result<()> { // Ensure Bazel lockfiles are written to disk so future generations can be short-circuited. if let Some(lockfile) = opt.lockfile { - let splicing_manifest = SplicingManifest::try_from_path(&opt.splicing_manifest)?; - let lock_content = lock_context(context, &config, &splicing_manifest, &cargo_bin, rustc_bin)?; @@ -220,10 +224,12 @@ fn update_cargo_lockfile(path: &Path, cargo_lockfile: Lockfile) -> Result<()> { fn write_paths_to_track< 'a, SourceAnnotations: Iterator, + Paths: Iterator, UnusedPatches: Iterator, >( output_file: &Path, warnings_output_path: &Path, + manifests: Paths, source_annotations: SourceAnnotations, unused_patches: UnusedPatches, ) -> Result<()> { @@ -235,6 +241,7 @@ fn write_paths_to_track< None } }) + .chain(manifests) .collect(); std::fs::write( output_file,