diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2018-10-31 11:11:10 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-31 11:11:10 -0700 |
commit | 198e396eadad704e96c9f37e24effc89a904f570 (patch) | |
tree | d07bd792de9023196a95374ead0520e54995dbc2 /build.rs | |
parent | 21dac6646552dcacb68a0ad167723976f27b5c47 (diff) |
Support cargo check (#1128)
- Based on code from @qti3e and @piscisaureus in #724 and #1125
respectively.
- TODO The DENO_BUILD_PATH env var must be supplied and must be an
absolute path, this restriction should be removed in future work.
Diffstat (limited to 'build.rs')
-rw-r--r-- | build.rs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/build.rs b/build.rs new file mode 100644 index 000000000..489f9f9d2 --- /dev/null +++ b/build.rs @@ -0,0 +1,39 @@ +// Copyright 2018 the Deno authors. All rights reserved. MIT license. + +// Run "cargo build -vv" if you want to see gn output. +// TODO For the time being you must set an env var DENO_BUILD_PATH +// which might be `pwd`/out/debug or `pwd`/out/release. +// TODO Currently DENO_BUILD_PATH must be absolute. +// TODO Combine DENO_BUILD_PATH and OUT_DIR. + +use std::env; +use std::process::Command; + +fn main() { + let mode = env::var("PROFILE").unwrap(); + let deno_build_path = env::var("DENO_BUILD_PATH").unwrap(); + + let status = Command::new("python") + .env("DENO_BUILD_PATH", &deno_build_path) + .env("DENO_BUILD_MODE", &mode) + .arg("./tools/setup.py") + .status() + .expect("setup.py failed"); + assert!(status.success()); + + // These configurations must be outputted after tools/setup.py is run. + println!("cargo:rustc-link-search=native={}/obj", deno_build_path); + println!("cargo:rustc-link-lib=static=deno_deps"); + // TODO Remove this and only use OUT_DIR at some point. + println!("cargo:rustc-env=DENO_BUILD_PATH={}", deno_build_path); + + let status = Command::new("python") + .env("DENO_BUILD_PATH", &deno_build_path) + .env("DENO_BUILD_MODE", &mode) + .arg("./tools/build.py") + .arg("deno_deps") + .arg("-v") + .status() + .expect("build.py failed"); + assert!(status.success()); +} |