diff options
author | Brandon Fairchild <csbit32@gmail.com> | 2015-12-03 00:39:33 -0500 |
---|---|---|
committer | Brandon Fairchild <csbit32@gmail.com> | 2015-12-03 00:39:33 -0500 |
commit | 2342b1bc6f068cc70302c26a7c06d72a31ca0f91 (patch) | |
tree | f8e96f50e0bdf43468f4332611110623b6b6c71a /python/servo/build_commands.py | |
parent | ff853e0d4add97b78515c58d80c7c9b2f69056b8 (diff) | |
download | servo-2342b1bc6f068cc70302c26a7c06d72a31ca0f91.tar.gz servo-2342b1bc6f068cc70302c26a7c06d72a31ca0f91.zip |
Allow `./mach build-tests` to enable Servo's headless mode
This allows mach's build-tests command to use the option --headless
instead of checking for the value of SERVO_HEADLESS.
Diffstat (limited to 'python/servo/build_commands.py')
-rw-r--r-- | python/servo/build_commands.py | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/python/servo/build_commands.py b/python/servo/build_commands.py index 3e4237a52da..145b2eb8a1c 100644 --- a/python/servo/build_commands.py +++ b/python/servo/build_commands.py @@ -29,6 +29,16 @@ def is_headless_build(): return int(os.getenv('SERVO_HEADLESS', 0)) == 1 +def headless_supported(): + supported = sys.platform.startswith("linux") + + if not supported: + print("Headless mode (OSMesa) is not supported on your platform.") + print("Building without headless mode.") + + return supported + + def notify_linux(title, text): try: import dbus @@ -207,13 +217,9 @@ class MachCommands(CommandBase): if debug_mozjs or self.config["build"]["debug-mozjs"]: features += ["script/debugmozjs"] - if headless or is_headless_build(): - if sys.platform.startswith("linux"): - opts += ["--no-default-features"] - features += ["headless"] - else: - print("Headless mode (OSMesa) is not supported on your platform.") - print("Building without headless mode.") + if (headless or is_headless_build()) and headless_supported(): + opts += ["--no-default-features"] + features += ["headless"] if android: features += ["android_glue"] @@ -332,15 +338,19 @@ class MachCommands(CommandBase): @Command('build-tests', description='Build the Servo test suites', category='build') + @CommandArgument('--headless', + default=None, + action='store_true', + help='Enable headless mode (OSMesa)') @CommandArgument('--jobs', '-j', default=None, help='Number of jobs to run in parallel') @CommandArgument('--release', default=False, action="store_true", help="Build tests with release mode") - def build_tests(self, jobs=None, verbose=False, release=False): + def build_tests(self, headless=False, jobs=None, verbose=False, release=False): self.ensure_bootstrapped() args = ["cargo", "test", "--no-run"] - if is_headless_build(): + if (headless or is_headless_build()) and headless_supported(): args += ["--no-default-features", "--features", "headless"] if release: args += ["--release"] |