From 828b49cb3b4e3e46052c676c1e5620f6bb53e563 Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Sun, 19 May 2024 09:47:07 +0800 Subject: [PATCH] Allow skipping existing versions --- tools/codegen/src/main.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/codegen/src/main.rs b/tools/codegen/src/main.rs index b4377d77b..2d00371c1 100644 --- a/tools/codegen/src/main.rs +++ b/tools/codegen/src/main.rs @@ -31,6 +31,7 @@ fn main() -> Result<()> { std::process::exit(1); } let package = &args[0]; + let skip_existing_manifest_versions = std::env::var("SKIP_EXISTING_MANIFEST_VERSIONS").is_ok(); let workspace_root = &workspace_root(); let manifest_path = &workspace_root.join("manifests").join(format!("{package}.json")); @@ -179,6 +180,13 @@ fn main() -> Result<()> { continue; } + let reverse_semver = Reverse(semver_version.clone().into()); + + if skip_existing_manifest_versions && manifests.map.contains_key(&reverse_semver) { + eprintln!("Skipping {semver_version} already in manifest"); + continue; + }; + let mut download_info = BTreeMap::new(); let mut pubkey = None; for (&platform, base_download_info) in &base_info.platform { @@ -357,10 +365,7 @@ fn main() -> Result<()> { if semver_version.pre.is_empty() { semver_versions.insert(semver_version.clone()); } - manifests.map.insert( - Reverse(semver_version.clone().into()), - ManifestRef::Real(Manifest { download_info }), - ); + manifests.map.insert(reverse_semver, ManifestRef::Real(Manifest { download_info })); } if has_build_metadata { eprintln!(