diff options
Diffstat (limited to 'python/servo/command_base.py')
-rw-r--r-- | python/servo/command_base.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/python/servo/command_base.py b/python/servo/command_base.py index f9c46143320..71fe267e10e 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -863,6 +863,12 @@ class CommandBase(object): help='Build with frame pointer enabled, used by the background hang monitor.', ), CommandArgument('--without-wgl', group="Feature Selection", default=None, action='store_true'), + CommandArgument( + '--use-crown', + default=False, + action='store_true', + help="Enable Servo's `crown` linter tool" + ) ] def decorator_function(original_function): @@ -977,6 +983,7 @@ class CommandBase(object): env=None, verbose=False, debug_mozjs=False, with_debug_assertions=False, with_frame_pointer=False, without_wgl=False, + use_crown=False, target_override: Optional[str] = None, **_kwargs ): @@ -1009,6 +1016,22 @@ class CommandBase(object): if command == 'rustc': args += ["--lib", "--crate-type=cdylib"] + if use_crown: + if 'CARGO_BUILD_RUSTC' in env: + current_rustc = env['CARGO_BUILD_RUSTC'] + if current_rustc != 'crown': + print('Error: `mach` was called with `--use-crown` while `CARGO_BUILD_RUSTC` was' + f'already set to `{current_rustc}` in the parent environment.\n' + 'These options conflict, please specify only one of them.') + sys.exit(1) + env['CARGO_BUILD_RUSTC'] = 'crown' + # Changing `RUSTC` or `CARGO_BUILD_RUSTC` does not cause `cargo check` to + # recheck files with the new compiler. `cargo build` is not affected and + # triggers a rebuild as expected. To also make `check` work as expected, + # we add a dummy `cfg` to RUSTFLAGS when using crown, so as to have different + # RUSTFLAGS when using `crown`, to reliably trigger re-checking. + env['RUSTFLAGS'] = env.get('RUSTFLAGS', "") + " --cfg=crown" + if "-p" not in cargo_args: # We're building specific package, that may not have features features = list(self.features) if self.enable_media: |