Merge from main

This commit is contained in:
Delan Azabani
2024-03-08 12:26:03 +08:00
4623 changed files with 41801 additions and 194944 deletions

View File

@@ -36,3 +36,6 @@ notify-py == 0.3.42
flask
requests
types-requests
# For mach package on macOS.
Mako == 1.2.2

View File

@@ -39,10 +39,6 @@ from servo.build_commands import copy_dependencies
from servo.gstreamer import macos_gst_root
from servo.util import delete, get_target_dir
# Note: mako cannot be imported at the top level because it breaks mach bootstrap
sys.path.append(path.join(path.dirname(__file__), "..", "..",
"components", "style", "properties", "Mako-1.1.2-py2.py3-none-any.whl"))
PACKAGES = {
'android': [
'android/armv7-linux-androideabi/production/servoapp.apk',

View File

@@ -39,6 +39,27 @@ PROJECT_TOPLEVEL_PATH = os.path.abspath(os.path.join(SCRIPT_PATH, "..", ".."))
WEB_PLATFORM_TESTS_PATH = os.path.join("tests", "wpt", "tests")
SERVO_TESTS_PATH = os.path.join("tests", "wpt", "mozilla", "tests")
# Servo depends on several `rustfmt` options that are unstable. These are still
# supported by stable `rustfmt` if they are passed as these command-line arguments.
UNSTABLE_RUSTFMT_ARGUMENTS = [
"--config", "unstable_features=true",
"--config", "binop_separator=Back",
"--config", "imports_granularity=Module",
"--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")
@@ -47,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
@@ -207,12 +228,12 @@ class MachCommands(CommandBase):
def test_tidy(self, all_files, no_progress):
tidy_failed = tidy.scan(not all_files, not no_progress)
call(["rustup", "install", "nightly-2023-03-18"])
call(["rustup", "component", "add", "rustfmt", "--toolchain", "nightly-2023-03-18"])
rustfmt_failed = call(["cargo", "+nightly-2023-03-18", "fmt", "--", "--check"])
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")
print("\r ➤ Checking formatting of toml files...")
taplo_failed = format_toml_files_with_taplo()
tidy_failed = tidy_failed or rustfmt_failed or taplo_failed
@@ -324,9 +345,7 @@ class MachCommands(CommandBase):
if result != 0:
return result
call(["rustup", "install", "nightly-2023-03-18"])
call(["rustup", "component", "add", "rustfmt", "--toolchain", "nightly-2023-03-18"])
return call(["cargo", "+nightly-2023-03-18", "fmt"])
return call(["cargo", "fmt", "--", *UNSTABLE_RUSTFMT_ARGUMENTS])
@Command('update-wpt',
description='Update the web platform tests',

View File

@@ -70,8 +70,8 @@ class CheckTidiness(unittest.TestCase):
def test_whatwg_link(self):
errors = tidy.collect_errors_for_files(iterFile('whatwg_link.rs'), [], [tidy.check_by_line], print_text=False)
self.assertTrue('link to WHATWG may break in the future, use this format instead:' in next(errors)[2])
self.assertTrue('links to WHATWG single-page url, change to multi page:' in next(errors)[2])
self.assertEqual('link to WHATWG may break in the future, use this format instead: https://html.spec.whatwg.org/multipage/#dom-context-2d-putimagedata', next(errors)[2])
self.assertEqual('links to WHATWG single-page url, change to multi page: https://html.spec.whatwg.org/multipage/#typographic-conventions', next(errors)[2])
self.assertNoMoreErrors(errors)
def test_license(self):

View File

@@ -271,14 +271,14 @@ def is_unsplittable(file_name, line):
def check_whatwg_specific_url(idx, line):
match = re.search(br"https://html\.spec\.whatwg\.org/multipage/[\w-]+\.html#([\w\'\:-]+)", line)
if match is not None:
preferred_link = "https://html.spec.whatwg.org/multipage/#{}".format(match.group(1))
preferred_link = "https://html.spec.whatwg.org/multipage/#{}".format(match.group(1).decode("utf-8"))
yield (idx + 1, "link to WHATWG may break in the future, use this format instead: {}".format(preferred_link))
def check_whatwg_single_page_url(idx, line):
match = re.search(br"https://html\.spec\.whatwg\.org/#([\w\'\:-]+)", line)
if match is not None:
preferred_link = "https://html.spec.whatwg.org/multipage/#{}".format(match.group(1))
preferred_link = "https://html.spec.whatwg.org/multipage/#{}".format(match.group(1).decode("utf-8"))
yield (idx + 1, "links to WHATWG single-page url, change to multi page: {}".format(preferred_link))