[Buildroot] [PATCH/next 2/7] package/flutter-engine: Add runtime mode choice

Yann E. MORIN yann.morin.1998 at free.fr
Sat Nov 18 13:56:23 UTC 2023


Adam, All,

On 2023-11-17 18:54 -0700, Adam Duskett spake thusly:
> 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.

I think we do not want to add Debug/Release flags for all and every
packages, and that we should still rely on the existing, system-wide
settings.

Just add a new option "profiling", which when set takes precendence f
BR2_ENABLE_RUNTIME_DEBUG:

  - in Config.in:

    config FLUTTER_ENGINE_RUNTIME_MODE_PROFILE
        bool "enable profiling"
        help
          Say 'y' here to enable profiling. If 'n', then the global
          BR2_ENABLE_RUNTIME_DEBUG will drive whether to use the releae
          or debug mode.

  - in flutter-engine.mk:

    ifeq ($(FLUTTER_ENGINE_RUNTIME_MODE_PROFILE),y)
    FLUTTER_ENGINE_RUNTIME_MODE=profile
    else ifeq ($(BR2_ENABLE_RUNTIME_DEBUG),y)
    FLUTTER_ENGINE_RUNTIME_MODE=debug
    else
    FLUTTER_ENGINE_RUNTIME_MODE=release
    endif

Regards,
Yann E. MORIN.

> 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
> 
> _______________________________________________
> buildroot mailing list
> buildroot at buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'



More information about the buildroot mailing list