From 563c9110e4945ba852b42c751e52d5a5c02a2863 Mon Sep 17 00:00:00 2001 From: Ellet Date: Sat, 18 May 2024 13:18:25 +0300 Subject: [PATCH] fix: update the linux example to fix CI failure --- example/.metadata | 2 +- example/linux/CMakeLists.txt | 6 ++++++ example/linux/my_application.cc | 20 ++++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/example/.metadata b/example/.metadata index 65a4a371..e724e168 100644 --- a/example/.metadata +++ b/example/.metadata @@ -15,7 +15,7 @@ migration: - platform: root create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1 base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1 - - platform: android + - platform: linux create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1 base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1 diff --git a/example/linux/CMakeLists.txt b/example/linux/CMakeLists.txt index d67bd4e0..9cb0d1dd 100644 --- a/example/linux/CMakeLists.txt +++ b/example/linux/CMakeLists.txt @@ -123,6 +123,12 @@ foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) COMPONENT Runtime) endforeach(bundled_library) +# Copy the native assets provided by the build.dart from all packages. +set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") +install(DIRECTORY "${NATIVE_ASSETS_DIR}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + # Fully re-copy the assets directory on each build to avoid having stale files # from a previous install. set(FLUTTER_ASSET_DIR_NAME "flutter_assets") diff --git a/example/linux/my_application.cc b/example/linux/my_application.cc index 0ba8f430..c0530d42 100644 --- a/example/linux/my_application.cc +++ b/example/linux/my_application.cc @@ -81,6 +81,24 @@ static gboolean my_application_local_command_line(GApplication* application, gch return TRUE; } +// Implements GApplication::startup. +static void my_application_startup(GApplication* application) { + //MyApplication* self = MY_APPLICATION(object); + + // Perform any actions required at application startup. + + G_APPLICATION_CLASS(my_application_parent_class)->startup(application); +} + +// Implements GApplication::shutdown. +static void my_application_shutdown(GApplication* application) { + //MyApplication* self = MY_APPLICATION(object); + + // Perform any actions required at application shutdown. + + G_APPLICATION_CLASS(my_application_parent_class)->shutdown(application); +} + // Implements GObject::dispose. static void my_application_dispose(GObject* object) { MyApplication* self = MY_APPLICATION(object); @@ -91,6 +109,8 @@ static void my_application_dispose(GObject* object) { static void my_application_class_init(MyApplicationClass* klass) { G_APPLICATION_CLASS(klass)->activate = my_application_activate; G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; + G_APPLICATION_CLASS(klass)->startup = my_application_startup; + G_APPLICATION_CLASS(klass)->shutdown = my_application_shutdown; G_OBJECT_CLASS(klass)->dispose = my_application_dispose; }