Files
servo/components/net/Cargo.toml
Jonathan Schwender f4877c190e Embed default resources in Servo applications using a servo-default-resources crate (#43182)
This PR considers the following constraints:

- Resources must be available when building servo via a published
crates.io package (i.e. no `../../../resources/<file>` file references).
- Minimal setup when writing tests (`nextest` spawns each test in its
own process, so we don't want to explicitly initialize the resource
handler for every `#[test]` fn)
- Use local resources when developing locally
- Support loading the resources from a proper resource directory if the
embedder wishes so, including via a custom mechanism, not necessarily as
files

(File) Resources that are only accessed from servoshell are out of scope
of this PR, since it mainly focusses on unblocking publishing `libservo`
to crates.io.

Baking the resources into the binary by default simplifies the setup a
lot. We already supported that before, but only for testing purposes and
explicitly not for production builds.

Using [`inventory`](https://crates.io/crates/inventory) adds a simple
way for the embedder to replace the default baked in resources, while
also keeping the test usage of baked in resources simple.

rippy.png is also referenced from image_cache - We simply duplicate it,
since the image is small, to avoid adding unnecessarily complex
solutions like adding a dedicated crate.


Testing: Covered by existing tests. [mach try
full](https://github.com/jschwe/servo/actions/runs/23811669469)
Fixes: Part of #43145

---------

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2026-04-01 07:16:28 +00:00

101 lines
3.3 KiB
TOML

[package]
name = "servo-net"
version.workspace = true
authors.workspace = true
license.workspace = true
edition.workspace = true
publish.workspace = true
rust-version.workspace = true
repository.workspace = true
description.workspace = true
autotests = false # Inhibit lookup for tests/*.rs without [[test]] sections
[lib]
name = "net"
path = "lib.rs"
test = false
doctest = false
[features]
test-util = ["hyper-util/server-graceful", "dep:servo-default-resources"]
[dependencies]
async-compression = { version = "0.4.12", default-features = false, features = ["brotli", "gzip", "tokio", "zlib", "zstd"] }
async-recursion = "1.1"
async-tungstenite = { workspace = true }
base64 = { workspace = true }
bytes = "1"
chrono = { workspace = true }
content-security-policy = { workspace = true }
cookie = { workspace = true }
crossbeam-channel = { workspace = true }
data-url = { workspace = true }
devtools_traits = { workspace = true }
embedder_traits = { workspace = true }
fst = "0.4"
futures = { workspace = true }
futures-core = { workspace = true }
futures-util = { workspace = true }
generic-array = "0.14"
headers = { workspace = true }
http = { workspace = true }
http-body-util = { workspace = true }
hyper = { workspace = true, features = ["client", "http1", "http2"] }
hyper-rustls = { workspace = true }
hyper-util = { workspace = true }
hyper_serde = { workspace = true }
imsz = { workspace = true }
ipc-channel = { workspace = true }
itertools = { workspace = true }
log = { workspace = true }
malloc_size_of = { workspace = true }
malloc_size_of_derive = { workspace = true }
mime = { workspace = true }
mime_guess = { workspace = true }
net_traits = { workspace = true }
nom = { workspace = true }
paint_api = { workspace = true }
parking_lot = { workspace = true }
pixels = { workspace = true }
profile_traits = { workspace = true }
quick_cache = { version = "0.6.18", default-features = false, features = ["ahash"] }
regex = { workspace = true }
resvg = { workspace = true }
rustc-hash = { workspace = true }
rustls = { workspace = true, features = ["aws-lc-rs"] }
rustls-pki-types = { workspace = true }
rustls-platform-verifier = { workspace = true }
serde = { workspace = true }
servo_arc = { workspace = true }
servo-base = { workspace = true }
servo-config = { workspace = true }
servo-default-resources = { workspace = true, optional = true }
servo-url = { workspace = true }
sha2 = { workspace = true }
time = { workspace = true }
tokio = { workspace = true, features = ["macros", "rt-multi-thread", "sync"] }
tokio-rustls = { workspace = true }
tokio-stream = { workspace = true }
tokio-util = { workspace = true, features = ["codec", "io"] }
tower = { workspace = true }
tungstenite = { workspace = true }
url = { workspace = true }
uuid = { workspace = true }
webpki-roots = { workspace = true }
webrender_api = { workspace = true }
[dev-dependencies]
servo-default-resources = { workspace = true }
flate2 = { workspace = true }
fst = "0.4"
hyper = { workspace = true, features = ["full"] }
hyper-util = { workspace = true, features = ["server-graceful"] }
# This must always be a path dependency, we don't want to add a dependency on a
# crates.io version of ourselves - we want to enable a feature of ourselves.
net = { package = "servo-net", path = ".", features = ["test-util"] }
rustls = { workspace = true, features = ["aws-lc-rs"] }
[[test]]
name = "main"
path = "tests/main.rs"