Skip to content

Commit

Permalink
feat: Support async updates from the updater library. (#13)
Browse files Browse the repository at this point in the history
* feat: Support async updates from the updater library.

This is the engine side of:
shorebirdtech/updater#11

I also removed passing vmpath (unused) and adjusted names
to be more consistent.

* Add DEPS change
  • Loading branch information
eseidel committed Jun 22, 2023
1 parent d6ef84a commit e813005
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ vars = {
'skia_revision': '0d31aa1f49cb8cfd790c44d92a9a023839524865',

'updater_git': 'https://github.com/shorebirdtech/updater.git',
'updater_rev': 'bc19f5df79005d65073debdc736f17ca6d827f89',
'updater_rev': '4ab78869b8e75f10450d6156c92d9ab7dc401516',

# WARNING: DO NOT EDIT canvaskit_cipd_instance MANUALLY
# See `lib/web_ui/README.md` for how to roll CanvasKit to a new version.
Expand Down
2 changes: 1 addition & 1 deletion shell/common/shell.cc
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ std::unique_ptr<Shell> Shell::Create(
// non-android targets (e.g. flutter_tester) will fail to link.
#if FML_OS_ANDROID
if (!vm) {
shorebird_report_failed_launch();
shorebird_report_launch_failure();
}
#endif
FML_CHECK(vm) << "Must be able to initialize the VM.";
Expand Down
23 changes: 12 additions & 11 deletions shell/platform/android/flutter_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,34 +120,35 @@ void ConfigureShorebird(std::string android_cache_path,
app_parameters.original_libapp_paths = c_paths.data();
app_parameters.original_libapp_paths_size = c_paths.size();

app_parameters.vm_path = "libflutter.so"; // Unused.

// shorebird_init copies from app_parameters and shorebirdYaml.
shorebird_init(&app_parameters, shorebirdYaml.c_str());
}

FML_LOG(INFO) << "Starting Shorebird update";
shorebird_update();

char* c_active_path = shorebird_active_path();
char* c_active_path = shorebird_next_boot_patch_path();
if (c_active_path != NULL) {
std::string active_path = c_active_path;
shorebird_free_string(c_active_path);
FML_LOG(INFO) << "Shorebird updater: active path: " << active_path;

settings.application_library_path.clear();
settings.application_library_path.emplace_back(active_path);

char* c_patch_number = shorebird_active_patch_number();
char* c_patch_number = shorebird_next_boot_patch_number();
if (c_patch_number != NULL) {
std::string patch_number = c_patch_number;
shorebird_free_string(c_patch_number);
FML_LOG(INFO) << "Shorebird updater: active patch number: "
<< patch_number;
}

settings.application_library_path.clear();
settings.application_library_path.emplace_back(active_path);
// Once start_update_thread is called, the next_boot_patch* functions may
// change their return values if the shorebird_report_launch_failed
// function is called.
shorebird_report_launch_start();
} else {
FML_LOG(INFO) << "Shorebird updater: no active patch.";
}

FML_LOG(INFO) << "Starting Shorebird update";
shorebird_start_update_thread();
}

void FlutterMain::Init(JNIEnv* env,
Expand Down

0 comments on commit e813005

Please sign in to comment.