WDTZGPLRXG3N6UGLUQQUZ7V2ZSWD3J5RBIZNXL6AOTVKSRXRCT2AC let current_checksum = compute_checksum();let manifest_path = Utf8PathBuf::try_from(cargo_px_env::generated_pkg_manifest_path()?)?;let mut manifest = load_manifest(&manifest_path)?;let old_checksum = &mut manifest["package"]["metadata"]["px"]["source"]["checksum"];if let Some(old_checksum) = old_checksum.as_str() {if old_checksum == current_checksum {return Ok(());}}
let mut package_path = cargo_px_env::generated_pkg_manifest_path()?;package_path.pop();package_path.push("src");package_path.push("icu_data");package_path
let mut path = manifest_path.clone();path.pop();path.push("src");path.push("icu_data");path.canonicalize()?
}fn save_manifest(path: &Utf8Path, manifest: toml_edit::Document) -> Result<(), std::io::Error> {fs::write(path, manifest.to_string())}fn load_manifest(path: &Utf8Path) -> Result<toml_edit::Document, toml_edit::TomlError> {// Read the contents of the Cargo.toml filelet toml_content = fs::read_to_string(path).expect("Failed to read Cargo.toml");// Parse ittoml_content.parse::<toml_edit::Document>()}fn compute_checksum() -> String {let version_tag = format!("{}:{}",SourceData::LATEST_TESTED_CLDR_TAG,SourceData::LATEST_TESTED_ICUEXPORT_TAG);let current_checksum = xxhash_rust::xxh3::xxh3_128(version_tag.as_bytes());format!("{current_checksum:x}")
toml_edit.workspace = truexxhash-rust.workspace = true
[package.metadata.px.generate]# The generator is a binary in the current workspace.# It's the only generator type we support at the moment.generator_type = "cargo_workspace_binary"# The name of the binary.generator_name = "icu-data"[package.metadata.px.source]checksum = "396f9a15499d1e3de0eb8765ab1e3ce"
[package.metadata.px.generate]# The generator is a binary in the current workspace.# It's the only generator type we support at the moment.generator_type = "cargo_workspace_binary"# The name of the binary.generator_name = "icu-data"