From 5c5acc02498ebd14003f086fdb38f56bd5c4e070 Mon Sep 17 00:00:00 2001 From: Lars Bergstrom Date: Thu, 5 Nov 2015 14:47:23 -0600 Subject: [PATCH 1/2] Add CCACHE infra and turn it on in travis --- .travis.yml | 5 +++++ python/servo/build_commands.py | 3 +++ python/servo/command_base.py | 1 + servobuild.example | 2 ++ 4 files changed, 11 insertions(+) diff --git a/.travis.yml b/.travis.yml index 2a2e6fc9257..c86517e696b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,8 @@ language: python +env: + - CCACHE=/usr/bin/ccache + matrix: fast_finish: true include: @@ -13,6 +16,7 @@ matrix: directories: - .cargo - .servo + - $HOME/.ccache addons: apt: packages: @@ -22,6 +26,7 @@ matrix: - libosmesa6-dev - python-virtualenv - xorg-dev + - ccache branches: only: diff --git a/python/servo/build_commands.py b/python/servo/build_commands.py index ad901ba0fd4..c2f7381e7ac 100644 --- a/python/servo/build_commands.py +++ b/python/servo/build_commands.py @@ -232,6 +232,9 @@ class MachCommands(CommandBase): env['OPENSSL_INCLUDE_DIR'] = path.join(openssl_dir, "include") env['OPENSSL_STATIC'] = 'TRUE' + if not (self.config["build"]["ccache"] == ""): + env['CCACHE'] = self.config["build"]["ccache"] + status = call( ["cargo", "build"] + opts, env=env, cwd=self.servo_crate(), verbose=verbose) diff --git a/python/servo/command_base.py b/python/servo/command_base.py index 14f8dff0c6f..4ceb5c629f4 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -107,6 +107,7 @@ class CommandBase(object): self.config["build"].setdefault("android", False) self.config["build"].setdefault("mode", "") self.config["build"].setdefault("debug-mozjs", False) + self.config["build"].setdefault("ccache", "") self.config.setdefault("android", {}) self.config["android"].setdefault("sdk", "") diff --git a/servobuild.example b/servobuild.example index 8d57d659e9b..8157de5b88b 100644 --- a/servobuild.example +++ b/servobuild.example @@ -36,6 +36,8 @@ rustc-with-gold = true android = false # Set "debug-mozjs" or use `mach build --debug-mozjs` to build a debug spidermonkey. debug-mozjs = false +# Set to the path to your ccache binary to enable caching of compiler outputs +#ccache = "/usr/local/bin/ccache" # Android information [android] From e0ea1e09b3f715f44089c9f1c384f162138024e6 Mon Sep 17 00:00:00 2001 From: Lars Bergstrom Date: Fri, 6 Nov 2015 13:58:32 -0600 Subject: [PATCH 2/2] move the env into the matrix include --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index c86517e696b..06d827b3a2a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,5 @@ language: python -env: - - CCACHE=/usr/bin/ccache - matrix: fast_finish: true include: @@ -17,6 +14,7 @@ matrix: - .cargo - .servo - $HOME/.ccache + env: CCACHE=/usr/bin/ccache addons: apt: packages: