24 Commits

Author SHA1 Message Date
Jonathan Schwender
e23f052412 Rename libservo to servo (#43141)
As discussed on zulip we would like to rename `libservo` to `servo`
(again) before a future crates.io release.
Servo is a library, so the `lib` prefix is somewhat redundant. We
already renamed the binary of ServoShell to `servoshell`, to reduce
confusion of users of what servo is.

Note: This PR does not touch all occurrences of `libservo`. Specifically
CI job names remain untouched, since the risk of breaking something is
higher here, harder to test for and the name not user facing.

Testing: CI testing of this change should give us good confidence.
Manual testing of `./mach doc` and `./mach build` showed no issues on
macos. [Full try
run](https://github.com/jschwe/servo/actions/runs/22909562747)

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2026-03-10 20:55:14 +00:00
shuppy
0333595a0f NixOS: fix missing library errors when running libservo tests (#42835)
on NixOS, under X11 at least, many libservo tests panic:

```
$ ./mach test-unit -p libservo test_create_webview
[...]
    thread 'test_create_webview' (3589026) panicked at /home/delan/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wayland-sys-0.31.8/src/client.rs:110:103:
    Library libwayland-client.so could not be loaded.
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```

this patch fixes that by adding `wayland` to the LD_LIBRARY_PATH in
shell.nix.

Testing: tested manually as above

Signed-off-by: delan azabani <dazabani@igalia.com>
2026-02-25 12:10:45 +00:00
Alice
00e07a6736 Bump rust version to 1.92.0 (#42661)
This is a prerequisite for using the new version of egui introduced in
https://github.com/servo/servo/pull/42402.

Testing: No new behaviour.

Signed-off-by: Alice Boxhall <alice@igalia.com>
2026-02-16 18:58:15 +00:00
Mukilan Thiyagarajan
688691609e mach: Upgrade cargo-deny and report unknown errors in test-tidy (#41853)
The versions of `cargo-deny` older than 0.18.6 have a bug which causes
the executions of `cargo-deny check` to prematurely fail when reading
the advisory db
(https://github.com/EmbarkStudios/cargo-deny/issues/804).

This error is ignored by `test-tidy` since the error message doesn't
have the expected JSON fields, causing `test-tidy` to succeed even when
there are valid issues in `deny.toml` or `Cargo.lock`.

So upgrade the `cargo-deny` version installed by `mach` to be the latest
version and ensure that at least the version with the fix is installed
on the system. Also fix the `test-tidy` code to always fail when the
exit code from `cargo-deny` is non-zero.

This patch also updates `deny.toml` to include exceptions to allow
`./mach test-tidy` to pass. Some of these need to be investigated
separately from this change.

Fixes #41845.
Fixes #38945.

Testing: Tested locally on NixOS.

---------

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2026-01-12 11:43:28 +00:00
dyegoaurelio
bc81a4f11a nix: Add FHS wrappers for venv binaries (ruff, pyrefly) on NixOS (#40860)
On NixOS, dynamically linked binaries from the Python venv (installed
via uv/pip) cannot run directly because they expect standard Linux
library paths that don't exist on NixOS.

This commit adds FHS wrappers that allow these binaries to run in an
FHS-compatible environment at runtime, without patching them.

I considered using the nixpkgs versions of ruff and pyrefly directly, or
overriding their derivations to match the versions in requirements.txt.
However, decided against it because:
- Version mismatches between nixpkgs and requirements.txt caused type
checking incompatibilities (pyrefly 0.34.0 vs 0.23.1)
- Building these tools from source in nix is slow and adds significant
time to nix-shell initialization (both are rust packages that take quite
some time to build)


Testing: just improvements to the NixOS development environment, no test
needed

**Before:**
```
➜ servo (main) ✔ nix-shell
➜ servo (main) ✔ ./mach fmt
Could not start dynamically linked executable: /home/dyego/coding/random/servo/.venv/bin/ruff
NixOS cannot run dynamically linked executables intended for generic
linux environments out of the box. For more information, see:
https://nix.dev/permalink/stub-ld
➜ servo (main) ✔ ./mach test-tidy
 ➤  Checking config file (./servo-tidy.toml)...
 ➤  Checking directories for correct file extensions...
Could not start dynamically linked executable: ruff
NixOS cannot run dynamically linked executables intended for generic
linux environments out of the box. For more information, see:
https://nix.dev/permalink/stub-ld
Error running mach:

    ['test-tidy']

The error occurred in code that was called by the mach command. This is either
a bug in the called code itself or in the way that mach is calling it.
You can invoke |./mach busted| to check if this issue is already on file. If it
isn't, please use |./mach busted file| to report it. If |./mach busted| is
misbehaving, you can also inspect the dependencies of bug 1543241.

If filing a bug, please include the full output of mach, including this error
message.

The details of the failure are as follows:

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

  File "/home/dyego/coding/random/servo/python/servo/testing_commands.py", line 322, in test_tidy
    tidy_failed = tidy.scan(not all_files, not no_progress, github_annotations)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dyego/coding/random/servo/python/tidy/tidy.py", line 919, in scan
    for error in errors:
  File "/home/dyego/coding/random/servo/python/tidy/tidy.py", line 401, in check_ruff_lints
    for error in json.loads(e.output):
                 ^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/2g9b898aq9kmizmhmhbdip5mixrc5wrk-python3-3.11.14/lib/python3.11/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/2g9b898aq9kmizmhmhbdip5mixrc5wrk-python3-3.11.14/lib/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/2g9b898aq9kmizmhmhbdip5mixrc5wrk-python3-3.11.14/lib/python3.11/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
➜ servo (main) ✔
```

(note that the `JSONDecodeError` is because we're trying to parse the
"NixOS cannot run dynamically linked executables intended..." string as
JSON)

**Now:**
```
➜ servo (fix-nix-mach) ✔ nix-shell
➜ servo (fix-nix-mach) ✔ ./mach fmt
➜ servo (fix-nix-mach) ✔ ./mach test-tidy
 ➤  Checking config file (./servo-tidy.toml)...
 ➤  Checking directories for correct file extensions...
 ➤  Checking type annotations in python files ...
 ➤  Skipping WPT lint checks, because no relevant files changed.
 ➤  Running `cargo-deny` checks...
 ➤  Checking formatting of Rust files...
 ➤  Checking formatting of python files...
 ➤  Checking formatting of toml files...

  test-tidy reported no errors.
➜ servo (fix-nix-mach) ✔
```

Signed-off-by: Dyego Aurélio <dyegoaurelio@gmail.com>
2025-11-25 15:20:49 +00:00
Freya Arbjerg
7bdfb4b768 Update nixpkgs to current unstable (#40822)
This fixes an incompatibility between mesa and wayland 1.23.x which
causes a panic

Testing: `./mach test-unit`

NB: These tests failed. I have no way of verifying if they failed
because of this change

```
     Summary [   5.146s] 814 tests run: 793 passed (1 slow), 21 failed, 0 skipped
        FAIL [   0.010s] compositing_traits rendering_context::test::test_read_pixels
        FAIL [   0.029s] libservo::webview test_confirm_dialog
        FAIL [   0.035s] libservo::webview test_can_go_forward_and_can_go_back
        FAIL [   0.036s] libservo::servo test_simple_start_and_stop_servo
        FAIL [   0.040s] libservo::multiprocess test_multiprocess_preference_observer
        FAIL [   0.039s] libservo::webview test_alert_dialog
        FAIL [   0.032s] libservo::webview test_control_show_and_hide
        FAIL [   0.031s] libservo::webview test_create_webview_and_immediately_drop_webview_before_shutdown
        FAIL [   0.050s] libservo::webview test_contextual_context_menu_items
        FAIL [   0.028s] libservo::webview test_cursor_change
        FAIL [   0.051s] libservo::webview test_create_webview
        FAIL [   0.030s] libservo::webview test_evaluate_javascript_panic
        FAIL [   0.027s] libservo::webview test_prompt_dialog
        FAIL [   0.031s] libservo::webview test_evaluate_javascript_basic
        FAIL [   0.030s] libservo::webview test_negative_resize_to_request
        FAIL [   0.029s] libservo::webview test_page_zoom
        FAIL [   0.034s] libservo::webview test_resize_webview_zero
        FAIL [   0.033s] libservo::webview test_show_and_hide_ime
        FAIL [   0.027s] libservo::webview test_theme_change
        FAIL [   0.031s] libservo::webview test_simple_context_menu
        FAIL [   0.031s] libservo::webview test_viewport_meta_tag_initial_zoom
error: test run failed
```

Signed-off-by: Freya Arbjerg <git@arbjerg.dev>
2025-11-23 15:28:56 +00:00
Sam
53d8c59e77 cargo: Bump Rust to 1.91 (#39471)
Rust 1.90 uses lld by default on linux, which should improve link time
and memory usage (I personally override ld with lld globally). And
because of miscompilations we observed on 1.90 we need to skip to 1.91.

Testing: Existing tests.
try run: https://github.com/sagudev/servo/actions/runs/18951980580

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-10-30 21:14:10 +00:00
Jonathan Schwender
4b578671b0 testing: Use nextest for unit-tests (#39812)
Nextest is a powerful test runner, with many advantages over cargo test.
Among others it will run each test in a separate process, provide a
summary of the completed test execution, supports output formats like
JUnit, and can handle flaky test by retrying. This PR does not use most
of these advanced features yet though, that will be left to future PRs.

The change also uncovered racy tests in `net` which rely on someone
initializing the `ASYNC_RUNTIME` before the test in questions is run. By
explicitly accessing the lazy static in a common setup routine, we make
sure it is initialized.

CLI differences of `cargo test` vs `cargo nextest`: 

- The `--profile` option in nextest is not the cargo profile, but refers
to nextest configuration profiles.
- `--nocapture` is a direct argument to nextest, not to the testharness,
so we can remove the preceding `--` seperator.

Testing: Tested by running unit-tests in CI
Fixes: #39797

---------

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-10-14 19:29:54 +00:00
Mukilan Thiyagarajan
44c2365ec8 nix: Update Android NDK version in shell.nix (#39680)
Servo now requires r28 of the NDK. This needs to land after #39625 as
the newer NDK is not available in the current pinned version of nixpkgs.

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2025-10-11 12:01:02 +00:00
shuppy
a1dd6a2ce0 NixOS: bump nixpkgs and fix etc/devtools_parser.py (#39625)
this patch bumps nixpkgs to [the
tip](5b5be50345)
of [nixos-25.05](https://github.com/NixOS/nixpkgs/commits/nixos-25.05).
this is still not new enough for X11-based machines on NixOS 25.11
(#39623), so i’ve added a note explaining what to do in that situation.

LLVM 14 will be removed in NixOS 25.11, so this patch also bumps LLVM to
the latest available stable (14 → 20). #30587 and #31054 are no longer
relevant, and #31059 is hopefully no longer relevant.

we also remove wireshark from the buildInputs, since it installs a
broken tshark(1) that lacks the necessary capabilities to capture
packets from loopback interfaces. to use etc/devtools_parser.py, install
wireshark with your system package manager, or for NixOS, enable the
option: `programs.wireshark.enable = true;`

Testing: no tests needed, since it only affects the NixOS dev
environment
Fixes: #39624 
Fixes: #31059 
Related: #39623

---------

Signed-off-by: Delan Azabani <dazabani@igalia.com>
2025-10-11 05:42:45 +00:00
webbeef
3225d19907 cargo: Bump rustc to 1.89 (#36818)
Update Rustc to 1.89.

Reviewable by commit.

Leftover work:
- #37330 
- #38777

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Co-authored-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-08-19 11:07:53 +00:00
Michael Mc Donnell
9aa06b2c17 Fix DBus warning when running mach (#37818)
I get the following warning message I run ./mach build:
```console
Could not generate notification: No module named 'dbus'
```

I asked in the Zulip chat[1] if anyone was still using the feature and
it sounds like most people do not use it anymore. It has been broken a
while too and no one has stepped up to fix it.

Gnome Terminal will automatically show a notification when a long
running command is done. Some other terminals can also be configured to
automatically show a notification when a long running command is done.

I think it is safe to remove the feature.

[1]
https://servo.zulipchat.com/#narrow/channel/263398-general/topic/DBus.20warning.20when.20running.20.60.2E.2Fmach.20build.60

Testing: I manually tested it on Linux by running ./mach bootstrap
followed by ./mach build

Signed-off-by: Michael Mc Donnell <michael@mcdonnell.dk>
2025-07-02 23:17:01 +00:00
Delan Azabani
4814e7f742 Install tshark for automated tests in #36033 (#36201)
Signed-off-by: Delan Azabani <dazabani@igalia.com>
2025-03-28 09:43:03 +00:00
Mukilan Thiyagarajan
d496b62553 build: bump nixpkgs to nixos-unstable (#36140)
This fixes an issue with cargo-deny 0.16.3 that causes all crates to be
reported as "yanked" even though they are not. This patch upgrades
cargo-deny to 0.18.2 which works correctly.

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2025-03-25 11:34:57 +00:00
Mukilan Thiyagarajan
cceff77928 Bump channel in shell.nix to support rustc 1.85. (#35643)
PR #35628 bumped the rustc version to 1.85, but this broke nix-based
systems as these also require bumping the channel for the 'rust-overlay'
module to a commit that includes support for that version of rustc.

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2025-02-25 11:49:31 +00:00
Delan Azabani
2db828f0c7 Add minimal libservo example using winit (#35118)
* Add minimal libservo example using winit

Signed-off-by: Delan Azabani <dazabani@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>

* CI: include examples in libservo compile test

Signed-off-by: Delan Azabani <dazabani@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>

* CI: build libservo with `continue-on-error`

Signed-off-by: Delan Azabani <dazabani@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>

---------

Signed-off-by: Delan Azabani <dazabani@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2025-01-23 12:15:53 +00:00
Nico Burns
deb819f233 Upgrade rustc to 1.83 (#34793)
* Upgrade rustc to 1.83

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix crown (change copied from linked clippy function)

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix named lifetime lint

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Bump shell.nix

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix non-local impl warnings

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Format with 1.83 formatting changes

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix manual non-local impl

Signed-off-by: Nico Burns <nico@nicoburns.com>

* More fixes for crown

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix tidy

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix needless_return lints

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix doc comment lint

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix missing wait lint

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Allow needless_lifetimes lint

Signed-off-by: Nico Burns <nico@nicoburns.com>

* more doc comments

Signed-off-by: Nico Burns <nico@nicoburns.com>

* More needless_returns

Signed-off-by: Nico Burns <nico@nicoburns.com>

* is_empty lint

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix needless_lifetime lints

Signed-off-by: Nico Burns <nico@nicoburns.com>

* fix div_ceil lint

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Allow non-minimal bool

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Non-local impl in constellation

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Missing wait in constellation

Signed-off-by: Nico Burns <nico@nicoburns.com>

* fmt

Signed-off-by: Nico Burns <nico@nicoburns.com>

* remove useless lints table

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fixup comments

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Allow non-local definition in sandboxing code to simplify feature flagging

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Remove wait calls and allow zombie_processes lint

Signed-off-by: Nico Burns <nico@nicoburns.com>

---------

Signed-off-by: Nico Burns <nico@nicoburns.com>
2025-01-01 09:38:28 +00:00
Mukilan Thiyagarajan
adfee3daa5 mach: recreate .venv when .python-version changes (#34712)
The new images published in servo/ci-runners#12 should have `uv`
installed already and the initial build of servo triggered during the
base image construction will force the installation of the Python
version mentioned at the time of the image construction (3.12). When
.python-version changes, we can no longer use the .venv baked into the
image and must recreate the it to avoid activating the environment.

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-12-20 09:55:21 +00:00
Mukilan Thiyagarajan
88a35b3cc9 mach: adopt uv and avoid system python (#34632)
This allows us to use `uv` for:
1. Installing a pinned Python version
2. Installing the dependency packages using `uv`'s pip compatible interface.
4. Bootstrapping `mach` without a Python installion on the host, using `uv
   run`

This change also introduces a new 'composite' GitHub action to setup
python in the different CI workflows. There is no support for externally
managed python installations and virtual environments. These could be
added in the future.

Fixes #34095, #34547

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-12-16 09:20:37 +00:00
Mukilan Thiyagarajan
7fcde1f7a3 build: upgrade rustc to 1.81.0 (#34270)
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-12-12 07:26:16 +00:00
Mukilan Thiyagarajan
2f64dde623 Revert "mach: switch to uv for managing python venv (#34504)" (#34548)
This reverts commit 4103421ba5.

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-12-10 03:43:50 +00:00
Mukilan Thiyagarajan
4103421ba5 mach: switch to uv for managing python venv (#34504)
This patch switches servo to use `uv` for both installing a pinned
Python version as well as installing the dependency packages using
`uv`'s pip compatible interface. It also introduces a new 'composite'
GitHub action to setup python in the different CI workflows.

There is no support for externally managed python installations and
virtual environments. These could be added in the future.

Fixes #34095

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-12-09 14:52:06 +00:00
Delan Azabani
c05612fc9a Fix nix-shell without an explicit path (#34327)
Signed-off-by: Delan Azabani <dazabani@igalia.com>
2024-11-21 12:08:06 +00:00
Delan Azabani
ab2b001265 Nix: allow nix-shell without explicit path to shell.nix (#32035) 2024-04-17 07:02:31 +00:00