From ec17239f46fa8677975183e0ab4a0bc7adcff77e Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Thu, 1 Nov 2018 06:06:55 +0100 Subject: cargo: build in Cargo's out dir if DENO_BUILD_PATH is not set Plus some minor improvements and clean-ups: * Resolve DENO_BUILD_PATH to an absolute path if necessary. * Rename DENO_BUILD_PATH to GN_OUT_DIR in places where it is supposed to be set by the build system (and not a user configuration variable). * Output Cargo `rerun-if-*-changed` instructions first, so even if the build itself fails, configuration changes will still trigger a re-run of build.rs. * Remove TODOs that are impossible. * Re-run build.rs when the flatbuffer definition file changes. --- build_extra/rust/run.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'build_extra/rust/run.py') diff --git a/build_extra/rust/run.py b/build_extra/rust/run.py index 0b1fa3dc9..3a86c423c 100644 --- a/build_extra/rust/run.py +++ b/build_extra/rust/run.py @@ -1,13 +1,13 @@ #!/usr/bin/env python -# This file just executes its arguments, except that also adds OUT_DIR to the +# This file just executes its arguments, except that also adds GN_OUT_DIR to the # environ. This is for compatibility with cargo. import subprocess import sys import os -# 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"]) +# This is for src/msg.rs to know where to find msg_generated.rs. +# When building with Cargo this variable is set by build.rs. +os.environ["GN_OUT_DIR"] = os.path.abspath(".") +assert os.path.isdir(os.environ["GN_OUT_DIR"]) -sys.exit(subprocess.call(sys.argv[1:], env=os.environ)) +sys.exit(subprocess.call(sys.argv[1:])) -- cgit v1.2.3