From a907fa1cd892064a6057e0cbae849907beef010a Mon Sep 17 00:00:00 2001 From: Weicao-CatilGrass <1992414357@qq.com> Date: Sat, 27 Dec 2025 20:28:16 +0800 Subject: fix: Remove Windows installer script generation from build.rs --- build.rs | 64 ---------------------------------------------------------------- 1 file changed, 64 deletions(-) diff --git a/build.rs b/build.rs index e215418..04fcd71 100644 --- a/build.rs +++ b/build.rs @@ -7,76 +7,12 @@ const COMPILE_INFO_RS_TEMPLATE: &str = "./src/data/compile_info.rs.template"; fn main() { let repo_root = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()); - // Only generate installer script on Windows - if cfg!(target_os = "windows") { - if let Err(e) = generate_installer_script(&repo_root) { - eprintln!("Failed to generate installer script: {}", e); - std::process::exit(1); - } - } - if let Err(e) = generate_compile_info(&repo_root) { eprintln!("Failed to generate compile info: {}", e); std::process::exit(1); } } -/// Generate Inno Setup installer script (Windows only) -fn generate_installer_script(repo_root: &PathBuf) -> Result<(), Box> { - let template_path = repo_root.join("setup/windows/setup_jv_cli_template.iss"); - let output_path = repo_root.join("setup/windows/setup_jv_cli.iss"); - - let template = std::fs::read_to_string(&template_path)?; - - let author = get_author()?; - let version = get_version(); - let site = get_site()?; - - let generated = template - .replace("<<>>", &author) - .replace("<<>>", &version) - .replace("<<>>", &site); - - std::fs::write(output_path, generated)?; - Ok(()) -} - -fn get_author() -> Result> { - let cargo_toml_path = std::path::Path::new("Cargo.toml"); - let cargo_toml_content = std::fs::read_to_string(cargo_toml_path)?; - let cargo_toml: toml::Value = toml::from_str(&cargo_toml_content)?; - - if let Some(package) = cargo_toml.get("package") { - if let Some(authors) = package.get("authors") { - if let Some(authors_array) = authors.as_array() { - if let Some(first_author) = authors_array.get(0) { - if let Some(author_str) = first_author.as_str() { - return Ok(author_str.to_string()); - } - } - } - } - } - - Err("Author not found in Cargo.toml".into()) -} - -fn get_site() -> Result> { - let cargo_toml_path = std::path::Path::new("Cargo.toml"); - let cargo_toml_content = std::fs::read_to_string(cargo_toml_path)?; - let cargo_toml: toml::Value = toml::from_str(&cargo_toml_content)?; - - if let Some(package) = cargo_toml.get("package") { - if let Some(homepage) = package.get("homepage") { - if let Some(site_str) = homepage.as_str() { - return Ok(site_str.to_string()); - } - } - } - - Err("Homepage not found in Cargo.toml".into()) -} - /// Generate compile info fn generate_compile_info(repo_root: &PathBuf) -> Result<(), Box> { // Read the template code -- cgit