From 2d5bcdf0026dae4ef3433e74a1f115b80c20f1eb Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Wed, 31 Oct 2018 13:06:30 -0400 Subject: [PATCH] Review comment. Replace OUT_DIR with DENO_BUILD_PATH --- build.rs | 3 ++- build_extra/rust/run.py | 7 +++++-- src/msg.rs | 4 +++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/build.rs b/build.rs index 7e16571e557060..489f9f9d2628b7 100644 --- a/build.rs +++ b/build.rs @@ -22,9 +22,10 @@ fn main() { assert!(status.success()); // These configurations must be outputted after tools/setup.py is run. - println!("cargo:rustc-env=OUT_DIR={}", deno_build_path); 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) diff --git a/build_extra/rust/run.py b/build_extra/rust/run.py index 276e799cc3446a..0b1fa3dc9a9ecf 100644 --- a/build_extra/rust/run.py +++ b/build_extra/rust/run.py @@ -5,6 +5,9 @@ import sys import os -os.environ["OUT_DIR"] = os.path.abspath(".") -assert os.path.isdir(os.environ["OUT_DIR"]) +# TODO This is for src/msg.rs to know where to find msg_generated.rs +# In the future we should use OUT_DIR here. +os.environ["DENO_BUILD_PATH"] = os.path.abspath(".") +assert os.path.isdir(os.environ["DENO_BUILD_PATH"]) + sys.exit(subprocess.call(sys.argv[1:], env=os.environ)) diff --git a/src/msg.rs b/src/msg.rs index 8b66704fc21935..5c0244509c6346 100644 --- a/src/msg.rs +++ b/src/msg.rs @@ -1,4 +1,6 @@ #![allow(unused_imports)] #![allow(dead_code)] use flatbuffers; -include!(concat!(env!("OUT_DIR"), "/gen/msg_generated.rs")); +// TODO Replace DENO_BUILD_PATH with OUT_DIR. gn/ninja should generate into +// the same output directory as cargo uses. +include!(concat!(env!("DENO_BUILD_PATH"), "/gen/msg_generated.rs"));