diff options
Diffstat (limited to 'python/servo/build_commands.py')
-rw-r--r-- | python/servo/build_commands.py | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/python/servo/build_commands.py b/python/servo/build_commands.py index 514a8f87e69..bd09221d56f 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): @@ -384,6 +384,9 @@ class MachCommands(CommandBase): @Command('build-geckolib', description='Build a static library of components used by Gecko', category='build') + @CommandArgument('--with-gecko', + default=None, + help='Build with Gecko dist directory') @CommandArgument('--jobs', '-j', default=None, help='Number of jobs to run in parallel') @@ -393,12 +396,19 @@ class MachCommands(CommandBase): @CommandArgument('--release', '-r', action='store_true', help='Build in release mode') - def build_geckolib(self, jobs=None, verbose=False, release=False): + def build_geckolib(self, with_gecko=None, jobs=None, verbose=False, release=False): self.set_use_stable_rust() self.ensure_bootstrapped() + env = self.build_env(is_build=True) + geckolib_build_path = path.join(self.context.topdir, "target", "geckolib").encode("UTF-8") + env["CARGO_TARGET_DIR"] = geckolib_build_path + ret = None opts = [] + if with_gecko is not None: + opts += ["--features", "bindgen"] + env["MOZ_DIST"] = path.abspath(with_gecko) if jobs is not None: opts += ["-j", jobs] if verbose: @@ -406,8 +416,13 @@ class MachCommands(CommandBase): if release: opts += ["--release"] - env = self.build_env(is_build=True) - env["CARGO_TARGET_DIR"] = path.join(self.context.topdir, "target", "geckolib").encode("UTF-8") + if with_gecko is not None: + print("Generating atoms data...") + run_file = path.join(self.context.topdir, "components", + "style", "binding_tools", "regen_atoms.py") + run_globals = {"__file__": run_file} + execfile(run_file, run_globals) + run_globals["generate_atoms"](env["MOZ_DIST"]) build_start = time() with cd(path.join("ports", "geckolib")): @@ -419,6 +434,15 @@ class MachCommands(CommandBase): print("GeckoLib build completed in %s" % format_duration(elapsed)) + if with_gecko is not None: + 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', |