Commit Graph

76 Commits

Author SHA1 Message Date
Bryan Oltman 0057c7ea8d chore: delete old counter example, dart_bindings, and dart_cli (#35)
* chore: delete old counter example

* delete dart_bindings and dart_cli
2023-06-20 10:38:09 -04:00
Bryan Oltman f85eda8173 feat(shorebird_code_push): update example to use code push bindings (#33)
* feat(shorebird_code_push): add updater bindings and dart support

* newlines

* docs

* feat(shorebird_code_push): update example to use code push bindings

* Move checkForUpdate into setState

* Update to reflect patch number being sent as int

* polish

* updater test coverage

* Update shorebird_code_push/example/lib/main.dart

Co-authored-by: Felix Angelov <felix@shorebird.dev>

* Analysis

---------

Co-authored-by: Felix Angelov <felix@shorebird.dev>
2023-06-20 10:15:56 -04:00
Bryan Oltman 0222f526a6 chore: use a number instead of a string for next boot patch number (#34) 2023-06-19 22:49:59 -04:00
Bryan Oltman ea48f6cb4f feat(shorebird_code_push): add updater bindings and dart support (#32)
* feat(shorebird_code_push): add updater bindings and dart support

* newlines

* docs

* Remove unused support for dart cli

* clarify Android-specific setup in readme
2023-06-19 20:53:51 -04:00
Bryan Oltman a593540f96 chore(shorebird_code_push): add example project (#31)
* chore(shorebird_code_push): add example project

* use flutter instead of dart in gha
2023-06-19 18:02:43 -04:00
Bryan Oltman 27e7984179 feat: add shorebird_code_push package (#30)
* feat: add shorebird_code_push package

* remove example and extra code

* update github workflow

* fix gha
2023-06-17 14:17:03 -04:00
Bryan Oltman 02c84f6e1d docs: delete UPDATING_ENGINE.md (#21)
Co-authored-by: Eric Seidel <eric@shorebird.dev>
2023-06-12 18:19:36 +00:00
Felix Angelov 21bda06fdf chore: add licenses badges to README (#28) 2023-06-09 15:56:28 -05:00
Felix Angelov d9361f0475 chore: add MIT and Apache licenses (#27) 2023-06-09 15:53:42 -05:00
Felix Angelov dc919cad5a chore: add coverage badge to README (#26) 2023-06-09 15:52:18 -05:00
Felix Angelov 8eb3a46446 ci: upload coverage to codecov (#25) 2023-06-09 20:36:35 +00:00
Eric Seidel bce1508787 fix: remove more unwrap calls. (#24)
Each unwrap() is a potential crash.  Shorebird's updater code
should never crash.

There still are a couple, but I think we should set up coverage
first so we can track that we're testing all these changes.
2023-06-08 15:14:09 -07:00
Eric Seidel 50f0b022df feat: Support iOS (#23)
Adds support for iOS to the updater library.

Refactored the android-specific code into an android module.

The tests still mostly use the android code, rather than testing iOS paths too, but that can be fixed in a follow-up.

I had to change how "latest patch number" works to understand when patch files disappear from disk (which I thought was happening on iOS initially).

I also had to make status.json not store absolute paths to patch files (since the absolute path changes per-xcode run on iOS).
2023-06-08 17:34:10 -04:00
Eric Seidel 4d2ec2e148 feat: Make updater build on iOS (#22)
Doesn't work yet, but does at least build (and log).
2023-05-31 14:44:35 -05:00
Bryan Oltman 11d8c22805 fix: don't panic on missing shorebird.yaml (#18)
* fix: don't panic on missing shorebird.yaml

* fix next_boot_patch C api

* don't log error in updater

* Cleanup

* Remove anyhow::bail import
2023-05-16 16:21:43 -04:00
Eric Seidel 7809b5f6fe Remove mention of cbindgen manual step 2023-05-16 11:42:25 -07:00
Bryan Oltman 7768cfd461 docs: update building instructions to reflect current branching strategy (#17) 2023-05-15 15:53:09 -04:00
Bryan Oltman f8c17c1ffe docs: clarify where gclient sync should be run 2023-05-15 10:42:15 -04:00
Bryan Oltman ffb0640739 docs: update building_engine.md (#15)
* doc: update building_engine.md

* cleanup

* update

* cleanup

* Remove {% note %} tags that don't work
2023-05-09 15:57:11 -07:00
Eric Seidel 594ffe5872 docs: Update BUILDING_ENGINE.md
Fixes https://github.com/shorebirdtech/updater/issues/13
2023-04-26 16:34:15 -07:00
Eric Seidel 226df7d08d test: Make our rust tests use per-thread config rather than global static (#14)
* Make our rust tests use per-thread config rather than global static

This lets our unit tests run in parallel.  I also moved our "integration"
tests back to be unit tests for now.

This also exposes a network mocking abstraction.

I've added an incomplete test of applying a full patch.  Still
needs some work to complete.

* Finish making the patch success test work

* Changed our test config to use println instead of info/error, etc. so that tests show output on failure (there might be a better way?)
Unfortunately macro_use (which is the way we were causing error!, info! etc to appear everywhere with only one global import before, only works on crates not on std, so I had to be explicit with my imports per-file.
* Add a function to build a fake zip file, because that's what the updater currently expects.  Better would be for us to move to a AssetManager system I suspect, then the updater would ask the asset manager for the libapp.so and we'd return it instead of having to go through writing out a zip file.
* Added a string_patch.rs tool and shared code between that and the patch tool.  This made it possible/easy for me to generate the necessary binary patches as well as needed hashes to pretend to be the patch server.
* Added one simple test of the patch tool core logic.

In total we're now above 80% coverage of our rust code after this.

* remove stray comment
2023-04-26 13:07:19 -05:00
Eric Seidel e4a883c8a7 Refactor C API to avoid using unwrap. (#12)
This removes another source of possible crashes from the rust code.

I also took this opportunity to try and test the C-api. I also
discovered rust "integration tests" as part of this and chose
to move some of the (new) c_api tests to an integration test
as well as the existing rust api (updater.rs) tests.
2023-04-25 15:39:33 -05:00
Eric Seidel 4ab78869b8 feat: Add start_updater_thread to update off the main thread (#11)
* feat: Add start_updater_thread to update off the main thread

This makes it so that clients can easily not block when wanting to
queue an update.

I have a separate patch which updates the Engine to use this new
API.

I also needed to split the concept of the "next_boot" patch
from the "current_boot" patch, previously refered to as
"current" or "active" patch.  This required adding a
report_launch_start api to let the updater library know
when to set current_boot patch from next_boot.

I also removed the rust updater/cli in this as well as the
vmpath argument to init.

I also exposed the report_launch_success api, but its not yet
used by the Engine.

I renamed report_failed_launch to report_launch_failure to match
report_launch_start which I introduced.

* Update naming per comments from Felix.

Also added a helper for char* allocation (not sure if it's better).

* Update library/src/updater.rs

---------

Co-authored-by: Felix Angelov <felix@shorebird.dev>
2023-04-25 09:06:40 -07:00
Felix Angelov 182ce073e2 feat(updater): include version_code as part of release_version (#9) 2023-04-19 16:07:09 -05:00
Eric Seidel 1281624ccf Rename release_version to version_name, add version_code, remove vm_path (#8) 2023-04-19 19:46:41 +00:00
Eric Seidel bc19f5df79 fix: Teach update about split apks (#7)
* Teach update about split apks

Fixes https://github.com/shorebirdtech/shorebird/issues/292.

The previous code only worked with universal apks, not split apks (which is what the play store produces).

We now look for APKs in the same directory as base.apk (through the same path hacks as before) and look for one matching the arch/abi name first.  If we don't find one we also check base.apk.

This works in my testing with bundletool locally.

I also removed support for hashes being optional and removed a few unwraps (which will crash on failure).

I also fixed our use of imports/use statements to be a bit more consistent, including using "std::fs" rather than "std::fs::File" in one place but not another.

* Fix failing unit tests
2023-04-17 13:17:08 -07:00
Eric Seidel b19eb16654 fix: Rewrite updater to read libapp.so from apk rather than expecting it on disk (#5)
Fixes shorebirdtech/shorebird#235 🤞

This moves us away from depending on libapp.so having been extracted from the APK and instead we always extract it ourselves.
2023-04-12 14:49:00 -07:00
Eric Seidel c0e22f7e54 Update README.md 2023-04-12 09:04:13 -07:00
Eric Seidel 5c98d17bfb Update README.md 2023-04-12 09:01:56 -07:00
Eric Seidel d6eb5f7f09 Update README.md
Lets see if I wrote this down correctly.
2023-04-12 08:57:19 -07:00
Eric Seidel 4f4081c177 Update README.md 2023-04-12 08:48:19 -07:00
Eric Seidel ed5665cf78 Update README.md
Write down my dev workflow.
2023-04-11 12:07:39 -07:00
Felix Angelov 5f42886163 chore: add example from shorebird/shorebird (#4) 2023-04-07 10:03:54 -05:00
Eric Seidel 241a1dfabf Autogenerate include/updater.h every time we build. (#3)
Turns out this was way easier than I thought.
https://github.com/shorebirdtech/shorebird/issues/121
Docs:
https://github.com/eqrion/cbindgen/blob/master/docs.md#buildrs
2023-04-06 17:14:49 +00:00
Felix Angelov 8232ee34be ci: remove release creation step and adjust trigger 2023-04-06 12:02:01 -05:00
Felix Angelov da86c12fca ci: add build_patch_artifacts workflow (#2) 2023-04-06 11:57:33 -05:00
Felix Angelov e680fe83ca ci: add rust workflow (#1) 2023-04-06 11:06:39 -05:00
Felix Angelov 5055c397e8 feat(updater): use try_exists instead of exists (#218) 2023-04-03 11:08:47 -05:00
Felix Angelov 60a931f0d9 fix(updater): use all base library paths (#206) 2023-03-31 12:44:12 -05:00
Felix Angelov d541d466a8 chore(updater): add context to base and patch files (#203) 2023-03-29 18:47:49 -05:00
Eric Seidel 47522ed63e Add more docs on updater directory 2023-03-29 08:36:03 -07:00
Felix Angelov c923105a7c fix(updater): hash mismatch (#192) 2023-03-28 19:01:42 -05:00
Felix Angelov 0ba3f0169c refactor(updater): remove diff check (#191) 2023-03-28 15:31:21 -07:00
Eric Seidel b6ead34de4 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 0afcb65950 feat: Add patch command for use by cli (#179) 2023-03-27 14:58:52 -05:00
Eric Seidel 6da2bd453e feat: Teach rust side to validate hashes when installing (#171) 2023-03-24 17:53:40 -05:00
Eric Seidel 0d113ab094 feat: Add support for diff patches (#163)
Co-authored-by: Felix Angelov <felix@shorebird.dev>
2023-03-24 19:59:35 +00:00
Felix Angelov fbba2912ba docs: minor update to UPDATING_ENGINE.md 2023-03-22 16:17:52 -05:00
Eric Seidel 587d88d88d Update UPDATING_ENGINE.md 2023-03-22 14:05:48 -07:00
Eric Seidel 05e3d75982 Create UPDATING_ENGINE.md
These are incomplete but better than nothing.
2023-03-22 13:51:00 -07:00