Commit Graph

31 Commits

Author SHA1 Message Date
Felix Angelov b939ef074d feat(updater): use try_exists instead of exists (#218) 2023-04-03 11:08:47 -05:00
Felix Angelov 9734b12ed3 fix(updater): use all base library paths (#206) 2023-03-31 12:44:12 -05:00
Felix Angelov b67c34cc48 chore(updater): add context to base and patch files (#203) 2023-03-29 18:47:49 -05:00
Felix Angelov f2918cfca6 fix(updater): hash mismatch (#192) 2023-03-28 19:01:42 -05:00
Felix Angelov 8d13d02813 refactor(updater): remove diff check (#191) 2023-03-28 15:31:21 -07:00
Eric Seidel d3db325d9c Add instructions for building libupdater.a with Flutter's NDK
Flutter uses a very old NDK (v16 iirc) but thankfully it pulls
down it's Android NDK into third_party/android_tools/ndk.  Update
our instructions to explain how to use that ndk when building.

If we don't link against that ndk the arm64 version seems to work
fine, but the arm32 version seems to depend on an extra symbol
which the older ndk does not expose.  Linking against the correct
ndk gets rust to do the right thing.

There was a separate change to fix a *second* missing symbol
caused by the ring crate (from rustls, from reqwests) depending
on getauxval, but that we changed by exposing a stub copy
from the flutter engine code for now.
2023-03-28 12:41:02 -07:00
Eric Seidel b64299151e feat: Add patch command for use by cli (#179) 2023-03-27 14:58:52 -05:00
Eric Seidel e869fc3da5 feat: Teach rust side to validate hashes when installing (#171) 2023-03-24 17:53:40 -05:00
Eric Seidel 0ba204e5c0 feat: Add support for diff patches (#163)
Co-authored-by: Felix Angelov <felix@shorebird.dev>
2023-03-24 19:59:35 +00:00
Eric Seidel 337d8c4ceb fix: don't crash repeatedly on bad patches
Combined with the fix in the engine:
https://github.com/shorebirdtech/engine/commit/4288ae1125e38a772c6cc8a918ed020c276534a4
This makes it so the updater no longer crashes repeatedly with bad patches.  Previously
1. the engine was not successfully reporting a patch bad before crashing (now it does just before crashing).
2. With that fixed, the patch was getting marked bad, but because we were sending the "current" patch to the server, the server would tell us to download a new one every time (which we would not check against our bad patches) and we'd repeatedly boot of a "new" known-bad patch.  This is now fixed to both send the latest_installed_patch to the server (as patch_version) as well as refusing to install known bad patches.
3. Fixed the cache to destroy itself on version change (which I expect could hit us when an app upgrades its cache might not get cleared).
4. Also fixed tests being flakey because TempDir cleans up after itself when it goes out of scope (thus needs to be held at the test-lifetime scope rather than inside init_for_testing).
2023-03-21 10:46:07 -07:00
Eric Seidel 645ee23ec6 Expose "report_launch_failure" so engine can call it. (#97) 2023-03-20 17:32:03 -05:00
Felix Angelov 43ba6903b4 chore: update base url to api.shorebird.dev (#93) 2023-03-20 14:33:54 -05:00
Felix Angelov fe085530d6 refactor(updater): create PatchCheckRequest struct (#92) 2023-03-17 17:44:27 -05:00
Eric Seidel a18d37b186 Separate patch download/install
This separates patch download from install, which makes it possible for us to later asynchronously download patches into the downloads spot and then install them on completion.

This also makes marking patches good/bad actually do something and tests that it does something.

We're still quite aways away from actually validating patches and having good/bad be meaningful (for example good/bad are never called by the engine code yet) but this is a step in that direction.

activate_latest_bootable_patch is also only used the "set bad" codepath, and isn't even used when installing patches (those still manually set the current slot).

This also makes it so the slot index is now optional, which makes slightly more sense?  And would be needed in the case where you have a single bad patch installed in slot 1, with slot 0 empty/invalid and you resolve to a "None" selected.

Lots more to do here, but this is a start.
2023-03-17 13:53:04 -07:00
Felix Angelov e91f2dbaac refactor(updater): conform to new backend interfaces (#90) 2023-03-17 13:00:35 -05:00
Eric Seidel 534f2b6376 feat: Add two more rust tests (#82) 2023-03-16 11:18:30 -07:00
Eric Seidel 7746964817 feat: Start adding rust tests. (#81) 2023-03-16 12:01:44 -05:00
Felix Angelov 180e959ec1 refactor(updater): remove client_id (#78) 2023-03-15 14:18:29 -05:00
Felix Angelov 62bed70bf5 chore: rename product_id to app_id (#77) 2023-03-15 14:11:13 -05:00
Eric Seidel ea132796f5 Remove duplicate imports 2023-03-15 09:49:07 -07:00
Eric Seidel d880898b85 refactor: Use methods instead of free functions with UpdateState (#74) 2023-03-15 09:45:18 -07:00
Eric Seidel f2d70032e6 chore: fix TODO about libapp.txt (#73) 2023-03-15 11:29:24 -05:00
Eric Seidel b8aedb5cb3 docs: Add ability to mark patches good/bad (not used yet) (#70) 2023-03-14 14:41:28 -07:00
Eric Seidel e13e4cc6ea Move current_platform and current_arch to config.rs 2023-03-13 09:50:53 -07:00
Eric Seidel 40a08885c8 Log the outbound json 2023-03-13 09:38:31 -07:00
Eric Seidel f6a27229c6 Log network responses in rust 2023-03-13 09:24:04 -07:00
Eric Seidel 10f9e4ff6f feature: Teach the rust updater library about shorebird.yaml (#54) 2023-03-10 23:49:19 -06:00
Felix Angelov f9f9897b53 feat: upgrade shorebird tools to new API (#52) 2023-03-09 17:38:01 -06:00
Eric Seidel c59205d079 Make updater library thread safe
This was needed so that it could be called from Dart as well as flutter_main/C++.

It turns out flutter_main does not run on the "ui thread", so when Dart was calling
into the updater it would panic due to thinking the updater (which was using a thread local) was not yet initialized.

Also added the log-panics crate on Android so that panics appear in adb logcat.
2023-03-08 13:03:13 -08:00
Eric Seidel dcf5f080ad refactor: split updater library into layers (#47) 2023-03-08 11:11:10 -06:00
Eric Seidel c13091b721 chore: Fix the rust build (#27) 2023-03-06 15:06:31 -08:00