2024-03-11 23:11:59 +00:00
|
|
|
use std::{path::PathBuf, env, process, fs::File, io::Write};
|
|
|
|
|
|
|
|
fn generate_message_types(dest: &PathBuf) {
|
|
|
|
println!("message types");
|
|
|
|
let output: Vec<u8> = process::Command::new("l10n-codegen-rust")
|
|
|
|
.arg("messages/en.yaml")
|
|
|
|
.output()
|
|
|
|
.unwrap()
|
|
|
|
.stdout;
|
|
|
|
|
|
|
|
let mut file = File::create(dest).unwrap();
|
|
|
|
file.write(&output).unwrap();
|
|
|
|
}
|
|
|
|
|
2023-03-31 02:25:11 +00:00
|
|
|
fn main() {
|
|
|
|
glib_build_tools::compile_resources(
|
|
|
|
&["resources"],
|
2024-02-27 00:06:41 +00:00
|
|
|
"gresources.xml",
|
2023-03-31 02:25:11 +00:00
|
|
|
"com.luminescent-dreams.kifu-gtk.gresource",
|
|
|
|
);
|
2024-03-11 23:11:59 +00:00
|
|
|
|
|
|
|
// println!("OUT_DIR={}", env::var("OUT_DIR").unwrap());
|
|
|
|
let mut message_path = PathBuf::from(env::var("OUT_DIR").unwrap());
|
|
|
|
message_path.push("messages.rs");
|
|
|
|
|
|
|
|
generate_message_types(&message_path);
|
|
|
|
|
|
|
|
println!("cargo:rustc-env=KIFU_GTK_MESSAGES={}", message_path.to_string_lossy());
|
2023-03-31 02:25:11 +00:00
|
|
|
}
|