diff options
author | Martin Robinson <mrobinson@igalia.com> | 2024-02-29 11:03:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-29 10:03:19 +0000 |
commit | 6eb96290faf5beade356370e056e8011cc741de9 (patch) | |
tree | 192da283b45ecc7e74dc617c91f4755cd0a44bdd /python/servo/testing_commands.py | |
parent | 9a9abe9152fb3691d9ff97e743bb46c1c4ebea8c (diff) | |
download | servo-6eb96290faf5beade356370e056e8011cc741de9.tar.gz servo-6eb96290faf5beade356370e056e8011cc741de9.zip |
mach: Speed up `taplo` runs on MacOS (#31452)
`taplo` is the TOML formatter that we use. It seems to be using a very
slow directory walking mechanism on MacOS. This change works around that
issue by explicitly listing globs of TOML files to format and check.
Before:
```text
real 0m17.632s
user 0m2.164s
sys 0m6.916s
```
After:
```text
real 0m1.519s
user 0m1.391s
sys 0m0.112s
```
Diffstat (limited to 'python/servo/testing_commands.py')
-rw-r--r-- | python/servo/testing_commands.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py index 36c51fd250b..779face4a45 100644 --- a/python/servo/testing_commands.py +++ b/python/servo/testing_commands.py @@ -48,6 +48,18 @@ UNSTABLE_RUSTFMT_ARGUMENTS = [ "--config", "group_imports=StdExternalCrate", ] +# Listing these globs manually is a work-around for very slow `taplo` invocation +# on MacOS machines. If `taplo` runs fast without the globs on MacOS, this +# can be removed. +TOML_GLOBS = [ + "*.toml", + ".cargo/*.toml", + "components/*/*.toml", + "components/shared/*.toml", + "ports/*/*.toml", + "support/*/*.toml", +] + def format_toml_files_with_taplo(check_only: bool = True) -> int: taplo = shutil.which("taplo") @@ -56,9 +68,9 @@ def format_toml_files_with_taplo(check_only: bool = True) -> int: return 1 if check_only: - return call([taplo, "fmt", "--check"], env={'RUST_LOG': 'error'}) + return call([taplo, "fmt", "--check", *TOML_GLOBS], env={'RUST_LOG': 'error'}) else: - return call([taplo, "fmt"], env={'RUST_LOG': 'error'}) + return call([taplo, "fmt", *TOML_GLOBS], env={'RUST_LOG': 'error'}) @CommandProvider |