-
-
Notifications
You must be signed in to change notification settings - Fork 126
/
build.rs
29 lines (24 loc) · 831 Bytes
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use std::env;
use std::path::Path;
use std::process::{Command, Stdio};
fn main() {
// Watch for changes in the deno api
println!("cargo:rerun-if-changed=./core_deno/src/graviton.ts");
let out_dir = env::var_os("OUT_DIR").unwrap();
let out_file_dir = Path::new(&out_dir).join("graviton.js");
// Transpile the deno api
let res = Command::new("node")
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.arg("../node_modules/typescript/lib/tsc.js")
.arg("./src/graviton.ts")
.arg("--out")
.arg(out_file_dir.to_str().unwrap())
.arg("--target")
.arg("esnext")
.arg("-D")
.output()
.expect("Could not compile graviton.ts");
println!("{}", std::str::from_utf8(&res.stderr).unwrap());
assert!(res.status.success());
}