scripts/rust-check.sh and scripts/wasm-build.sh (moved from docker/) run natively on the user-level rustup toolchain pinned by rust-toolchain.toml; scripts/rust-env.sh puts ~/.cargo/bin on PATH for non-interactive shells. Root scripts: rust:check and wasm:build native, rust:check:docker and wasm:build:docker through docker/rust-run.sh, check:all = scripts/check-all.sh, the whole pre-merge gate in one command (rust check, types drift, wasm build, pnpm check, application image, worker:test, worker:image started read-only). The native check now runs the worker's unit tests (cargo test --workspace); the sandbox tests stay feature-gated and Docker-only.
58 lines
2.2 KiB
TOML
58 lines
2.2 KiB
TOML
# Faunosteo Rust workspace (plan R0, docs/development/RUST_ARCHITECTURE_REVIEW.md Part III).
|
|
# Three crates: core (feature-gated library), wasm (browser facade), worker (service binary).
|
|
# Commands run on the native toolchain of the development machine (rustup, the channel of
|
|
# rust-toolchain.toml) or inside the builder image: docs/development/RUST.md §1.
|
|
[workspace]
|
|
resolver = "3"
|
|
members = ["crates/core", "crates/wasm", "crates/worker"]
|
|
|
|
[workspace.package]
|
|
version = "0.1.0"
|
|
edition = "2024"
|
|
license = "MIT"
|
|
rust-version = "1.99"
|
|
publish = false
|
|
|
|
# The path dependency on crates/core is declared per crate (`path = "../core"`): cargo-deny
|
|
# 0.20 reads a workspace-inherited path dependency as a wildcard and fails the bans check.
|
|
[workspace.dependencies]
|
|
serde = { version = "1.0.229", features = ["derive"] }
|
|
# preserve_order keeps the input key order of parsed documents (JSON.stringify semantics).
|
|
# float_roundtrip: the default parser is a fast path that can be one ULP off (found by the R0
|
|
# proof: 1715.4285714285713 came back as 1715.428571428571); JavaScript parses correctly.
|
|
serde_json = { version = "1.0.154", features = ["preserve_order", "float_roundtrip"] }
|
|
ts-rs = { version = "12.0", features = ["serde-compat"] }
|
|
# The CLI in docker/rust-builder.Dockerfile must be this exact version.
|
|
wasm-bindgen = "=0.2.129"
|
|
image = { version = "0.25.10", default-features = false, features = ["jpeg", "png", "webp"] }
|
|
libwebp-sys = "0.14.4"
|
|
seccompiler = "0.5.0"
|
|
rlimit = "0.11"
|
|
libc = "0.2"
|
|
|
|
# The library crates deny unwrap/expect so that no panic path depends on content;
|
|
# the worker binary relaxes disallowed_methods (it owns I/O) in its own [lints].
|
|
[workspace.lints.rust]
|
|
unsafe_code = "forbid"
|
|
|
|
[workspace.lints.clippy]
|
|
unwrap_used = "deny"
|
|
expect_used = "deny"
|
|
disallowed_methods = "deny"
|
|
|
|
# Dependencies optimised even in debug builds: the sandbox tests decode 4096² images under a
|
|
# 10 s CPU limit, which an unoptimised image decoder does not meet.
|
|
[profile.dev.package."*"]
|
|
opt-level = 3
|
|
|
|
[profile.release]
|
|
opt-level = 3
|
|
lto = "fat"
|
|
codegen-units = 1
|
|
# The worker child dies on a panic (the parent logs it); on wasm32 the std is abort anyway.
|
|
panic = "abort"
|
|
strip = "symbols"
|
|
|
|
[profile.release.package.faunosteo-wasm]
|
|
opt-level = "z"
|