straw/rust/Cargo.toml
Cobb 5021749975
Some checks failed
build-apk / build-and-publish (push) Successful in 8m2s
gitleaks / scan (push) Failing after 1s
speed(wrapper): opt-level=2 for the JS-interpreter crates (S5)
opt-level=2 (over the profile's size-first 'z') for rquickjs-sys, regex-automata
and serde_json — the QuickJS C interpreter + regex DFA + JSON parse hot paths;
bounded APK-size cost to those crates. Also carries the strawcore visionOS-OFF
outage fix into the build via the CI strawcore clone (restores muxed playback).
2026-07-29 08:25:47 -07:00

56 lines
2.2 KiB
TOML

# Straw Rust core — workspace.
# Hosts the JNI/UniFFI-exported library that replaces NewPipeExtractor.
#
# Builds via cargo-ndk for the four Android ABIs (arm64-v8a, armeabi-v7a,
# x86, x86_64). The Mozilla rust-android-gradle plugin wires this into the
# strawApp Gradle build so `./gradlew assembleDebug` produces a single APK
# with the .so files packed inside.
[workspace]
resolver = "2"
members = ["strawcore"]
[workspace.package]
edition = "2021"
license = "GPL-3.0-or-later"
authors = ["Sulkta"]
repository = "https://git.sulkta.com/Sulkta-OSS/straw"
[profile.release]
# Strip debug info, run thin LTO. APK size matters more than build time here.
strip = true
lto = "thin"
codegen-units = 1
# unwind (NOT abort): panic=abort defeats UniFFI's catch_unwind AND tokio's
# spawn_blocking JoinError capture, turning ANY panic in the extractor core
# (which chews weekly-rotating, attacker-influenced YouTube payloads) into an
# instant whole-app SIGABRT. unwind restores both safety nets so a core panic
# surfaces as a caught StrawcoreException instead of crashing the app. The
# unwind-table size cost is a rounding error against the 4-ABI jniLibs payload.
# (straw + FFI-wrapper audits, 2026-07-04.)
panic = "unwind"
opt-level = "z"
# Per-package opt-level overrides (Straw speed audit, S5). The whole tree stays
# size-optimized ("z"), but the JS-interpreter + parsing hot paths run measurably
# slow at "z" — QuickJS's C bytecode interpreter, the regex DFA engine, and JSON
# deserialization are all tight inner loops where "z" trades real runtime for a
# few KB. Bumping ONLY these three to opt-level = 2 bounds the APK-size cost to
# these crates while restoring interpreter/parse throughput. Crate names verified
# present in Cargo.lock: rquickjs-sys (QuickJS C interpreter, compiled via cc),
# regex-automata (regex execution engine, pulled by `regex`), serde_json.
[profile.release.package.rquickjs-sys]
opt-level = 2
[profile.release.package.regex-automata]
opt-level = 2
[profile.release.package.serde_json]
opt-level = 2
# `url` crate for video-id extraction in stream.rs.
[workspace.dependencies]
url = "2"
[profile.dev]
# Keep debug builds fast — we rebuild often during NDK cross-compile.
opt-level = 0
debug = 1