aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo
diff options
context:
space:
mode:
authorJonathan Schwender <55576758+jschwe@users.noreply.github.com>2024-06-24 13:46:43 +0200
committerGitHub <noreply@github.com>2024-06-24 11:46:43 +0000
commit26bbfe9b551c268188d952b1b565da890d3eb6f4 (patch)
tree0f8b70a9d674d61afcb9cec3bf07d8007e04e9dc /python/servo
parent8121c9883477cf4350e8dd8abdc3776548c11ea3 (diff)
downloadservo-26bbfe9b551c268188d952b1b565da890d3eb6f4.tar.gz
servo-26bbfe9b551c268188d952b1b565da890d3eb6f4.zip
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>
Diffstat (limited to 'python/servo')
-rw-r--r--python/servo/command_base.py23
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: