diff options
author | Jack Moffitt <jack@metajack.im> | 2015-06-08 16:09:08 -0600 |
---|---|---|
committer | Jack Moffitt <jack@metajack.im> | 2015-06-15 11:48:47 -0600 |
commit | a0237085c6894cc781bc99469a735206e1e6b127 (patch) | |
tree | f0f391d0f60e64b725a078bce2be17ca0bd77633 /python/servo/command_base.py | |
parent | ce30807be594d62b75772eac6356f84089a18c09 (diff) | |
download | servo-a0237085c6894cc781bc99469a735206e1e6b127.tar.gz servo-a0237085c6894cc781bc99469a735206e1e6b127.zip |
Use Cargo's target directory sharing.
This speeds up `./mach build --dev` followed by `./mach build-cef` by a
large amount, and also speeds up other build combos found in our CI.
Diffstat (limited to 'python/servo/command_base.py')
-rw-r--r-- | python/servo/command_base.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/python/servo/command_base.py b/python/servo/command_base.py index 5369b3e47f9..c6d46fc3de8 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -130,8 +130,14 @@ class CommandBase(object): self._cargo_build_id = open(filename).read().strip() return self._cargo_build_id + def get_target_dir(self): + if "CARGO_TARGET_DIR" in os.environ: + return os.environ["CARGO_TARGET_DIR"] + else: + return path.join(self.context.topdir, "target") + def get_binary_path(self, release, dev): - base_path = path.join("components", "servo", "target") + base_path = self.get_target_dir() release_path = path.join(base_path, "release", "servo") dev_path = path.join(base_path, "debug", "servo") @@ -199,6 +205,9 @@ class CommandBase(object): if "CARGO_HOME" not in env: env["CARGO_HOME"] = self.config["tools"]["cargo-home-dir"] + if "CARGO_TARGET_DIR" not in env: + env["CARGO_TARGET_DIR"] = path.join(self.context.topdir, "target") + if extra_lib: if sys.platform == "darwin": env["DYLD_LIBRARY_PATH"] = "%s%s%s" % \ |