package/flutter-engine: Add profile runtime mode selection

Buildroot only offers two possible runtime modes for Flutter that are
automatically selected based on what the user has selected:
  - debug if BR2_ENABLE_RUNTIME_DEBUG is enabled.
  - release if BR2_ENABLE_RUNTIME_DEBUG is not enabled.

However, Flutter also offers the profile runtime mode option.

From https://docs.flutter.dev/testing/build-modes:

```
"Use profile mode when you want to analyze performance."

What is profile mode?
Some debugging ability is maintained in profile mode, which is enough to
profile your app's performance. Profile mode is turned off on the emulator
and simulator because their behavior does not represent actual performance.
```

As Flutter projects can be heavy and consume many resources, it is necessary
to allow users developing a Flutter application to profile their application
during development.

This patch introduces a new choice: FLUTTER_ENGINE_RUNTIME_MODE_PROFILE.
If unselected, the global option BR2_ENABLE_RUNTIME_DEBUG continues to
determine whether to build Flutter in release or debug mode. This new option
may confuse some users who wonder where the release and debug options are, so
the help menu section under the FLUTTER_ENGINE_RUNTIME_MODE_PROFILE option
explains that the global BR2_ENABLE_RUNTIME_DEBUG option controls the debug
and release modes.

Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
This commit is contained in:
Adam Duskett 2024-01-02 16:59:29 -07:00 committed by Yann E. MORIN
parent a3e98b9f2e
commit 15e524a10e
2 changed files with 28 additions and 1 deletions

View File

@ -39,6 +39,31 @@ config BR2_PACKAGE_FLUTTER_ENGINE
https://github.com/flutter/engine https://github.com/flutter/engine
if BR2_PACKAGE_FLUTTER_ENGINE
config FLUTTER_ENGINE_RUNTIME_MODE_PROFILE
bool "enable profiling"
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.
If this option is left unselected, the global option
BR2_ENABLE_RUNTIME_DEBUG determines whether to build Flutter
in release or debug mode.
https://docs.flutter.dev/testing/build-modes#profile
endif
comment "flutter-engine needs an OpenGL or OpenGLES backend" comment "flutter-engine needs an OpenGL or OpenGLES backend"
depends on BR2_PACKAGE_FLUTTER_ENGINE_ARCH_SUPPORTS depends on BR2_PACKAGE_FLUTTER_ENGINE_ARCH_SUPPORTS
depends on !BR2_PACKAGE_HAS_LIBGL && !BR2_PACKAGE_HAS_LIBGLES depends on !BR2_PACKAGE_HAS_LIBGL && !BR2_PACKAGE_HAS_LIBGLES

View File

@ -52,7 +52,9 @@ FLUTTER_ENGINE_TARGET_ARCH = x64
FLUTTER_ENGINE_TARGET_TRIPPLE = x86_64-unknown-linux-gnu FLUTTER_ENGINE_TARGET_TRIPPLE = x86_64-unknown-linux-gnu
endif endif
ifeq ($(BR2_ENABLE_RUNTIME_DEBUG),y) ifeq ($(FLUTTER_ENGINE_RUNTIME_MODE_PROFILE),y)
FLUTTER_ENGINE_RUNTIME_MODE=profile
else ifeq ($(BR2_ENABLE_RUNTIME_DEBUG),y)
FLUTTER_ENGINE_RUNTIME_MODE=debug FLUTTER_ENGINE_RUNTIME_MODE=debug
else else
FLUTTER_ENGINE_RUNTIME_MODE=release FLUTTER_ENGINE_RUNTIME_MODE=release