3af4081f55
This is all for shorebirdtech/shorebird#695 I ended up fixing a lot of things in our Rust code while I was in there, including: * Using PathBuf instead of Sting wherever we are holding onto Path objects (this removed a bunch of code which was converting in and out of these). * Made a variety of functions private (the default) that were previously mistakenly pub. * Moved the android hacks around libapp_paths closer to the C++ code. Previously we were storing all of the libapp_paths on ResolvedConfig and handling the android hacks during patch install. Now we're doing the android path hacks on init, eventually we'll remove them entirely by making the C++ code pass us in the android app_dir or even the resolved .apk we need instead of the libapp_paths. * Fixed several tests to use /dir/lib/arch/libapp.so paths instead of 'libapp.so' now that the init code applies the android hacks an expects the deeper paths. Again, this will go away when we move the android hacks into c++. * Added a test which confirms that if we init twice we log instead of trying to init again (this was one behavior which FCM was triggering as part of fix: ANR when using Firebase Cloud Messaging with Shorebird shorebird#695 * Add a test which confirms that further calls to update while an update is ongoing just fail out quickly instead of hanging. * Moved to serial_test instead of a separate per-thread config system for testing. This makes our tests operate more like the code does in the wild, at the cost of needing to annotate a test as #[serial] any time it needs to use shorebird_init. * Removed ResolvedConfig and now call it UpdateConfig. ResolvedConfig previously had a bool on it to tell if it was initialized, that's now represented as Option instead which is more rusty. * Changed how we handle NetworkHooks from being compile-time test switched to using function pointers held off of UpdateConfig.network_hooks. I think this makes more sense? I did this to remove the special ThreadConfig object which was used during unit tests, but didn't exist in production. I think the way we mock networking could still be improved.
66 lines
2.3 KiB
TOML
66 lines
2.3 KiB
TOML
[package]
|
|
name = "updater"
|
|
version = "0.1.0"
|
|
edition = "2021"
|
|
|
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
|
|
[lib]
|
|
# "lib" is used by the "cli" target for testing from Rust
|
|
# "cdylib" is used by the "dart_cli" target for testing from Dart
|
|
# "staticlib" is used by the engine build for linking into libflutter.so
|
|
crate-type = ["lib", "cdylib", "staticlib"]
|
|
|
|
[dependencies]
|
|
# Used for exposing C API
|
|
libc = "0.2.98"
|
|
# Used for networking.
|
|
reqwest = { version = "0.11", default-features = false, features = ["blocking", "json", "rustls-tls"] }
|
|
# Json serialization/de-serialization.
|
|
serde = { version = "1.0", features = ["derive"] }
|
|
serde_json = "1.0.93"
|
|
# Used for error handling for now.
|
|
anyhow = {version = "1.0.69", features = ["backtrace"]}
|
|
# For error!(), info!(), etc macros. `print` will not show up on Android.
|
|
log = "0.4.14"
|
|
# For implementing thread-local-storage of ResolvedConfig object.
|
|
once_cell = "1.17.1"
|
|
# For reading shorebird.yaml
|
|
serde_yaml = "0.9.19"
|
|
# For inflating compressed patch files.
|
|
bipatch = "1.0.0"
|
|
# comde is a wrapper around several compression libraries.
|
|
# We only use zstd and could depend on it directly instead.
|
|
comde = {version = "0.2.3", default-features = false, features = ["zstandard"]}
|
|
# Pipe is a simple in-memory pipe implementation, there might be a std way too?
|
|
pipe = "0.4.0"
|
|
# For computing hashes of patch files for validation.
|
|
sha2 = "0.10.6"
|
|
# For decoding the hex-encoded hashes in Patch network responses.
|
|
hex = "0.4.3"
|
|
# For decompressing .apk files.
|
|
zip = { version = "0.6.4", default-features = false, features = ["deflate"] }
|
|
|
|
|
|
[target.'cfg(target_os = "android")'.dependencies]
|
|
# For logging to Android logcat.
|
|
android_logger = "0.13.0"
|
|
# Send panics to log (instead of stderr), thus logcat on Android.
|
|
log-panics = { version = "2", features = ["with-backtrace"]}
|
|
|
|
[target.'cfg(target_os = "ios")'.dependencies]
|
|
# Use stderr for logging on iOS.
|
|
simple-logging = "2.0.2"
|
|
# Send panics to syslog (instead of stderr).
|
|
log-panics = { version = "2", features = ["with-backtrace"]}
|
|
|
|
[dev-dependencies]
|
|
tempdir = "0.3.7"
|
|
# Gives #[serial] attribute for locking all of our shorebird_init
|
|
# tests to a single thread so they don't conflict with each other.
|
|
serial_test = "2.0.0"
|
|
|
|
# https://github.com/eqrion/cbindgen/blob/master/docs.md#buildrs
|
|
[build-dependencies]
|
|
cbindgen = "0.24.0"
|