scaffold: compile GSettings schema at build time for dev runs

build.rs now runs glib-compile-schemas on data/ so that debug builds
can find the schema without a system-wide install. main.rs sets
GSETTINGS_SCHEMA_DIR from the build-time constant when running in
debug mode.
This commit is contained in:
Jeena 2026-03-20 11:36:12 +00:00
parent 3339bb5ec8
commit 8db0b16954
2 changed files with 13 additions and 1 deletions

View file

@ -30,9 +30,15 @@ fn main() {
assert!(status.success(), "blueprint-compiler failed");
}
// Compile GSettings schema
// Compile GSettings schema into data/ so dev builds can find it
let schema_file = data_dir.join("net.jeena.FeedTheMonkey.gschema.xml");
println!("cargo:rerun-if-changed={}", schema_file.display());
let status = Command::new("glib-compile-schemas")
.arg(&data_dir)
.status()
.expect("failed to run glib-compile-schemas — is it installed?");
assert!(status.success(), "glib-compile-schemas failed");
println!("cargo:rustc-env=GSETTINGS_SCHEMA_DIR={}", data_dir.display());
// Compile GResource
let gresource_xml = data_dir.join("resources.gresource.xml");