Split yunq compliation to library and use it in build process.
This commit is contained in:
parent
370ba9ae40
commit
1e073d5060
7 changed files with 89 additions and 28 deletions
|
|
@ -1,18 +1,14 @@
|
|||
use std::process::Command;
|
||||
use std::fs;
|
||||
|
||||
fn main() {
|
||||
let input_file = "../../../sys/yellowstone/lib/yellowstone/yellowstone.yunq";
|
||||
|
||||
println!("cargo::rerun-if-changed={input_file}");
|
||||
|
||||
let input = fs::read_to_string(input_file).expect("Failed to read input file");
|
||||
|
||||
let code = yunqc::codegen(&input).expect("Failed to generate yunq code.");
|
||||
|
||||
let out = std::env::var("OUT_DIR").unwrap() + "/yunq.rs";
|
||||
|
||||
let status = Command::new("cargo")
|
||||
.current_dir("../../../yunq/rust")
|
||||
.arg("run")
|
||||
.arg("--")
|
||||
.arg("--input-path")
|
||||
.arg("../../sys/yellowstone/lib/yellowstone/yellowstone.yunq")
|
||||
.arg("--output-path")
|
||||
.arg(out)
|
||||
.status()
|
||||
.expect("Failed to start execution");
|
||||
|
||||
assert!(status.success());
|
||||
fs::write(out, code).expect("Failed to write generated code.");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue