mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-11-24 12:14:05 +03:00
* fix: #7614: rebuild every time on macos because of Info.plist changes * apply proposed patch from lucasfernog * Update core/tauri-codegen/src/context.rs Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.app> * Update core/tauri-codegen/src/context.rs Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.app> * added changes file --------- Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.app>
This commit is contained in:
parent
7d85f7cf82
commit
1f6e478c84
5
.changes/fix-build-script-rerun-macos.md
Normal file
5
.changes/fix-build-script-rerun-macos.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"tauri-codegen": patch:bug
|
||||
---
|
||||
|
||||
Fixes Info.plist rewriting always triggering build to rerun.
|
@ -307,17 +307,23 @@ pub fn context_codegen(data: ContextData) -> EmbeddedAssetsResult<TokenStream> {
|
||||
}
|
||||
if let Some(version) = &config.version {
|
||||
plist.insert("CFBundleShortVersionString".into(), version.clone().into());
|
||||
}
|
||||
let format =
|
||||
time::format_description::parse("[year][month][day].[hour][minute][second]").unwrap();
|
||||
if let Ok(build_number) = time::OffsetDateTime::now_utc().format(&format) {
|
||||
plist.insert("CFBundleVersion".into(), build_number.into());
|
||||
plist.insert("CFBundleVersion".into(), version.clone().into());
|
||||
}
|
||||
}
|
||||
|
||||
let plist_file = out_dir.join("Info.plist");
|
||||
|
||||
let mut plist_contents = std::io::BufWriter::new(Vec::new());
|
||||
info_plist
|
||||
.to_file_xml(out_dir.join("Info.plist"))
|
||||
.expect("failed to write Info.plist");
|
||||
.to_writer_xml(&mut plist_contents)
|
||||
.expect("failed to serialize plist");
|
||||
let plist_contents =
|
||||
String::from_utf8_lossy(&plist_contents.into_inner().unwrap()).into_owned();
|
||||
|
||||
if plist_contents != std::fs::read_to_string(&plist_file).unwrap_or_default() {
|
||||
std::fs::write(&plist_file, &plist_contents).expect("failed to write Info.plist");
|
||||
}
|
||||
|
||||
quote!({
|
||||
tauri::embed_plist::embed_info_plist!(concat!(std::env!("OUT_DIR"), "/Info.plist"));
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user