|
@@ -6,7 +6,7 @@ use std::{fs::write, path::PathBuf};
|
|
|
|
|
|
use anyhow::{Context, Result};
|
|
|
use semver::Version;
|
|
|
-use tauri_utils::config::Config;
|
|
|
+use tauri_utils::{config::Config, write_if_changed};
|
|
|
|
|
|
use crate::is_dev;
|
|
|
|
|
@@ -80,20 +80,25 @@ dependencies {"
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- write(&gradle_settings_path, gradle_settings).context("failed to write tauri.settings.gradle")?;
|
|
|
+ // Overwrite only if changed to not trigger rebuilds
|
|
|
+ write_if_changed(&gradle_settings_path, gradle_settings)
|
|
|
+ .context("failed to write tauri.settings.gradle")?;
|
|
|
|
|
|
- write(&app_build_gradle_path, app_build_gradle)
|
|
|
+ write_if_changed(&app_build_gradle_path, app_build_gradle)
|
|
|
.context("failed to write tauri.build.gradle.kts")?;
|
|
|
|
|
|
if !app_tauri_properties.is_empty() {
|
|
|
- write(
|
|
|
- &app_tauri_properties_path,
|
|
|
- format!(
|
|
|
- "// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.\n{}",
|
|
|
- app_tauri_properties.join("\n")
|
|
|
- ),
|
|
|
- )
|
|
|
- .context("failed to write tauri.properties")?;
|
|
|
+ let app_tauri_properties_content = format!(
|
|
|
+ "// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.\n{}",
|
|
|
+ app_tauri_properties.join("\n")
|
|
|
+ );
|
|
|
+ if std::fs::read_to_string(&app_tauri_properties_path)
|
|
|
+ .map(|o| o != app_tauri_properties_content)
|
|
|
+ .unwrap_or(true)
|
|
|
+ {
|
|
|
+ write(&app_tauri_properties_path, app_tauri_properties_content)
|
|
|
+ .context("failed to write tauri.properties")?;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
println!("cargo:rerun-if-changed={}", gradle_settings_path.display());
|