NewPipeExtractor (Java) → strawcore (Rust) migration begins. Phase U:
- U-1: Rust toolchain + UniFFI smoke test
- U-2: rustypipe search via uniffi suspend fun, SearchViewModel swapped
What landed:
- rust/strawcore — UniFFI-exported Rust crate using proc-macros.
Builds for arm64-v8a + armeabi-v7a + x86 + x86_64 via cargo-ndk.
Tokio multi-thread runtime singleton drives rustypipe's async API.
- strawApp/build.gradle.kts — cargoBuildHost + cargoBuild + uniffiBindgen
Gradle Exec tasks chained into the Android build. Generated Kotlin
bindings land in src/main/java/uniffi/strawcore/ (gitignored).
- SearchViewModel.kt — calls uniffi.strawcore.search(query) directly.
NewPipeExtractor still in deps for VideoDetail/Player/Channel paths;
those move to Rust in U-3 / U-4.
- Build chain quirks beat:
* cargo absolute path in Exec tasks (PATH wasn't propagating)
* uniffi-bindgen needs UNSTRIPPED host .so — separate cargoBuildHost
builds a debug-profile host lib to read metadata from
* rustypipe rustls-tls-webpki-roots avoids the openssl-sys
cross-compile tarpit
* rquickjs-sys 'bindgen' feature opted in (no prebuilt Android
bindings ship; crafting-table has libclang 14)
- crafting-table runtime install (until Dockerfile catches up):
rustup + 4 Android targets + cargo-ndk + NDK r27c. Persists in
/caches/cargo + /caches/android-sdk via the volume mount.
APK size: 22MB (U-1) → 37MB (U-2). libstrawcore.so 3-5MB per ABI carries
rustypipe + reqwest + tokio + rustls + rquickjs. NewPipeExtractor still
in for now (still drives detail + player + channel + feed), so the
Java half is doubled up. U-5 removes it.
46 lines
2 KiB
TOML
46 lines
2 KiB
TOML
[package]
|
|
name = "strawcore"
|
|
version = "0.1.0"
|
|
edition.workspace = true
|
|
license.workspace = true
|
|
authors.workspace = true
|
|
repository.workspace = true
|
|
|
|
[lib]
|
|
# cdylib — the .so that Android loads via System.loadLibrary("strawcore").
|
|
# staticlib — kept in case we ever want to link statically for a benchmark.
|
|
crate-type = ["cdylib", "staticlib"]
|
|
|
|
[dependencies]
|
|
# UniFFI generates the Kotlin bindings + the JNI glue. proc-macro mode
|
|
# (no .udl file) — annotate Rust fns directly with #[uniffi::export].
|
|
# `tokio` feature wires `#[uniffi::export(async_runtime = "tokio")]` so async
|
|
# fns surface as suspend fun on the Kotlin side.
|
|
uniffi = { version = "0.28", features = ["cli", "tokio"] }
|
|
# Tokio multi-thread runtime — rustypipe is async-first.
|
|
tokio = { version = "1", features = ["rt-multi-thread", "macros", "sync"] }
|
|
# rustypipe — the actual YouTube Innertube client. Phase U-2 wires search.
|
|
# Force rustls + webpki-roots so we don't pull openssl-sys (cross-compiling
|
|
# system OpenSSL to four Android ABIs is a tarpit; rustls is pure-Rust).
|
|
rustypipe = { version = "0.11", default-features = false, features = ["rustls-tls-webpki-roots"] }
|
|
# rquickjs-sys (transitive dep of rustypipe for YT signature decryption JS)
|
|
# doesn't ship prebuilt Android bindings. Direct-depend with `bindgen` feature
|
|
# so it generates them at build time. Crafting-table has libclang preinstalled.
|
|
rquickjs-sys = { version = "0.9", default-features = false, features = ["bindgen"] }
|
|
# Error glue.
|
|
thiserror = "1"
|
|
# Single-threaded init for the runtime + extractor singletons.
|
|
once_cell = "1"
|
|
# Android log integration — `log::info!()` ends up in `adb logcat -s strawcore`.
|
|
log = "0.4"
|
|
android_logger = { version = "0.14", default-features = false }
|
|
|
|
[build-dependencies]
|
|
uniffi = { version = "0.28", features = ["build"] }
|
|
|
|
[[bin]]
|
|
# Generates Kotlin bindings from the compiled .so:
|
|
# cargo run --bin uniffi-bindgen generate --library target/.../libstrawcore.so \
|
|
# --language kotlin --out-dir ../../strawApp/src/main/kotlin
|
|
name = "uniffi-bindgen"
|
|
path = "src/uniffi-bindgen.rs"
|