From d641585679344796c39a7562fa844bb836da4f21 Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Tue, 19 Nov 2019 15:10:47 +0000 Subject: [PATCH] Implement `./mach check --media-stack` While at it, extract --media-stack flag into command_base.py. --- python/servo/build_commands.py | 4 ---- python/servo/command_base.py | 6 ++++++ python/servo/devenv_commands.py | 22 ++++++++++++++++++++-- python/servo/post_build_commands.py | 4 ---- 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/python/servo/build_commands.py b/python/servo/build_commands.py index 6ceb6f9574a..effcd8676c5 100644 --- a/python/servo/build_commands.py +++ b/python/servo/build_commands.py @@ -155,10 +155,6 @@ class MachCommands(CommandBase): @CommandArgument('--jobs', '-j', default=None, help='Number of jobs to run in parallel') - @CommandArgument('--media-stack', - default=None, - choices=["gstreamer", "dummy"], - help='Which media stack to use') @CommandArgument('--no-package', action='store_true', help='For Android, disable packaging into a .apk after building') diff --git a/python/servo/command_base.py b/python/servo/command_base.py index 42385ff4e38..f9a01bbb4af 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -792,6 +792,12 @@ install them, let us know by filing a bug!") default=None, help='Cross compile for given target platform', ), + CommandArgument( + '--media-stack', + default=None, + choices=["gstreamer", "dummy"], + help='Which media stack to use', + ), CommandArgument( '--android', default=None, diff --git a/python/servo/devenv_commands.py b/python/servo/devenv_commands.py index 78f6e2ce392..1a29fc5f118 100644 --- a/python/servo/devenv_commands.py +++ b/python/servo/devenv_commands.py @@ -38,16 +38,34 @@ class MachCommands(CommandBase): 'params', default=None, nargs='...', help="Command-line arguments to be passed through to cargo check") @CommandBase.build_like_command_arguments - def check(self, params, **kwargs): + def check(self, params, features=[], media_stack=None, target=None, + android=False, magicleap=False, **kwargs): if not params: params = [] + features = features or [] + + target, android = self.pick_target_triple(target, android, magicleap) + + # A guess about which platforms should use the gstreamer media stack + if not(media_stack): + if ( + not(target) or + ("armv7" in target and "android" in target) or + ("x86_64" in target) + ): + media_stack = "gstreamer" + else: + media_stack = "dummy" + + features += ["media-" + media_stack] + self.ensure_bootstrapped() self.ensure_clobbered() env = self.build_env() build_start = time() - status = self.run_cargo_build_like_command("check", params, env=env, **kwargs) + status = self.run_cargo_build_like_command("check", params, env=env, features=features, **kwargs) elapsed = time() - build_start notify_build_done(self.config, elapsed, status == 0) diff --git a/python/servo/post_build_commands.py b/python/servo/post_build_commands.py index 382f22ac0f5..4cc7e69318f 100644 --- a/python/servo/post_build_commands.py +++ b/python/servo/post_build_commands.py @@ -238,10 +238,6 @@ class PostBuildCommands(CommandBase): @CommandArgument( 'params', nargs='...', help="Command-line arguments to be passed through to cargo doc") - @CommandArgument('--media-stack', - default=None, - choices=["gstreamer", "dummy"], - help='Which media stack to use') @CommandBase.build_like_command_arguments def doc(self, params, features, target=None, android=False, magicleap=False, media_stack=None, **kwargs):