mirror of
https://github.com/servo/servo.git
synced 2025-08-02 12:10:29 +01:00
Make crown
optional (#32494)
* Make `crown` optional Add the optional `--use-crown` flag to mach * --use-crown for all platforms in CI Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> * Add documentation for `--use-crown` Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> * Update python/servo/command_base.py Co-authored-by: Mukilan Thiyagarajan <mukilanthiagarajan@gmail.com> Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com> * Raise Error if CARGO_BUILD_RUSTC conflicts with --use-crown Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com> * add dummy RUSTFLAG to trigger re-checking Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com> --------- Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com> Co-authored-by: Mukilan Thiyagarajan <mukilanthiagarajan@gmail.com>
This commit is contained in:
parent
8121c98834
commit
26bbfe9b55
7 changed files with 53 additions and 16 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue