Files
servo/ports/servoshell/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

150 lines
5.1 KiB
TOML

[package]
name = "servoshell"
build = "build.rs"
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
[lib]
name = "servoshell"
path = "lib.rs"
bench = false
[[bin]]
name = "servoshell"
path = "main.rs"
bench = false
[lints.rust]
# These are not official flags but still used for testing and pgo.
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage)', 'cfg(llvm_pgo)'] }
# Some of these dependencies are only needed for a specific target OS, but
# since build-scripts can't detect the Cargo target OS at build-time, we
# must unconditionally add these dependencies. See https://github.com/rust-lang/cargo/issues/4932
[build-dependencies]
# macOS only
cc = "1.2"
[target.'cfg(windows)'.build-dependencies]
winresource = "0.1"
[package.metadata.winresource]
FileDescription = "ServoShell"
LegalCopyright = "© The Servo Project Developers"
OriginalFilename = "servoshell.exe"
ProductName = "ServoShell"
[features]
default = ["baked-in-resources", "gamepad", "servo/clipboard", "js_jit", "max_log_level", "webgpu", "webxr"]
baked-in-resources = ["servo/baked-in-resources"]
crown = ["servo/crown"]
debugmozjs = ["servo/debugmozjs"]
gamepad = ["servo/gamepad"]
jitspew = ["servo/jitspew"]
js_backtrace = ["servo/js_backtrace"]
js_jit = ["servo/js_jit"]
max_log_level = ["log/release_max_level_info"]
media-gstreamer = ["servo/media-gstreamer"]
native-bluetooth = ["servo/native-bluetooth"]
profilemozjs = ["servo/profilemozjs"]
refcell_backtrace = ["servo/refcell_backtrace"]
tracing = ["dep:tracing", "dep:tracing-subscriber", "servo/tracing"]
tracing-hitrace = ["tracing", "dep:hitrace"]
tracing-perfetto = ["tracing", "dep:tracing-perfetto"]
vello = ["servo/vello"]
webgl_backtrace = ["servo/webgl_backtrace"]
webgpu = ["servo/webgpu"]
webxr = ["servo/webxr"]
[dependencies]
accesskit = { workspace = true }
bpaf = { version = "0.9.24", features = ["derive"] }
cfg-if = { workspace = true }
crossbeam-channel = { workspace = true }
dpi = { workspace = true }
euclid = { workspace = true }
hitrace = { workspace = true, optional = true }
image = { workspace = true }
keyboard-types = { workspace = true }
libc = { workspace = true }
log = { workspace = true }
mime_guess = { workspace = true }
raw-window-handle = { workspace = true }
rustls = { workspace = true, features = ["aws-lc-rs"] }
servo = { workspace = true, features = ["background_hang_monitor", "bluetooth", "testbinding"], default-features = false }
tokio = { workspace = true }
tracing = { workspace = true, optional = true }
tracing-perfetto = { workspace = true, optional = true }
tracing-subscriber = { workspace = true, optional = true, features = ["env-filter"] }
url = { workspace = true }
webdriver_server = { workspace = true }
[target.'cfg(target_os = "android")'.dependencies]
android_logger = "0.15"
jni = "0.21.1"
[target.'cfg(not(target_os = "android"))'.dependencies]
backtrace = { workspace = true }
[target.'cfg(target_env = "ohos")'.dependencies]
env_filter = "0.1.4"
euclid = { workspace = true }
hilog = "0.2.2"
# force inprocess until we add multi-process support for ohos
ipc-channel = { workspace = true, features = ["force-inprocess"] }
napi-derive-ohos = "1.1.6"
napi-ohos = "1.1.6"
ohos-abilitykit-sys = { version = "0.1.5", features = ["api-14"] }
ohos-deviceinfo = "0.1.0"
ohos-ime = "0.4.2"
ohos-ime-sys = "0.2.3"
ohos-vsync = "0.1.3"
ohos-window-manager-sys = { version = "0.1", features = ["api-14"] }
xcomponent-sys = { version = "0.3.5", features = ["api-14", "keyboard-types"] }
[target.'cfg(any(target_os = "android", target_env = "ohos"))'.dependencies]
servo-base = { workspace = true }
nix = { workspace = true, features = ["fs"] }
serde_json = { workspace = true }
surfman = { workspace = true, features = ["sm-angle-default"] }
[target.'cfg(not(any(target_os = "android", target_env = "ohos")))'.dependencies]
dirs = "6.0"
egui = { version = "0.33.3", features = ["accesskit"] }
egui-file-dialog = "0.12.0"
egui-winit = { version = "0.33.3", default-features = false, features = ["accesskit", "clipboard", "wayland"] }
egui_glow = { version = "0.33.3", features = ["winit"] }
gilrs = "0.11.1"
glow = { workspace = true }
headers = { workspace = true }
serde_json = { workspace = true }
# For optional feature servo-allocator/use-system-allocator and servo-allocator/allocation-tracking
servo-allocator = { workspace = true }
surfman = { workspace = true, features = ["sm-raw-window-handle-06", "sm-x11"] }
winit = { workspace = true }
[target.'cfg(any(all(target_os = "linux", not(target_env = "ohos")), target_os = "macos"))'.dependencies]
sig = "1.0"
[target.'cfg(target_os = "windows")'.dependencies]
servo = { workspace = true, features = ["no-wgl"] }
windows-sys = { workspace = true, features = ["Win32_Graphics_Gdi", "Win32_System_Console"] }
[target.'cfg(target_os = "macos")'.dependencies]
objc2-app-kit = { version = "0.3.2", default-features = false, features = [
"std",
"NSColorSpace",
"NSResponder",
"NSView",
"NSWindow",
] }
objc2-foundation = { version = "0.3.1", default-features = false, features = [
"std",
] }