mirror of
https://github.com/servo/servo.git
synced 2025-08-02 12:10:29 +01:00
Add cargo-deny to mach-tidy to check license compliance. (#32465)
* Use cargo-deny to check license compliance. All licenses should be MPL-2.0 or weaker. * Run cargo-deny check licenses in mach tidy * fmt * Fix inverted boolean * Move cargo deny to tidy.py * Add quotes around license in error message * Integrate `cargo-deny` into tidy fully * Fix script tests --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
370fbf0331
commit
fd472ebd0e
6 changed files with 160 additions and 42 deletions
|
@ -59,6 +59,7 @@ class Base:
|
|||
if not skip_platform:
|
||||
installed_something |= self._platform_bootstrap(force)
|
||||
installed_something |= self.install_taplo(force)
|
||||
installed_something |= self.install_cargo_deny(force)
|
||||
installed_something |= self.install_crown(force)
|
||||
|
||||
if not installed_something:
|
||||
|
@ -74,6 +75,16 @@ class Base:
|
|||
|
||||
return True
|
||||
|
||||
def install_cargo_deny(self, force: bool) -> bool:
|
||||
if not force and shutil.which("cargo-deny") is not None:
|
||||
return False
|
||||
|
||||
print(" * Installing cargo-deny...")
|
||||
if subprocess.call(["cargo", "install", "cargo-deny", "--locked"]) != 0:
|
||||
raise EnvironmentError("Installation of cargo-deny failed.")
|
||||
|
||||
return True
|
||||
|
||||
def install_crown(self, force: bool) -> bool:
|
||||
print(" * Installing crown (the Servo linter)...")
|
||||
if subprocess.call(["cargo", "install", "--path", "support/crown"]) != 0:
|
||||
|
|
|
@ -228,7 +228,7 @@ class MachCommands(CommandBase):
|
|||
def test_tidy(self, all_files, no_progress):
|
||||
tidy_failed = tidy.scan(not all_files, not no_progress)
|
||||
|
||||
print("\r ➤ Checking formatting of rust files...")
|
||||
print("\r ➤ Checking formatting of Rust files...")
|
||||
rustfmt_failed = call(["cargo", "fmt", "--", *UNSTABLE_RUSTFMT_ARGUMENTS, "--check"])
|
||||
if rustfmt_failed:
|
||||
print("Run `./mach fmt` to fix the formatting")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue