[Buildroot] [PATCH/next 2/7] package/flutter-engine: Add runtime mode choice
Adam Duskett
adam.duskett at amarulasolutions.com
Sat Nov 18 01:54:50 UTC 2023
There are only two possible modes for Flutter: Debug and release. However,
there is a third mode available to users: profile.
As Flutter projects can be pretty heavy and consume a lot of resources, it is
necessary to allow users to profile their Flutter application during
development.
Add three new choices: FLUTTER_ENGINE_RUNTIME_MODE_{DEBUG,PROFILE,RELEASE}
and set release as the default.
Signed-off-by: Adam Duskett <adam.duskett at amarulasolutions.com>
---
package/flutter-engine/Config.in | 57 ++++++++++++++++++++++++
package/flutter-engine/flutter-engine.mk | 4 +-
2 files changed, 60 insertions(+), 1 deletion(-)
diff --git a/package/flutter-engine/Config.in b/package/flutter-engine/Config.in
index 2ec5b90ffd..5626e31756 100644
--- a/package/flutter-engine/Config.in
+++ b/package/flutter-engine/Config.in
@@ -39,6 +39,63 @@ config BR2_PACKAGE_FLUTTER_ENGINE
https://github.com/flutter/engine
+if BR2_PACKAGE_FLUTTER_ENGINE
+
+choice
+ prompt "flutter-engine mode"
+ default FLUTTER_ENGINE_RUNTIME_MODE_DEBUG if BR2_ENABLE_RUNTIME_DEBUG
+ default FLUTTER_ENGINE_RUNTIME_MODE_RELEASE
+
+config FLUTTER_ENGINE_RUNTIME_MODE_DEBUG
+ bool "Debug"
+ help
+ Uses just-in-time (JIT) compilation for faster compilation
+ and debugging. This mode is also called check mode or slow
+ mode. This allows hot reload.
+
+ https://docs.flutter.dev/testing/build-modes#debug
+
+config FLUTTER_ENGINE_RUNTIME_MODE_PROFILE
+ bool "Profile"
+ help
+ Some debugging ability is maintained—enough to profile your
+ apps performance. Profile mode is disabled on the emulator
+ and simulator, because their behavior is not representative
+ of real performance. Profile mode is similar to release mode,
+ with the following differences:
+
+ - Some service extensions, such as the one that enables the
+ performance overlay, are enabled.
+
+ - Tracing is enabled, and tools supporting source-level
+ debugging (such as DevTools) can connect to the process.
+
+ https://docs.flutter.dev/testing/build-modes#profile
+
+config FLUTTER_ENGINE_RUNTIME_MODE_RELEASE
+ bool "Release"
+ help
+ Use release mode for deploying the app, when you want maximum
+ optimization and minimal footprint size. Release mode
+ (which is not supported on the simulator or emulator), means
+ that:
+
+ - Assertions are disabled.
+
+ - Debugging information is stripped out.
+
+ - Debugging is disabled.
+
+ - Compilation is optimized for fast startup, fast execution,
+ and small package sizes.
+
+ - Service extensions are disabled.
+
+ https://docs.flutter.dev/testing/build-modes#release
+
+endchoice
+endif # BR2_PACKAGE_FLUTTER_ENGINE
+
comment "flutter-engine needs an OpenGL or OpenGLES backend"
depends on BR2_PACKAGE_FLUTTER_ENGINE_ARCH_SUPPORTS
depends on !BR2_PACKAGE_HAS_LIBGL && !BR2_PACKAGE_HAS_LIBGLES
diff --git a/package/flutter-engine/flutter-engine.mk b/package/flutter-engine/flutter-engine.mk
index 32aaa1cccf..15a5c60fd1 100644
--- a/package/flutter-engine/flutter-engine.mk
+++ b/package/flutter-engine/flutter-engine.mk
@@ -52,8 +52,10 @@ FLUTTER_ENGINE_TARGET_ARCH = x64
FLUTTER_ENGINE_TARGET_TRIPPLE = x86_64-unknown-linux-gnu
endif
-ifeq ($(BR2_ENABLE_RUNTIME_DEBUG),y)
+ifeq ($(FLUTTER_ENGINE_RUNTIME_MODE_DEBUG),y)
FLUTTER_ENGINE_RUNTIME_MODE=debug
+else ifeq ($(FLUTTER_ENGINE_RUNTIME_MODE_PROFILE),y)
+FLUTTER_ENGINE_RUNTIME_MODE=profile
else
FLUTTER_ENGINE_RUNTIME_MODE=release
endif
--
2.42.0
More information about the buildroot
mailing list