From 882eeb6a44b443ef13a4b3111330cd0b603d3f1b Mon Sep 17 00:00:00 2001 From: Joel Winarske Date: Wed, 31 May 2023 18:35:35 -0700 Subject: [PATCH] Flutter bbclass refactor -remove use of bbclass runtime modes -use external automation-workspace repo Scott Murray: - update flutter-auto agl-shell platform channel plugin patch with reworked version from Marius Vlad. Bug-AGL: SPEC-4819 Change-Id: I7510f916ab70d8bab78fdb9ab235092f84c3713a Signed-off-by: Joel Winarske Signed-off-by: Scott Murray --- meta-agl-flutter/README.md | 110 ++++++--------- meta-agl-flutter/conf/include/agl-flutter.inc | 4 +- .../files/0001-clang-toolchain.patch | 44 ++++++ .../files/0002-x64-sysroot-assert.patch | 25 ++++ .../files/0003-remove-x11-dependency.patch | 29 ++++ ...efinition-of-glib_autoptr_clear_AtkObject.patch | 36 +++++ .../flutter-engine/flutter-engine_%.bbappend | 1 + .../flutter-engine/flutter-engine_aglflutter.inc | 11 ++ .../flutter-sdk/flutter-sdk_%.bbappend | 1 + ...sdk_git.bbappend => flutter-sdk_aglflutter.inc} | 0 .../files/0001-Add-optional-agl_shell-plugin.patch | 111 ++++++++------- .../images/agl-image-flutter-runtimeprofile.bb | 26 ---- .../images/agl-image-flutter-runtimerelease.bb | 22 --- ...lutter-runtimedebug.bb => agl-image-flutter.bb} | 9 +- meta-agl-flutter/tools/.gitignore | 151 ++++++++++++++++++++ meta-agl-flutter/tools/configs/_globals.json | 5 + meta-agl-flutter/tools/configs/_repos.json | 48 +++++++ .../tools/configs/agl-qemu-master.json | 114 +++++++++++++++ .../tools/configs/agl-qemu-octopus.json | 114 +++++++++++++++ meta-agl-flutter/tools/configs/desktop-auto.json | 136 ++++++++++++++++++ meta-agl-flutter/tools/flutter_workspace.py | 1 + .../tools/flutter_workspace_config.json | 156 --------------------- 22 files changed, 828 insertions(+), 326 deletions(-) create mode 100644 meta-agl-flutter/recipes-graphics/flutter-engine/files/0001-clang-toolchain.patch create mode 100644 meta-agl-flutter/recipes-graphics/flutter-engine/files/0002-x64-sysroot-assert.patch create mode 100644 meta-agl-flutter/recipes-graphics/flutter-engine/files/0003-remove-x11-dependency.patch create mode 100644 meta-agl-flutter/recipes-graphics/flutter-engine/files/0004-prevent-redefinition-of-glib_autoptr_clear_AtkObject.patch create mode 100644 meta-agl-flutter/recipes-graphics/flutter-engine/flutter-engine_%.bbappend create mode 100644 meta-agl-flutter/recipes-graphics/flutter-engine/flutter-engine_aglflutter.inc create mode 100644 meta-agl-flutter/recipes-graphics/flutter-sdk/flutter-sdk_%.bbappend rename meta-agl-flutter/recipes-graphics/flutter-sdk/{flutter-sdk_git.bbappend => flutter-sdk_aglflutter.inc} (100%) delete mode 100644 meta-agl-flutter/recipes-platform/images/agl-image-flutter-runtimeprofile.bb delete mode 100644 meta-agl-flutter/recipes-platform/images/agl-image-flutter-runtimerelease.bb rename meta-agl-flutter/recipes-platform/images/{agl-image-flutter-runtimedebug.bb => agl-image-flutter.bb} (58%) create mode 100644 meta-agl-flutter/tools/.gitignore create mode 100644 meta-agl-flutter/tools/configs/_globals.json create mode 100644 meta-agl-flutter/tools/configs/_repos.json create mode 100644 meta-agl-flutter/tools/configs/agl-qemu-master.json create mode 100644 meta-agl-flutter/tools/configs/agl-qemu-octopus.json create mode 100644 meta-agl-flutter/tools/configs/desktop-auto.json create mode 120000 meta-agl-flutter/tools/flutter_workspace.py delete mode 100644 meta-agl-flutter/tools/flutter_workspace_config.json diff --git a/meta-agl-flutter/README.md b/meta-agl-flutter/README.md index 86b4f75b..84bbf260 100644 --- a/meta-agl-flutter/README.md +++ b/meta-agl-flutter/README.md @@ -1,19 +1,17 @@ # meta-agl-flutter -_This documentation is expecting user to be running Ubuntu 20.04_ - -## Steps to build `agl-ivi-demo-platform-flutter` image +## Steps to build `agl-demo-platform` image ``` export AGL_TOP=$HOME/workspace_agl mkdir -p $AGL_TOP && cd $AGL_TOP repo init -u https://gerrit.automotivelinux.org/gerrit/AGL/AGL-repo -b master repo sync -j $(nproc) - source meta-agl/scripts/aglsetup.sh -m qemux86-64 agl-demo - bitbake agl-ivi-demo-platform-flutter + source meta-agl/scripts/aglsetup.sh -m qemux86-64 agl-demo agl-flutter + bitbake agl-demo-platform ``` -This builds AGL demo image that includes Flutter runtime=release. +This builds AGL demo image that includes Flutter runtime={debug,profile,release}. ## Steps to build a minimal flutter image @@ -24,30 +22,17 @@ This builds AGL demo image that includes Flutter runtime=release. repo init -u https://gerrit.automotivelinux.org/gerrit/AGL/AGL-repo -b master repo sync -j `grep -c ^processor /proc/cpuinfo` source meta-agl/scripts/aglsetup.sh -m qemux86-64 agl-devel agl-flutter + bitbake agl-image-flutter ``` - -Build one of the minimal Flutter images below using `bitbake` - -1. `agl-image-flutter-runtimedebug` + * include Flutter engine runtime={debug,release,profile} * includes Flutter Engine SDK * includes SSH server - * live debugging with target via host - -2. `agl-image-flutter-runtimeprofile` - * includes Flutter Engine SDK - * includes SSH server - * runs only Flutter Applications built as AOT profile images - * live profiling with target via host - -3. `agl-image-flutter-runtimerelease` - * includes Flutter Engine SDK - * runs only Flutter Applications built as AOT release images - * Does not include SSH server + * live debugging/profiling with target via host ## Flutter Engine SDK -If recipe `flutter-engine-runtime-sdk-dev` is included in your AGL image, `engine_sdk.zip` will be present in `/usr/share/flutter/`. +If recipe `flutter-engine-sdk-dev` is included in your AGL image, `engine_sdk.zip` will be present in `/usr/share/flutter/`. engine_sdk.zip contains * sdk/flutter_sdk.version - The Flutter SDK version @@ -59,18 +44,20 @@ This recipe should be excluded from image in a production release. ## Flutter Workspace Automation -``` - mkdir -p && cd - curl --proto '=https' --tlsv1.2 -sSf https://gerrit.automotivelinux.org/gerrit/gitweb?p=AGL/meta-agl-devel.git;a=blob_plain;f=meta-agl-flutter/tools/flutter_workspace_config.json;hb=HEAD -o flutter_workspace_config.json - curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/meta-flutter/meta-flutter/kirkstone/tools/setup_flutter_workspace.py | python3 -``` + cd $AGL + cd $AGL_TOP + ln -sf external/workspace-automation/flutter_workspace.py meta-agl-devel/meta-agl-flutter/tools/flutter_workspace.py + cd meta-agl-devel/meta-agl-flutter/tools + export FLUTTER_WORKSPACE=`pwd` + flutter_workspace.py + source setup_env.sh Additional documentation available [here](https://github.com/meta-flutter/meta-flutter/tree/kirkstone/tools#flutter-workspace-automation) ## Startup Service -If you include `flutter-gallery-runtime-init` it will install a systemd user service, which starts the Flutter Gallery on boot. This is not included in the minimal images. +If you include `flutter-gallery-init` it will install a systemd user service, which starts the Flutter Gallery on boot. This is not included in the minimal images. At runtime you can edit `/usr/share/flutter/default.json` to point to any Flutter bundle. @@ -133,63 +120,56 @@ _Answering with `y` appends QEMU connection to `~/.ssh/known_hosts`_ ``` -### Release +### Working with QEMU images -1. Change AGL-qemu flutter_runtime value in $AGL_TOP/sources/meta-agl-devel/meta-agl-flutter/tools/flutter_workspace_config.json to `release`. +1. Setup the flutter workspace. -``` - { - "id": "AGL-qemu", - "type": "qemu", - "arch": "x86_64", - "flutter_runtime": "release", - "runtime": { -``` + source ${FLUTTER_WORKSPACE}/setup_env.sh -This enables download of QEMU `release` variant. +The stdout tail should look similar to: -2. Run the flutter workspace script + ******************************************** + * Type 'run-agl-qemu-master' to start + ******************************************** + ******************************************** + * Type 'run-agl-qemu-octopus' to start + ******************************************** -3. Run the following commands on the host's terminal, a QEMU window and a new terminal for AGL will be brought up. +3. Select image to run using one of above commands. ``` - cd $FLUTTER_WORKSPACE - unset QEMU_IMAGE - source ./setup_env.sh - qemu_run + run-agl-qemu-octopus ``` -4. Login AGL as `root`, and execute `passwd -d agl-driver`. Type `exit` and login as `agl-driver`. Run the Flutter Gallery example with the command in AGL's terminal. +4. If running an updated QEMU image, edit `~/.ssh/known_hosts` and remove previous connection. + +5. Login AGL as `root`, and execute `passwd -d agl-driver`. Type `exit` and login as `agl-driver`. Run the Flutter Gallery example with the command in AGL's terminal. ``` - flutter-auto --window-type="BG" --b=/usr/share/flutter/gallery --f + cd $FLUTTER_WORKSPACE/app/gallery + flutter run -d agl-qemu-octopus ``` ### Profile -1. Change AGL-qemu flutter_runtime value in $AGL_TOP/sources/meta-agl-devel/meta-agl-flutter/tools/flutter_workspace_config.json to `profile`. +1. Setup the flutter workspace. -``` - { - "id": "AGL-qemu", - "type": "qemu", - "arch": "x86_64", - "flutter_runtime": "profile", - "runtime": { -``` + source ${FLUTTER_WORKSPACE}/setup_env.sh -This enables download of QEMU `profile` variant. +The stdout tail should look similar to: -2. Run the flutter workspace script + ******************************************** + * Type 'run-agl-qemu-master' to start + ******************************************** + ******************************************** + * Type 'run-agl-qemu-octopus' to start + ******************************************** -3. Run the following commands on the host's terminal, a QEMU window and a new terminal for AGL will be brought up. +3. Select image to run using one of above commands. ``` - cd $FLUTTER_WORKSPACE - unset QEMU_IMAGE - source ./setup_env.sh - qemu_run + run-agl-qemu-octopus ``` 4. If running an updated QEMU image, edit `~/.ssh/known_hosts` and remove previous connection. @@ -202,7 +182,7 @@ Answering with `y` appends QEMU connection to `~/.ssh/known_hosts` 6. Login AGL as `agl-driver`, and issue the following command ``` - flutter-auto --window-type="BG" --b=/usr/share/flutter/gallery --f --observatory-host=0.0.0.0 --observatory-port=1234 + flutter-auto --window-type="BG" --b=/usr/share/flutter/gallery/3.3.7/profile --f --observatory-host=0.0.0.0 --observatory-port=1234 ``` The last line of the output message should look similar to this: diff --git a/meta-agl-flutter/conf/include/agl-flutter.inc b/meta-agl-flutter/conf/include/agl-flutter.inc index 7d6fce6d..d0d36e6d 100644 --- a/meta-agl-flutter/conf/include/agl-flutter.inc +++ b/meta-agl-flutter/conf/include/agl-flutter.inc @@ -1,5 +1,3 @@ AGL_FEATURES += "agl-flutter" -######################################### -# FLUTTER_SDK_TAG is now Pinned upstream -######################################### +FLUTTER_SDK_TAG = "3.3.7" diff --git a/meta-agl-flutter/recipes-graphics/flutter-engine/files/0001-clang-toolchain.patch b/meta-agl-flutter/recipes-graphics/flutter-engine/files/0001-clang-toolchain.patch new file mode 100644 index 00000000..8553a3a5 --- /dev/null +++ b/meta-agl-flutter/recipes-graphics/flutter-engine/files/0001-clang-toolchain.patch @@ -0,0 +1,44 @@ +From 2ee90379fbfa4bda0274f691c2c832621c2333df Mon Sep 17 00:00:00 2001 +From: Joel Winarske +Date: Fri, 19 Feb 2021 22:15:24 +0000 +Subject: [PATCH 1/2] clang toolchain + +--- + build/toolchain/custom/BUILD.gn | 11 +++++------ + 1 file changed, 5 insertions(+), 6 deletions(-) + +diff --git a/build/toolchain/custom/BUILD.gn b/build/toolchain/custom/BUILD.gn +index 65b1623..8b3f6f8 100644 +--- a/build/toolchain/custom/BUILD.gn ++++ b/build/toolchain/custom/BUILD.gn +@@ -12,11 +12,11 @@ toolchain("custom") { + # these values in our scope. + cc = "${toolchain_bin}/clang" + cxx = "${toolchain_bin}/clang++" +- ar = "${toolchain_bin}/${custom_target_triple}-ar" ++ ar = "${toolchain_bin}/llvm-ar" + ld = "${toolchain_bin}/clang++" +- readelf = "${toolchain_bin}/${custom_target_triple}-readelf" +- nm = "${toolchain_bin}/${custom_target_triple}-nm" +- strip = "${toolchain_bin}/${custom_target_triple}-strip" ++ readelf = "${toolchain_bin}/llvm-readelf" ++ nm = "${toolchain_bin}/llvm-nm" ++ strip = "${toolchain_bin}/llvm-strip" + + target_triple_flags = "--target=${custom_target_triple}" + sysroot_flags = "--sysroot ${custom_sysroot}" +@@ -84,10 +84,9 @@ toolchain("custom") { + link_command = "$ld $target_triple_flags $sysroot_flags -shared {{ldflags}} -o $unstripped_sofile $custom_lib_flags -Wl,--build-id=sha1 -Wl,-soname=$soname @$rspfile" + toc_command = "{ $readelf -d $unstripped_sofile | grep SONAME ; $nm -gD -f posix $unstripped_sofile | cut -f1-2 -d' '; } > $temporary_tocname" + replace_command = "if ! cmp -s $temporary_tocname $tocfile; then mv $temporary_tocname $tocfile; fi" +- strip_command = "$strip -o $sofile $unstripped_sofile" + + command = +- "$link_command && $toc_command && $replace_command && $strip_command" ++ "$link_command && $toc_command && $replace_command" + rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole-archive {{libs}}" + + description = "SOLINK $sofile" +-- +2.29.2 + diff --git a/meta-agl-flutter/recipes-graphics/flutter-engine/files/0002-x64-sysroot-assert.patch b/meta-agl-flutter/recipes-graphics/flutter-engine/files/0002-x64-sysroot-assert.patch new file mode 100644 index 00000000..6265b2f3 --- /dev/null +++ b/meta-agl-flutter/recipes-graphics/flutter-engine/files/0002-x64-sysroot-assert.patch @@ -0,0 +1,25 @@ +From 528c1f2f05a5eae710905547140f4a4f465d7d88 Mon Sep 17 00:00:00 2001 +From: Joel Winarske +Date: Fri, 19 Feb 2021 22:16:00 +0000 +Subject: [PATCH 2/2] x64 sysroot assert + +--- + build/config/sysroot.gni | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/build/config/sysroot.gni b/build/config/sysroot.gni +index 12187df..2eb385c 100644 +--- a/build/config/sysroot.gni ++++ b/build/config/sysroot.gni +@@ -14,7 +14,7 @@ declare_args() { + + # Whether to use the default sysroot when building for Linux, if an explicit + # sysroot isn't set. +- use_default_linux_sysroot = true ++ use_default_linux_sysroot = false + + # The absolute path to the Xcode toolchain. This is used to look for headers + # that usually ship with the toolchain like c++/v1. +-- +2.29.2 + diff --git a/meta-agl-flutter/recipes-graphics/flutter-engine/files/0003-remove-x11-dependency.patch b/meta-agl-flutter/recipes-graphics/flutter-engine/files/0003-remove-x11-dependency.patch new file mode 100644 index 00000000..f6ede795 --- /dev/null +++ b/meta-agl-flutter/recipes-graphics/flutter-engine/files/0003-remove-x11-dependency.patch @@ -0,0 +1,29 @@ + +From dbe21e0e1ceb41da5a99f97937f2f6dd03f7e2e4 Mon Sep 17 00:00:00 2001 +From: Joel Winarske +Date: Sun, 29 May 2022 09:38:46 -0700 +Subject: [PATCH] Remove x11 dependency + +Signed-off-by: Joel Winarske +--- + flutter/shell/platform/linux/config/BUILD.gn | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/flutter/shell/platform/linux/config/BUILD.gn b/flutter/shell/platform/linux/config/BUILD.gn +index da0ac056bc..70c7a0ea16 100644 +--- a/flutter/shell/platform/linux/config/BUILD.gn ++++ b/flutter/shell/platform/linux/config/BUILD.gn +@@ -5,10 +5,6 @@ + import("//build/config/linux/pkg_config.gni") + import("//flutter/shell/platform/glfw/config.gni") + +-pkg_config("x11") { +- packages = [ "x11" ] +-} +- + pkg_config("gtk") { + packages = [ "gtk+-3.0" ] + } +-- +2.34.3 + diff --git a/meta-agl-flutter/recipes-graphics/flutter-engine/files/0004-prevent-redefinition-of-glib_autoptr_clear_AtkObject.patch b/meta-agl-flutter/recipes-graphics/flutter-engine/files/0004-prevent-redefinition-of-glib_autoptr_clear_AtkObject.patch new file mode 100644 index 00000000..2e1dcbdf --- /dev/null +++ b/meta-agl-flutter/recipes-graphics/flutter-engine/files/0004-prevent-redefinition-of-glib_autoptr_clear_AtkObject.patch @@ -0,0 +1,36 @@ +From 1a4f274b071a1486204470392d2427069533f8ca Mon Sep 17 00:00:00 2001 +From: Joel Winarske +Date: Thu, 8 Sep 2022 16:15:06 -0700 +Subject: [PATCH] prevent redefinition of glib_autoptr_clear_AtkObject + +Signed-off-by: Joel Winarske +--- + flutter/shell/platform/linux/fl_accessible_node.h | 7 ++----- + 1 file changed, 2 insertions(+), 5 deletions(-) + +diff --git a/flutter/shell/platform/linux/fl_accessible_node.h b/flutter/shell/platform/linux/fl_accessible_node.h +index ff38ad49c6..190cb982a1 100644 +--- a/flutter/shell/platform/linux/fl_accessible_node.h ++++ b/flutter/shell/platform/linux/fl_accessible_node.h +@@ -5,17 +5,14 @@ + #ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_ACCESSIBLE_NODE_H_ + #define FLUTTER_SHELL_PLATFORM_LINUX_FL_ACCESSIBLE_NODE_H_ + +-#include ++#include ++#include + + #include "flutter/shell/platform/embedder/embedder.h" + #include "flutter/shell/platform/linux/public/flutter_linux/fl_engine.h" + + G_BEGIN_DECLS + +-// ATK doesn't have the g_autoptr macros, so add them manually. +-// https://gitlab.gnome.org/GNOME/atk/-/issues/10 +-G_DEFINE_AUTOPTR_CLEANUP_FUNC(AtkObject, g_object_unref) +- + #define FL_TYPE_ACCESSIBLE_NODE fl_accessible_node_get_type() + G_DECLARE_DERIVABLE_TYPE(FlAccessibleNode, + fl_accessible_node, +-- +2.34.3 diff --git a/meta-agl-flutter/recipes-graphics/flutter-engine/flutter-engine_%.bbappend b/meta-agl-flutter/recipes-graphics/flutter-engine/flutter-engine_%.bbappend new file mode 100644 index 00000000..56660ab6 --- /dev/null +++ b/meta-agl-flutter/recipes-graphics/flutter-engine/flutter-engine_%.bbappend @@ -0,0 +1 @@ +require ${@bb.utils.contains('AGL_FEATURES', 'agl-flutter', 'flutter-engine_aglflutter.inc', '', d)} diff --git a/meta-agl-flutter/recipes-graphics/flutter-engine/flutter-engine_aglflutter.inc b/meta-agl-flutter/recipes-graphics/flutter-engine/flutter-engine_aglflutter.inc new file mode 100644 index 00000000..3c66fb2e --- /dev/null +++ b/meta-agl-flutter/recipes-graphics/flutter-engine/flutter-engine_aglflutter.inc @@ -0,0 +1,11 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +# +# Patch set for 3.3.7 Engine +# +FLUTTER_ENGINE_PATCHES = "\ + file://0001-clang-toolchain.patch \ + file://0002-x64-sysroot-assert.patch \ + file://0003-remove-x11-dependency.patch \ + file://0004-prevent-redefinition-of-glib_autoptr_clear_AtkObject.patch \ + " diff --git a/meta-agl-flutter/recipes-graphics/flutter-sdk/flutter-sdk_%.bbappend b/meta-agl-flutter/recipes-graphics/flutter-sdk/flutter-sdk_%.bbappend new file mode 100644 index 00000000..f983e7e9 --- /dev/null +++ b/meta-agl-flutter/recipes-graphics/flutter-sdk/flutter-sdk_%.bbappend @@ -0,0 +1 @@ +require ${@bb.utils.contains('AGL_FEATURES', 'agl-flutter', 'flutter-sdk_aglflutter.inc', '', d)} diff --git a/meta-agl-flutter/recipes-graphics/flutter-sdk/flutter-sdk_git.bbappend b/meta-agl-flutter/recipes-graphics/flutter-sdk/flutter-sdk_aglflutter.inc similarity index 100% rename from meta-agl-flutter/recipes-graphics/flutter-sdk/flutter-sdk_git.bbappend rename to meta-agl-flutter/recipes-graphics/flutter-sdk/flutter-sdk_aglflutter.inc diff --git a/meta-agl-flutter/recipes-graphics/toyota/files/0001-Add-optional-agl_shell-plugin.patch b/meta-agl-flutter/recipes-graphics/toyota/files/0001-Add-optional-agl_shell-plugin.patch index b5ab653e..79fac9e3 100644 --- a/meta-agl-flutter/recipes-graphics/toyota/files/0001-Add-optional-agl_shell-plugin.patch +++ b/meta-agl-flutter/recipes-graphics/toyota/files/0001-Add-optional-agl_shell-plugin.patch @@ -1,6 +1,6 @@ -From 278945f12726692bc8b148ea1a59697a1c01405a Mon Sep 17 00:00:00 2001 +From 164756be1d20b555f43e2eb3160da3efa7d38865 Mon Sep 17 00:00:00 2001 From: Scott Murray -Date: Mon, 14 Nov 2022 17:58:12 -0500 +Date: Thu, 1 Jun 2023 14:34:03 -0400 Subject: [PATCH] Add optional agl_shell plugin Add an optional agl_shell static plugin to expose the activate_app @@ -10,7 +10,10 @@ application to activate other application surfaces to switch between multiple applications as is needed for the AGL demo. Upstream-Status: Pending + Signed-off-by: Scott Murray +[Updated to work with upstream OSS 0223 release] +Signed-off-by: Marius Vlad --- cmake/plugins.cmake | 5 ++ shell/engine.cc | 6 ++ @@ -18,21 +21,21 @@ Signed-off-by: Scott Murray shell/platform_channel.cc | 6 ++ shell/static_plugins/agl_shell/agl_shell.cc | 77 +++++++++++++++++++++ shell/static_plugins/agl_shell/agl_shell.h | 31 +++++++++ - shell/wayland/display.cc | 8 +++ - shell/wayland/display.h | 3 + + shell/wayland/display.cc | 7 ++ + shell/wayland/display.h | 8 +++ shell/wayland/window.h | 2 + - 9 files changed, 148 insertions(+) + 9 files changed, 152 insertions(+) create mode 100644 shell/static_plugins/agl_shell/agl_shell.cc create mode 100644 shell/static_plugins/agl_shell/agl_shell.h diff --git a/cmake/plugins.cmake b/cmake/plugins.cmake -index 6bdc75b..a599f95 100644 +index b720dca..20a55d7 100644 --- a/cmake/plugins.cmake +++ b/cmake/plugins.cmake -@@ -101,4 +101,9 @@ if (BUILD_PLUGIN_SECURE_STORAGE) - pkg_check_modules(PLUGIN_SECURE_STORAGE REQUIRED libsecret-1) +@@ -123,4 +123,9 @@ if (BUILD_PLUGIN_SECURE_STORAGE) endif () + +option(BUILD_PLUGIN_AGL_SHELL "Includes AGL Shell Wayland Protocol Plugin" OFF) +if (BUILD_PLUGIN_AGL_SHELL) + ENABLE_PLUGIN(agl_shell) @@ -40,12 +43,12 @@ index 6bdc75b..a599f95 100644 + message(STATUS "Plugin Config .......... ${PLUGINS}") diff --git a/shell/engine.cc b/shell/engine.cc -index ad0c83c..9ce346d 100644 +index d20b6ba..a0e38e9 100644 --- a/shell/engine.cc +++ b/shell/engine.cc -@@ -595,3 +595,9 @@ MAYBE_UNUSED TextInput* Engine::GetTextInput() const { +@@ -614,3 +614,9 @@ MAYBE_UNUSED TextInput* Engine::GetTextInput() const { + return m_key_event; } - #endif + +#if ENABLE_PLUGIN_AGL_SHELL @@ -54,10 +57,10 @@ index ad0c83c..9ce346d 100644 +} +#endif diff --git a/shell/engine.h b/shell/engine.h -index 501ba4b..4193e7e 100644 +index 94808dc..3a06f51 100644 --- a/shell/engine.h +++ b/shell/engine.h -@@ -50,6 +50,12 @@ class TextInput; +@@ -60,6 +60,12 @@ class KeyEvent; #endif @@ -69,23 +72,23 @@ index 501ba4b..4193e7e 100644 + class Engine { public: - Engine(FlutterView* view, -@@ -146,6 +152,10 @@ class Engine { - + /** +@@ -445,6 +451,10 @@ class Engine { + MAYBE_UNUSED NODISCARD KeyEvent* GetKeyEvent() const; #endif +#if ENABLE_PLUGIN_AGL_SHELL + std::shared_ptr GetDisplay() const; +#endif + - Backend* GetBackend() { - return m_backend; - } + /** + * @brief Get backend of view + * @return Backend* diff --git a/shell/platform_channel.cc b/shell/platform_channel.cc -index 10f4715..2c7ab8c 100644 +index b72156a..81d7cb5 100644 --- a/shell/platform_channel.cc +++ b/shell/platform_channel.cc -@@ -53,6 +53,9 @@ +@@ -62,6 +62,9 @@ #ifdef ENABLE_PLUGIN_SECURE_STORAGE #include "static_plugins/secure_storage/secure_storage.h" #endif @@ -95,7 +98,7 @@ index 10f4715..2c7ab8c 100644 PlatformChannel* PlatformChannel::singleton = nullptr; -@@ -101,4 +104,7 @@ PlatformChannel::PlatformChannel() { +@@ -122,4 +125,7 @@ PlatformChannel::PlatformChannel() { RegisterCallback(SecureStorage::kChannelName, &SecureStorage::OnPlatformMessage); #endif @@ -105,7 +108,7 @@ index 10f4715..2c7ab8c 100644 } diff --git a/shell/static_plugins/agl_shell/agl_shell.cc b/shell/static_plugins/agl_shell/agl_shell.cc new file mode 100644 -index 0000000..81627b6 +index 0000000..e6160a5 --- /dev/null +++ b/shell/static_plugins/agl_shell/agl_shell.cc @@ -0,0 +1,77 @@ @@ -135,7 +138,7 @@ index 0000000..81627b6 +#include + +void AglShell::OnPlatformMessage(const FlutterPlatformMessage* message, -+ void* userdata) { ++ void* userdata) { + std::unique_ptr> result; + auto engine = reinterpret_cast(userdata); + auto& codec = flutter::StandardMethodCodec::GetInstance(); @@ -182,13 +185,13 @@ index 0000000..81627b6 + result = codec.EncodeErrorEnvelope("unhandled_method", "Unhandled Method"); + } + -+ done: ++done: + engine->SendPlatformMessageResponse(message->response_handle, result->data(), + result->size()); +} diff --git a/shell/static_plugins/agl_shell/agl_shell.h b/shell/static_plugins/agl_shell/agl_shell.h new file mode 100644 -index 0000000..747eb36 +index 0000000..698e44c --- /dev/null +++ b/shell/static_plugins/agl_shell/agl_shell.h @@ -0,0 +1,31 @@ @@ -211,7 +214,7 @@ index 0000000..747eb36 + +#pragma once + -+#include ++#include + +class AglShell { + public: @@ -224,51 +227,55 @@ index 0000000..747eb36 + static constexpr char kMethodActivateApp[] = "activate_app"; +}; diff --git a/shell/wayland/display.cc b/shell/wayland/display.cc -index 5d78471..48262c3 100644 +index 9351fb9..583d8ba 100644 --- a/shell/wayland/display.cc +++ b/shell/wayland/display.cc -@@ -697,6 +697,14 @@ void Display::AglShellDoPanel(struct wl_surface* surface, +@@ -845,6 +845,13 @@ void Display::AglShellDoReady() const { } } -+void Display::AglShellDoActivate(const std::string& app_id, -+ size_t index) { -+ if (m_agl_shell) { -+ agl_shell_activate_app(m_agl_shell, app_id.c_str(), ++void Display::AglShellDoActivate(const std::string& app_id, size_t index) { ++ if (m_agl.shell) { ++ agl_shell_activate_app(m_agl.shell, app_id.c_str(), + m_all_outputs[index]->output); + } +} + - void Display::AglShellDoReady() { - if (m_agl_shell) { - agl_shell_ready(m_agl_shell); + void Display::SetEngine(wl_surface* surface, Engine* engine) { + m_active_engine = engine; + m_active_surface = surface; diff --git a/shell/wayland/display.h b/shell/wayland/display.h -index bf05b27..c628c8c 100644 +index daeefea..3efdc9c 100644 --- a/shell/wayland/display.h +++ b/shell/wayland/display.h -@@ -82,6 +82,9 @@ class Display { - enum agl_shell_edge mode, - size_t index); +@@ -150,6 +150,14 @@ class Display { + */ + void AglShellDoReady() const; -+ void AglShellDoActivate(const std::string& app_id, -+ size_t index); ++ /** ++ * @brief AglShellDoActivate: ++ * @return void ++ * @relation ++ * wayland, agl-shell ++ */ ++ void AglShellDoActivate(const std::string& app_id, size_t index); + - void AglShellDoReady(); - - void SetEngine(wl_surface* surface, Engine* engine); + /** + * @brief Set Engine + * @param[in] surface Image diff --git a/shell/wayland/window.h b/shell/wayland/window.h -index 4b5c726..b4d0be3 100644 +index c0f2abc..da9cf45 100644 --- a/shell/wayland/window.h +++ b/shell/wayland/window.h -@@ -81,6 +81,8 @@ class WaylandWindow { - uint32_t m_fps_counter; - static window_type get_window_type(const std::string& type); +@@ -127,6 +127,8 @@ class WaylandWindow { + return std::pair{m_geometry.width, m_geometry.height}; + } + std::shared_ptr GetDisplay() { return m_display; } + private: - struct shm_buffer { - struct wl_buffer* buffer; + size_t m_index; + std::shared_ptr m_display; -- -2.38.1 +2.40.1 diff --git a/meta-agl-flutter/recipes-platform/images/agl-image-flutter-runtimeprofile.bb b/meta-agl-flutter/recipes-platform/images/agl-image-flutter-runtimeprofile.bb deleted file mode 100644 index 8b819922..00000000 --- a/meta-agl-flutter/recipes-platform/images/agl-image-flutter-runtimeprofile.bb +++ /dev/null @@ -1,26 +0,0 @@ -SUMMARY = "Baseline Flutter Image for Profiling" - -LICENSE = "MIT" - -require agl-image-flutter.inc - -IMAGE_INSTALL:append = "\ - weston-ini-conf-landscape \ - \ - flutter-auto-runtimeprofile \ - \ - flutter-engine-runtimeprofile-sdk-dev \ - \ - flutter-gallery-runtimeprofile \ - flutter-test-animated-background-runtimeprofile \ - flutter-test-texture-egl-runtimeprofile \ - flutter-test-secure-storage-runtimeprofile \ - flutter-test-localization-runtimeprofile \ - \ - flutter-app-igalia-homescreen-runtimeprofile \ - flutter-app-pumped-fuel-ped-runtimeprofile \ - " - -IMAGE_FEATURES:append = "\ - ssh-server-openssh \ - " diff --git a/meta-agl-flutter/recipes-platform/images/agl-image-flutter-runtimerelease.bb b/meta-agl-flutter/recipes-platform/images/agl-image-flutter-runtimerelease.bb deleted file mode 100644 index ffc19e84..00000000 --- a/meta-agl-flutter/recipes-platform/images/agl-image-flutter-runtimerelease.bb +++ /dev/null @@ -1,22 +0,0 @@ -SUMMARY = "Baseline Flutter Image for Release" - -LICENSE = "MIT" - -require agl-image-flutter.inc - -IMAGE_INSTALL:append = "\ - weston-ini-conf-landscape \ - \ - flutter-auto-runtimerelease \ - \ - flutter-engine-runtimerelease-sdk-dev \ - \ - flutter-gallery-runtimerelease \ - flutter-test-animated-background-runtimerelease \ - flutter-test-texture-egl-runtimerelease \ - flutter-test-secure-storage-runtimerelease \ - flutter-test-localization-runtimerelease \ - \ - flutter-app-igalia-homescreen-runtimerelease \ - flutter-app-pumped-fuel-ped-runtimerelease \ - " diff --git a/meta-agl-flutter/recipes-platform/images/agl-image-flutter-runtimedebug.bb b/meta-agl-flutter/recipes-platform/images/agl-image-flutter.bb similarity index 58% rename from meta-agl-flutter/recipes-platform/images/agl-image-flutter-runtimedebug.bb rename to meta-agl-flutter/recipes-platform/images/agl-image-flutter.bb index b9260bf3..37b0f4e6 100644 --- a/meta-agl-flutter/recipes-platform/images/agl-image-flutter-runtimedebug.bb +++ b/meta-agl-flutter/recipes-platform/images/agl-image-flutter.bb @@ -7,9 +7,14 @@ require agl-image-flutter.inc IMAGE_INSTALL:append = "\ weston-ini-conf-landscape \ \ - flutter-auto-runtimedebug \ + flutter-auto-with-logging \ + \ + flutter-engine-sdk-dev \ + \ + flutter-gallery \ + flutter-test-animated-background \ + flutter-test-texture-egl \ \ - flutter-engine-runtimedebug-sdk-dev \ " IMAGE_FEATURES:append = "\ diff --git a/meta-agl-flutter/tools/.gitignore b/meta-agl-flutter/tools/.gitignore new file mode 100644 index 00000000..abda9b65 --- /dev/null +++ b/meta-agl-flutter/tools/.gitignore @@ -0,0 +1,151 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +pip-wheel-metadata/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# IDEA +.idea + +# Flutter Workspace generated +.agl +.config +.flutter-auto +.pub_cache +.tmp +.vscode +setup_env.sh +flutter +app +flutter_*.log +qemu_run.scpt + +dart-revision.json +engine-revision.json + +*.scpt + diff --git a/meta-agl-flutter/tools/configs/_globals.json b/meta-agl-flutter/tools/configs/_globals.json new file mode 100644 index 00000000..1800c6bf --- /dev/null +++ b/meta-agl-flutter/tools/configs/_globals.json @@ -0,0 +1,5 @@ +{ + "flutter-version": "3.3.7", + "github_token": "", + "cookie_file": "" +} \ No newline at end of file diff --git a/meta-agl-flutter/tools/configs/_repos.json b/meta-agl-flutter/tools/configs/_repos.json new file mode 100644 index 00000000..d1d42d42 --- /dev/null +++ b/meta-agl-flutter/tools/configs/_repos.json @@ -0,0 +1,48 @@ +[ + { + "uri": "https://github.com/toyota-connected/ivi-homescreen.git", + "branch": "agl" + }, + { + "uri": "https://github.com/flutter/packages.git", + "branch": "main" + }, + { + "uri": "https://github.com/gskinnerTeam/flutter-wonderous-app.git", + "branch": "main", + "pubspec_path": "flutter-wonderous-app" + }, + { + "uri": "https://github.com/flutter/pinball.git", + "branch": "main", + "pubspec_path": "pinball" + }, + { + "uri": "https://github.com/flutter/gallery.git", + "branch": "master", + "rev": "9eb785cb997ff56c46e933c1c591f0a6f31454f6", + "pubspec_path": "gallery" + }, + { + "uri": "https://github.com/mogol/flutter_secure_storage.git", + "branch": "develop", + "pubspec_path": "flutter_secure_storage/flutter_secure_storage/example" + }, + { + "uri": "https://github.com/meta-flutter/flutter_animated_background.git", + "branch": "meta-flutter", + "rev": "46f35ad2a323ab006813a3c4748163536b0fc332", + "pubspec_path": "flutter_animated_background/example" + }, + { + "uri": "https://github.com/felipeerias/flutter_homescreen.git", + "branch": "main", + "rev": "08bf271f7f1f14153a41005718a2090fa8e783f0", + "pubspec_path": "flutter_homescreen" + }, + { + "uri": "https://github.com/bernardpumped/ped.git", + "branch": "agl", + "pubspec_path": "ped" + } +] diff --git a/meta-agl-flutter/tools/configs/agl-qemu-master.json b/meta-agl-flutter/tools/configs/agl-qemu-master.json new file mode 100644 index 00000000..eba953f7 --- /dev/null +++ b/meta-agl-flutter/tools/configs/agl-qemu-master.json @@ -0,0 +1,114 @@ +{ + "id": "agl-qemu-master", + "load": true, + "supported_archs": [ + "x86_64", + "arm64" + ], + "supported_host_types": [ + "darwin", + "ubuntu", + "fedora" + ], + "flutter_runtime": "debug", + "type": "qemu", + "env": { + "RELEASE_NAME": "master", + "RELEASE_VERSION": "latest", + "FLUTTER_DEBUG_PORT": "1234", + "FLUTTER_OBSERVATORY_HOST": "0.0.0.0", + "CONTAINER_SSH_PORT": "2222", + "DEVICE_HOSTNAME": "localhost", + "FLUTTER_AUTO_EXE": "flutter-auto --j=/tmp/${appName}/default_config.json --b=/tmp/${appName}", + "PING_CMD": "(echo >/dev/tcp/localhost/${CONTAINER_SSH_PORT}) &>/dev/null && echo open || echo closed", + "DELETE_USER_PWD": "ssh -p ${CONTAINER_SSH_PORT} -t -oBatchMode=yes root@${DEVICE_HOSTNAME} passwd -d agl-driver", + "CREATE_BUNDLE_FOLDER": "ssh -p ${CONTAINER_SSH_PORT} -o BatchMode=yes agl-driver@${DEVICE_HOSTNAME} mkdir -p /tmp/${appName}/data", + "COPY_PLATFORM_ID_TO_DEVICE": "scp -P ${CONTAINER_SSH_PORT} -r ${PLATFORM_ID_DIR}/default_config.json agl-driver@${DEVICE_HOSTNAME}:/tmp/${appName}/", + "COPY_ASSETS_TO_DEVICE": "scp -P ${CONTAINER_SSH_PORT} -r ${localPath}/* agl-driver@${DEVICE_HOSTNAME}:/tmp/${appName}/data/flutter_assets", + "DELETE_APP_FOLDER": "ssh -p ${CONTAINER_SSH_PORT} -o BatchMode=yes agl-driver@${DEVICE_HOSTNAME} rm -rf /tmp/${appName}" + }, + "runtime": { + "config": { + "view": [ + { + "window_type": "BG", + "width": 1920, + "height": 1080 + } + ] + }, + "pre-requisites": { + "arm64": { + "darwin": { + "cmds": [ + "bash -c \"arch -arm64 brew install xz\"", + "bash -c \"arch -arm64 brew install qemu\"" + ] + } + } + }, + "artifacts": { + "http": { + "url": "https://download.automotivelinux.org/AGL/snapshots/${RELEASE_NAME}/${RELEASE_VERSION}", + "artifacts": { + "x86_64": [ + { + "endpoint": "/qemux86-64/deploy/images/qemux86-64/agl-ivi-demo-platform-flutter-qemux86-64.wic.vmdk.xz" + } + ], + "arm64": [ + { + "endpoint": "/qemuarm64/deploy/images/qemuarm64/agl-demo-platform-crosssdk-qemuarm64.ext4.xz" + }, + { + "endpoint": "/qemuarm64/deploy/images/qemuarm64/Image-qemuarm64.bin" + } + ] + } + } + }, + "qemu": { + "cmd": "qemu-system-${FORMAL_MACHINE_ARCH}", + "x86_64": { + "image": "agl-ivi-demo-platform-flutter-qemux86-64.wic.vmdk", + "args": "-m 2048 ${QEMU_EXTRA} -hda ${QEMU_IMAGE} -cpu kvm64 -cpu qemu64,+ssse3,+sse4.1,+sse4.2,+popcnt -vga virtio -device virtio-rng-pci -serial mon:stdio -serial null -device intel-hda -device hda-duplex -device virtio-net-pci,netdev=net0,mac=${RANDOM_MAC} -netdev user,id=net0,hostfwd=tcp::${CONTAINER_SSH_PORT}-:22,hostfwd=tcp::${FLUTTER_DEBUG_PORT}-:${FLUTTER_DEBUG_PORT}" + }, + "arm64": { + "kernel": "Image-qemuarm64.bin", + "image": "agl-demo-platform-crosssdk-qemuarm64.ext4", + "args": "-accel hvf -cpu host -M virt ${QEMU_EXTRA} -m 4096 -device virtio-gpu-pci -nographic -display cocoa,show-cursor=on -object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0 -device qemu-xhci -device usb-tablet -device usb-mouse -device usb-kbd -device virtio-net-pci,netdev=vnet -netdev user,id=vnet,hostfwd=tcp::${CONTAINER_SSH_PORT}-:22,hostfwd=tcp::${FLUTTER_DEBUG_PORT}-:${FLUTTER_DEBUG_PORT} -kernel ${QEMU_KERNEL} -drive file=${QEMU_IMAGE},format=raw,if=virtio -append root=/dev/vda" + }, + "extra": { + "darwin": "-smp cpus=8,sockets=1,cores=8,threads=1", + "ubuntu": "-bios OVMF.fd", + "fedora": "-bios /usr/share/edk2/ovmf/OVMF_CODE.fd" + } + }, + "post_cmds": [ + { + "cwd": "${PLATFORM_ID_DIR}", + "cmds": [ + "bash -c \"rm ${QEMU_IMAGE}|true\"", + "unxz --keep ${QEMU_IMAGE}.xz" + ] + } + ] + }, + "overwrite-existing": true, + "custom-device": { + "id": "agl-qemu-${RELEASE_NAME}", + "label": "AGL ${RELEASE_NAME}-${RELEASE_VERSION} QEMU Image", + "sdkNameAndVersion": "qemu-${RELEASE_NAME} ${RELEASE_VERSION}", + "platform": "linux-x64", + "enabled": true, + "ping": "bash -c \"${PING_CMD}\"", + "pingSuccessRegex": "open", + "postBuild": "bash -c \"${DELETE_USER_PWD}\"", + "install": "bash -c \"${CREATE_BUNDLE_FOLDER} && ${COPY_PLATFORM_ID_TO_DEVICE} && ${COPY_ASSETS_TO_DEVICE}\"", + "uninstall": "bash -c \"${DELETE_APP_FOLDER}\"", + "runDebug": "bash -c \"ssh -t -t -o BatchMode=yes agl-driver@${DEVICE_HOSTNAME} ${FLUTTER_AUTO_EXE}\"", + "forwardPort": null, + "forwardPortSuccessRegex": null, + "screenshot": null + } +} \ No newline at end of file diff --git a/meta-agl-flutter/tools/configs/agl-qemu-octopus.json b/meta-agl-flutter/tools/configs/agl-qemu-octopus.json new file mode 100644 index 00000000..dba5a882 --- /dev/null +++ b/meta-agl-flutter/tools/configs/agl-qemu-octopus.json @@ -0,0 +1,114 @@ +{ + "id": "agl-qemu-octopus", + "load": true, + "supported_archs": [ + "x86_64", + "arm64" + ], + "supported_host_types": [ + "darwin", + "ubuntu", + "fedora" + ], + "flutter_runtime": "debug", + "type": "qemu", + "env": { + "RELEASE_NAME": "octopus", + "RELEASE_VERSION": "latest", + "FLUTTER_DEBUG_PORT": "1234", + "FLUTTER_OBSERVATORY_HOST": "0.0.0.0", + "CONTAINER_SSH_PORT": "2222", + "DEVICE_HOSTNAME": "localhost", + "FLUTTER_AUTO_EXE": "flutter-auto --j=/tmp/${appName}/default_config.json --b=/tmp/${appName}", + "PING_CMD": "(echo >/dev/tcp/localhost/${CONTAINER_SSH_PORT}) &>/dev/null && echo open || echo closed", + "DELETE_USER_PWD": "ssh -p ${CONTAINER_SSH_PORT} -t -oBatchMode=yes root@${DEVICE_HOSTNAME} passwd -d agl-driver", + "CREATE_BUNDLE_FOLDER": "ssh -p ${CONTAINER_SSH_PORT} -o BatchMode=yes agl-driver@${DEVICE_HOSTNAME} mkdir -p /tmp/${appName}/data", + "COPY_PLATFORM_ID_TO_DEVICE": "scp -P ${CONTAINER_SSH_PORT} -r ${PLATFORM_ID_DIR}/default_config.json agl-driver@${DEVICE_HOSTNAME}:/tmp/${appName}/", + "COPY_ASSETS_TO_DEVICE": "scp -P ${CONTAINER_SSH_PORT} -r ${localPath}/* agl-driver@${DEVICE_HOSTNAME}:/tmp/${appName}/data/flutter_assets", + "DELETE_APP_FOLDER": "ssh -p ${CONTAINER_SSH_PORT} -o BatchMode=yes agl-driver@${DEVICE_HOSTNAME} rm -rf /tmp/${appName}" + }, + "runtime": { + "config": { + "view": [ + { + "window_type": "BG", + "width": 1920, + "height": 1080 + } + ] + }, + "pre-requisites": { + "arm64": { + "darwin": { + "cmds": [ + "bash -c \"arch -arm64 brew install xz\"", + "bash -c \"arch -arm64 brew install qemu\"" + ] + } + } + }, + "artifacts": { + "http": { + "url": "https://download.automotivelinux.org/AGL/release/${RELEASE_NAME}/${RELEASE_VERSION}", + "artifacts": { + "x86_64": [ + { + "endpoint": "/qemux86-64/deploy/images/qemux86-64/agl-ivi-demo-platform-flutter-qemux86-64.wic.vmdk.xz" + } + ], + "arm64": [ + { + "endpoint": "/qemuarm64/deploy/images/qemuarm64/agl-demo-platform-crosssdk-qemuarm64.ext4.xz" + }, + { + "endpoint": "/qemuarm64/deploy/images/qemuarm64/Image-qemuarm64.bin" + } + ] + } + } + }, + "qemu": { + "cmd": "qemu-system-${FORMAL_MACHINE_ARCH}", + "x86_64": { + "image": "agl-ivi-demo-platform-flutter-qemux86-64.wic.vmdk", + "args": "-m 2048 ${QEMU_EXTRA} -hda ${QEMU_IMAGE} -cpu kvm64 -cpu qemu64,+ssse3,+sse4.1,+sse4.2,+popcnt -vga virtio -device virtio-rng-pci -serial mon:stdio -serial null -device intel-hda -device hda-duplex -device virtio-net-pci,netdev=net0,mac=${RANDOM_MAC} -netdev user,id=net0,hostfwd=tcp::${CONTAINER_SSH_PORT}-:22,hostfwd=tcp::${FLUTTER_DEBUG_PORT}-:${FLUTTER_DEBUG_PORT}" + }, + "arm64": { + "kernel": "Image-qemuarm64.bin", + "image": "agl-demo-platform-crosssdk-qemuarm64.ext4", + "args": "-accel hvf -cpu host -M virt ${QEMU_EXTRA} -m 4096 -device virtio-gpu-pci -nographic -display cocoa,show-cursor=on -object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0 -device qemu-xhci -device usb-tablet -device usb-mouse -device usb-kbd -device virtio-net-pci,netdev=vnet -netdev user,id=vnet,hostfwd=tcp::${CONTAINER_SSH_PORT}-:22,hostfwd=tcp::${FLUTTER_DEBUG_PORT}-:${FLUTTER_DEBUG_PORT} -kernel ${QEMU_KERNEL} -drive file=${QEMU_IMAGE},format=raw,if=virtio -append root=/dev/vda" + }, + "extra": { + "darwin": "-smp cpus=8,sockets=1,cores=8,threads=1", + "ubuntu": "-bios OVMF.fd", + "fedora": "-bios /usr/share/edk2/ovmf/OVMF_CODE.fd" + } + }, + "post_cmds": [ + { + "cwd": "${PLATFORM_ID_DIR}", + "cmds": [ + "bash -c \"rm ${QEMU_IMAGE}|true\"", + "unxz --keep ${QEMU_IMAGE}.xz" + ] + } + ] + }, + "overwrite-existing": true, + "custom-device": { + "id": "agl-qemu-${RELEASE_NAME}", + "label": "AGL ${RELEASE_NAME}-${RELEASE_VERSION} QEMU Image", + "sdkNameAndVersion": "qemu-${RELEASE_NAME} ${RELEASE_VERSION}", + "platform": "linux-x64", + "enabled": true, + "ping": "bash -c \"${PING_CMD}\"", + "pingSuccessRegex": "open", + "postBuild": "bash -c \"${DELETE_USER_PWD}\"", + "install": "bash -c \"${CREATE_BUNDLE_FOLDER} && ${COPY_PLATFORM_ID_TO_DEVICE} && ${COPY_ASSETS_TO_DEVICE}\"", + "uninstall": "bash -c \"${DELETE_APP_FOLDER}\"", + "runDebug": "bash -c \"ssh -t -t -o BatchMode=yes agl-driver@${DEVICE_HOSTNAME} ${FLUTTER_AUTO_EXE}\"", + "forwardPort": null, + "forwardPortSuccessRegex": null, + "screenshot": null + } +} \ No newline at end of file diff --git a/meta-agl-flutter/tools/configs/desktop-auto.json b/meta-agl-flutter/tools/configs/desktop-auto.json new file mode 100644 index 00000000..66cec712 --- /dev/null +++ b/meta-agl-flutter/tools/configs/desktop-auto.json @@ -0,0 +1,136 @@ +{ + "id": "desktop-auto", + "load": true, + "supported_archs": [ + "x86_64" + ], + "supported_host_types": [ + "ubuntu", + "fedora" + ], + "flutter_runtime": "debug", + "type": "host", + "env": { + "FLUTTER_AUTO_SRC_DIR": "${FLUTTER_WORKSPACE}/app/ivi-homescreen", + "FLUTTER_AUTO_BUILD_DIR": "${FLUTTER_WORKSPACE}/app/ivi-homescreen/build", + "FLUTTER_AUTO_CMAKE_ARGS": "-DCMAKE_BUILD_TYPE=Debug -DBUILD_PLUGIN_SECURE_STORAGE=ON", + "COMP_SURF_PBR_SRC_DIR": "${FLUTTER_WORKSPACE}/app/comp_surf_pbr", + "COMP_SURF_PBR_BUILD_DIR": "${FLUTTER_WORKSPACE}/app/comp_surf_pbr/build", + "COMP_SURF_PBR_CMAKE_ARGS": "-DCMAKE_BUILD_TYPE=Debug", + "FLUTTER_AUTO_EXE": "LD_LIBRARY_PATH=${COMP_SURF_PBR_BUILD_DIR} ${FLUTTER_AUTO_BUILD_DIR}/shell/flutter-auto --j=${PLATFORM_ID_DIR_RELATIVE}/default_config.json --b=${PLATFORM_ID_DIR_RELATIVE}", + "PING_CMD": "loginctl show-session $(awk '/tty/ {print $1}' <(loginctl)) -p Type", + "CREATE_BUNDLE_FOLDER": "mkdir -p ${PLATFORM_ID_DIR_RELATIVE}/data", + "COPY_PLATFORM_ID_TO_BUNDLE_FOLDER": "cp -r ${PLATFORM_ID_DIR}/default_config.json ${PLATFORM_ID_DIR_RELATIVE}/", + "COPY_BUNDLE_FOLDER_TO_PLATOFRM_ID": "cp -r ${BUNDLE_FOLDER}/* ${PLATFORM_ID_DIR_RELATIVE}/", + "CREATE_ASSET_SYMLINK": "ln -rsf build/flutter_assets ${PLATFORM_ID_DIR_RELATIVE}/data/flutter_assets", + "STAGE_BUNDLE_FOLDER": "${CREATE_BUNDLE_FOLDER} && ${COPY_PLATFORM_ID_TO_BUNDLE_FOLDER} && ${COPY_BUNDLE_FOLDER_TO_PLATOFRM_ID} && ${CREATE_ASSET_SYMLINK}" + }, + "runtime": { + "config": { + "view": [ + { + "width": 1920, + "height": 1080, + "cursor_theme": "DMZ-White", + "fullscreen": false + } + ] + }, + "pre-requisites": { + "x86_64": { + "ubuntu": { + "cmds": [ + "sudo snap install cmake --classic", + "sudo add-apt-repository -y ppa:kisak/kisak-mesa", + "sudo apt update -y", + "sudo apt install lsb-release wget software-properties-common gnupg apt-file", + "sudo apt-file update", + "wget https://apt.llvm.org/llvm.sh", + "chmod +x ./llvm.sh", + "sed -i 's|add-apt-repository \"${REPO_NAME}\"|add-apt-repository -y \"${REPO_NAME}\"|g' ./llvm.sh", + "sudo ./llvm.sh 14", + "rm ./llvm.sh", + "sudo apt install -y clang-14 lldb-14 lld-14 clangd-14 clang-tidy-14 clang-format-14 clang-tools-14 llvm-14-dev lld-14 lldb-14 llvm-14-tools libomp-14-dev libc++-14-dev libc++abi-14-dev libclang-common-14-dev libclang-14-dev libclang-cpp14-dev libunwind-14-dev", + "sudo apt install -y libwayland-dev wayland-protocols mesa-common-dev libegl1-mesa-dev libgles2-mesa-dev mesa-utils libxkbcommon-dev ninja-build", + "sudo apt install -y build-essential libvulkan-dev vulkan-tools vulkan-validationlayers vulkan-utils libtool", + "sudo apt autoremove -y", + "sudo apt clean -y", + "cmake --version", + "clang++ --version", + "apt-file search cmake", + "apt-file search clang++" + ] + }, + "fedora": { + "cmds": [ + "sudo dnf -y update", + "sudo dnf -y upgrade", + "sudo dnf -y install wayland-devel wayland-protocols-devel libxkbcommon-devel cmake ninja-build mesa-dri-drivers mesa-filesystem mesa-libEGL-devel mesa-libGL-devel mesa-libGLU-devel mesa-libgbm-devel mesa-libglapi mesa-libxatracker mesa-vulkan-drivers vulkan-tools libunwind-devel clang clang-analyzer clang-devel clang-libs clang-resource-filesystem llvm-devel clang-tools-extra lld lld-libs lldb libcxx libcxx-devel libcxx-static libcxxabi libcxxabi-devel libcxxabi-static gstreamer1-devel gstreamer1-plugins-base-devel gstreamer1-plugins-bad-free-devel gstreamer1-plugins-bad-free-extras gstreamer1-plugins-base-tools gstreamer1-plugins-good gstreamer1-plugins-good-extras gstreamer1-plugins-ugly-free libtool", + "sudo dnf -y autoremove", + "cmake --version", + "clang++ --version", + "dnf provides cmake", + "dnf provides clang++" + ] + } + } + }, + "post_cmds": [ + { + "ubuntu": { + "env": { + "CC": "/usr/bin/clang", + "CXX": "/usr/bin/clang++" + } + }, + "fedora": { + "env": { + "CC": "/usr/lib64/ccache/clang", + "CXX": "/usr/lib64/ccache/clang++" + } + }, + "cwd": "${FLUTTER_AUTO_BUILD_DIR}", + "cmds": [ + "cmake ${FLUTTER_AUTO_SRC_DIR} ${FLUTTER_AUTO_CMAKE_ARGS}", + "make flutter-auto -j" + ] + }, + { + "ubuntu": { + "env": { + "CC": "/usr/bin/clang", + "CXX": "/usr/bin/clang++" + } + }, + "fedora": { + "env": { + "CC": "/usr/lib64/ccache/clang", + "CXX": "/usr/lib64/ccache/clang++" + } + }, + "cwd": "${COMP_SURF_PBR_BUILD_DIR}", + "cmds": [ + "cmake ${COMP_SURF_PBR_SRC_DIR} ${COMP_SURF_PBR_CMAKE_ARGS}", + "make comp_surf_pbr -j" + ] + } + ] + }, + "overwrite-existing": true, + "custom-device": { + "id": "desktop-auto", + "label": "Toyota flutter-auto", + "sdkNameAndVersion": "flutter-auto x86_64", + "platform": "linux-x64", + "enabled": true, + "ping": "bash -c \"${PING_CMD}\"", + "pingSuccessRegex": "Type=wayland", + "postBuild": "bash -c \"rm -rf ${PLATFORM_ID_DIR_RELATIVE}\"", + "install": "bash -c \"${STAGE_BUNDLE_FOLDER}\"", + "uninstall": "bash -c \"rm -rf ${PLATFORM_ID_DIR_RELATIVE}\"", + "runDebug": "bash -c \"${FLUTTER_AUTO_EXE}\"", + "forwardPort": null, + "forwardPortSuccessRegex": null, + "screenshot": null + } +} \ No newline at end of file diff --git a/meta-agl-flutter/tools/flutter_workspace.py b/meta-agl-flutter/tools/flutter_workspace.py new file mode 120000 index 00000000..faacf59e --- /dev/null +++ b/meta-agl-flutter/tools/flutter_workspace.py @@ -0,0 +1 @@ +external/workspace-automation/flutter_workspace.py \ No newline at end of file diff --git a/meta-agl-flutter/tools/flutter_workspace_config.json b/meta-agl-flutter/tools/flutter_workspace_config.json deleted file mode 100644 index bb7f23cc..00000000 --- a/meta-agl-flutter/tools/flutter_workspace_config.json +++ /dev/null @@ -1,156 +0,0 @@ -{ - "flutter-version": "3.3.1", - "platforms": [ - { - "id": "desktop-auto", - "type": "host", - "arch": "x86_64", - "flutter_runtime": "debug", - "runtime": { - "backend": "egl", - "config": { - "width": 1920, - "height": 1080, - "cursor_theme": "DMZ-White" - }, - "install_dependent_packages": true, - "artifact_source": "github", - "github_owner": "toyota-connected", - "github_repo": "ivi-homescreen", - "github_workflow": "flutter-auto-linux.yml", - "github_artifact": "flutter-auto-${BACKEND}-dbg.amd64.deb.zip" - }, - "overwrite-existing": true, - "custom-device": { - "id": "desktop-auto", - "label": "Toyota flutter-auto", - "sdkNameAndVersion": "flutter-auto x86_64", - "platform": "linux-x64", - "enabled": true, - "ping": ["bash", "-c", "loginctl show-session $(awk '/tty/ {print $1}' <(loginctl)) -p Type"], - "pingSuccessRegex": "Type=wayland", - "postBuild": null, - "install": ["bash", "-c", "mkdir -p /tmp/${appName}/data/flutter_assets && cp -r ${BUNDLE_FOLDER}/* /tmp/${appName} && cp -r ${localPath}/* /tmp/${appName}/data/flutter_assets"], - "uninstall": ["rm", "-rf", "tmp/${appName}"], - "runDebug": ["flutter-auto", "--j=${FLUTTER_WORKSPACE}/.flutter-auto/default_config.json", "--b=/tmp/${appName}"], - "forwardPort": null, - "forwardPortSuccessRegex": null, - "screenshot": null - } - }, - { - "id": "AGL-qemu", - "type": "qemu", - "arch": "x86_64", - "flutter_runtime": "debug", - "runtime": { - "config": { - "window_type": "BG", - "width": 1920, - "height": 1080, - "fullscreen": true - }, - "install_dependent_packages": true, - "relative_path": ".agl/agl-image-flutter-runtime${FLUTTER_RUNTIME}-qemux86-64.wic.vmdk", - "artifact_source": "github", - "github_owner": "meta-flutter", - "github_repo": "meta-flutter", - "github_workflow": "kirkstone-agl-x86_64.yml", - "github_artifact": "agl-image-flutter-runtime${FLUTTER_RUNTIME}-qemux86-64-linux", - "ovmf_path": "/usr/share/ovmf/OVMF.fd", - "cmd": "qemu-system-x86_64", - "args": "-enable-kvm -m 2048 -bios ${OVMF_PATH} -hda ${QEMU_IMAGE} -cpu kvm64 -cpu qemu64,+ssse3,+sse4.1,+sse4.2,+popcnt -vga virtio -show-cursor -device virtio-rng-pci -serial mon:stdio -serial null -soundhw hda -device virtio-net-pci,netdev=net0,mac=52:54:00:12:35:02 -netdev user,id=net0,hostfwd=tcp::2222-:22,hostfwd=tcp::1234-:1234" - }, - "overwrite-existing": true, - "custom-device": { - "id": "AGL-qemu", - "label": "AGL x86_64 QEMU Image", - "sdkNameAndVersion": "agl-image-flutter-runtime${FLUTTER_RUNTIME}-qemux86-64.wic.vmdk", - "platform": "linux-x64", - "enabled": true, - "ping": [ - "bash", "-c", "(echo >/dev/tcp/localhost/2222) &>/dev/null && echo \"open 2222\" || echo \"close 2222\"" - ], - "pingSuccessRegex": "open 2222", - "postBuild": [ - "bash", "-c", "mkdir -p ${localPath}/../../.flutter-auto/data/flutter_assets && cp -r ${localPath}/* ${localPath}/../../.flutter-auto/data/flutter_assets && cp -r ${FLUTTER_WORKSPACE}/.agl/default_config.json ${localPath}/../../.flutter-auto/ && ssh -p 2222 -t -oBatchMode=yes root@localhost passwd -d agl-driver" - ], - "uninstall": [ - "bash", "-c", "ssh -p 2222 -t -t -oBatchMode=yes agl-driver@localhost rm -rf \"/tmp/${appName}\"" - ], - "install": [ - "bash", "-c", "ssh -p 2222 -t -t -oBatchMode=yes agl-driver@localhost mkdir -p \"/tmp/${appName}/data/flutter_assets\" && scp -r -P 2222 ${localPath}/../../.flutter-auto/* agl-driver@localhost:/tmp/${appName}" - ], - "runDebug": [ - "ssh", "-t", "-t", "-p", "2222", "-oBatchMode=yes", "agl-driver@localhost", - "flutter-auto", - "--j=/tmp/${appName}/default_config.json", - "--b=/tmp/${appName}", - "--observatory-host=0.0.0.0", - "--observatory-port=1234" - ], - "forwardPort": null, - "forwardPortSuccessRegex": null, - "screenshot": null - } - } - ], - "repos": [ - { - "uri": "https://github.com/flutter/gallery.git", - "branch": "master", - "rev": "9eb785cb997ff56c46e933c1c591f0a6f31454f6", - "pubspec_path": "gallery" - }, - { - "uri": "git@github.com:meta-flutter/tests.git", - "branch": "main" - }, - { - "uri": "https://github.com/meta-flutter/flutter_animated_background.git", - "branch": "meta-flutter", - "pubspec_path": "flutter_animated_background/example" - }, - { - "uri": "https://github.com/mogol/flutter_secure_storage.git", - "branch": "develop", - "rev": "e716593352b80330e05729486eade7c2167d3c71", - "pubspec_path": "flutter_secure_storage/flutter_secure_storage/example" - }, - { - "uri": "https://github.com/felipeerias/flutter_homescreen.git", - "branch": "main", - "pubspec_path": "flutter_homescreen" - }, - { - "uri": "https://github.com/bernardpumped/ped.git", - "branch": "agl", - "pubspec_path": "ped" - }, - { - "uri": "https://gerrit.automotivelinux.org/gerrit/apps/flutter-dashboard.git", - "branch": "master", - "pubspec_path": "flutter-dashboard" - }, - { - "uri": "https://gerrit.automotivelinux.org/gerrit/apps/flutter-hvac.git", - "branch": "master", - "pubspec_path": "flutter-hvac" - }, - { - "uri": "https://gerrit.automotivelinux.org/gerrit/apps/flutter-instrument-cluster.git", - "branch": "master", - "pubspec_path": "flutter-instrument-cluster" - }, - { - "uri": "https://gerrit.automotivelinux.org/gerrit/apps/flutter-mediaplayer.git", - "branch": "master", - "pubspec_path": "flutter-mediaplayer" - }, - { - "uri": "https://gerrit.automotivelinux.org/gerrit/apps/flutter-navigation.git", - "branch": "master", - "pubspec_path": "flutter-navigation" - } - ] -} -- 2.16.6