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

codegen: Allow skipping existing versions #485

Merged
merged 1 commit into from
May 19, 2024
Merged
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
13 changes: 9 additions & 4 deletions tools/codegen/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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!(
Expand Down