monorepo/kifu/gtk/build.rs

30 lines
846 B
Rust

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();
}
fn main() {
glib_build_tools::compile_resources(
&["resources"],
"gresources.xml",
"com.luminescent-dreams.kifu-gtk.gresource",
);
// 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());
}