-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This removes some build code but we still need the meson stuff in order to get the blueprint compiler in CI. There is now some new meson code that adds the path to the blueprint compiler to $PATH in order for gtk4_macros to detect it and be able to use it.
- Loading branch information
Showing
6 changed files
with
29 additions
and
68 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,14 @@ | ||
use std::{env, process::Command}; | ||
|
||
fn main() { | ||
// See: https://docs.rs/diesel_migrations/2.0.0-rc.1/diesel_migrations/macro.embed_migrations.html#automatic-rebuilds | ||
println!("cargo:rerun-if-changed=migrations/"); | ||
|
||
if std::option_env!("KCSHOT_LINTING").is_none() { | ||
let blueprint_dir = env::var("OUT_DIR").unwrap() + "/resources"; | ||
compile_blueprints(&["src/editor/textdialog.blp"], &blueprint_dir); | ||
glib_build_tools::compile_resources( | ||
&[blueprint_dir.as_str(), "resources"], | ||
"resources/resources.gresource.xml", | ||
"compiled.gresource", | ||
); | ||
} else { | ||
if std::option_env!("KCSHOT_LINTING").is_some() { | ||
println!("cargo:rustc-cfg=kcshot_linting"); | ||
} | ||
} | ||
|
||
fn compile_blueprints(blueprints: &[&str], target: &str) { | ||
let blueprint_compiler = std::env::var("BLUEPRINT_COMPILER_PATH") | ||
.unwrap_or_else(|_| "blueprint-compiler".to_owned()); | ||
|
||
let mut blueprint_compiler = Command::new(blueprint_compiler); | ||
blueprint_compiler | ||
.arg("batch-compile") | ||
.arg(target) | ||
.arg("src/"); | ||
|
||
for blueprint in blueprints { | ||
println!("cargo:rerun-if-changed={blueprint}"); | ||
blueprint_compiler.arg(blueprint); | ||
} | ||
|
||
let output = blueprint_compiler | ||
.output() | ||
.expect("Failed to execute blueprint-compiler"); | ||
|
||
if !output.status.success() { | ||
panic!( | ||
"blueprint-compiler returned {}, with stderr:\n{}", | ||
output.status, | ||
std::str::from_utf8(&output.stderr).unwrap() | ||
); | ||
} | ||
glib_build_tools::compile_resources( | ||
&["resources"], | ||
"resources/resources.gresource.xml", | ||
"compiled.gresource", | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters