aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-12-15 03:31:40 -0800
committerGitHub <noreply@github.com>2016-12-15 03:31:40 -0800
commit4d165dbf363bac3ef88dd404f3a3cd35ee2f37f0 (patch)
tree43fc4c083178955343b03370d68788ba6b094a19 /python/servo
parent04d9ab50eb2408ceaaa692ee5660fdd871cd7620 (diff)
parentaf487f5730612c62bb260704263296720963bbdb (diff)
downloadservo-4d165dbf363bac3ef88dd404f3a3cd35ee2f37f0.tar.gz
servo-4d165dbf363bac3ef88dd404f3a3cd35ee2f37f0.zip
Auto merge of #14602 - upsuper:auto-copy-bindgen, r=Wafflespeanut
Auto-update in-tree bindings Automatically update the in-tree bindings after a successful geckolib build with gecko dist specified. cc @heycam @emilio This is very similiar to the patch that @emilio provided yesterday, so I'd ask someone else to review. r? @bholley <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14602) <!-- Reviewable:end -->
Diffstat (limited to 'python/servo')
-rw-r--r--python/servo/build_commands.py14
-rw-r--r--python/servo/command_base.py15
2 files changed, 22 insertions, 7 deletions
diff --git a/python/servo/build_commands.py b/python/servo/build_commands.py
index a54d667f5f4..ad81cbbbd55 100644
--- a/python/servo/build_commands.py
+++ b/python/servo/build_commands.py
@@ -24,7 +24,7 @@ from mach.decorators import (
Command,
)
-from servo.command_base import CommandBase, cd, call, BIN_SUFFIX, host_triple
+from servo.command_base import CommandBase, cd, call, BIN_SUFFIX, host_triple, find_dep_path_newest
def format_duration(seconds):
@@ -401,7 +401,8 @@ class MachCommands(CommandBase):
self.ensure_bootstrapped()
env = self.build_env(is_build=True)
- env["CARGO_TARGET_DIR"] = path.join(self.context.topdir, "target", "geckolib").encode("UTF-8")
+ geckolib_build_path = path.join(self.context.topdir, "target", "geckolib").encode("UTF-8")
+ env["CARGO_TARGET_DIR"] = geckolib_build_path
ret = None
opts = []
@@ -425,6 +426,15 @@ class MachCommands(CommandBase):
print("GeckoLib build completed in %s" % format_duration(elapsed))
+ if with_gecko is not None and ret == 0:
+ print("Copying binding files to style/gecko_bindings...")
+ build_path = path.join(geckolib_build_path, "release" if release else "debug", "")
+ target_style_path = find_dep_path_newest("style", build_path)
+ out_gecko_path = path.join(target_style_path, "out", "gecko")
+ bindings_path = path.join(self.context.topdir, "components", "style", "gecko_bindings")
+ for f in ["bindings.rs", "structs_debug.rs", "structs_release.rs"]:
+ shutil.copy(path.join(out_gecko_path, f), bindings_path)
+
return ret
@Command('clean',
diff --git a/python/servo/command_base.py b/python/servo/command_base.py
index b337ca5e9ed..0facab6061e 100644
--- a/python/servo/command_base.py
+++ b/python/servo/command_base.py
@@ -50,12 +50,17 @@ def setlocale(name):
def find_dep_path_newest(package, bin_path):
deps_path = path.join(path.split(bin_path)[0], "build")
+ candidates = []
with cd(deps_path):
- candidates = glob(package + '-*')
- candidates = (path.join(deps_path, c) for c in candidates)
- candidate_times = sorted(((path.getmtime(c), c) for c in candidates), reverse=True)
- if len(candidate_times) > 0:
- return candidate_times[0][1]
+ for c in glob(package + '-*'):
+ candidate_path = path.join(deps_path, c)
+ candidate_output = path.join(candidate_path, "output")
+ if path.exists(candidate_output):
+ candidates.append((path.getmtime(candidate_output), candidate_path))
+ candidates.sort(reverse=True)
+ if candidates:
+ _, candidate_path = candidates[0]
+ return candidate_path
return None