From e509e34100e9ed63cf44684538f64493d7cbcabb Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Mon, 1 Apr 2024 13:39:04 -0700 Subject: [PATCH 1/2] Allow creating slimpeller engine variants. Fixes https://github.com/flutter/flutter/issues/144432 --- common/config.gni | 8 ++++++++ tools/gn | 11 +++++++++++ 2 files changed, 19 insertions(+) diff --git a/common/config.gni b/common/config.gni index ef1b0288bb844..1e9e771ca3806 100644 --- a/common/config.gni +++ b/common/config.gni @@ -28,6 +28,10 @@ declare_args() { #TODO(cyanglaz): Remove above comment about test flag when the entire iOS embedder supports app extension #https://github.com/flutter/flutter/issues/124289 darwin_extension_safe = false + + # Whether binary size optimizations with the assumption that Impeller is the + # only supported rendering engine are enabled. + slimpeller = false } # feature_defines_list --------------------------------------------------------- @@ -62,6 +66,10 @@ if (flutter_runtime_mode == "debug") { feature_defines_list += [ "FLUTTER_RUNTIME_MODE=0" ] } +if (slimpeller) { + feature_defines_list += [ "SLIMPELLER=1" ] +} + if (is_ios || is_mac) { flutter_cflags_objc = [ "-Werror=overriding-method-mismatch", diff --git a/tools/gn b/tools/gn index 0be76e5477334..f5d73dea9b662 100755 --- a/tools/gn +++ b/tools/gn @@ -68,6 +68,9 @@ def get_out_dir(args): if args.darwin_extension_safe: target_dir.append('extension_safe') + if args.slimpeller: + target_dir.append('slimpeller') + if args.target_dir != '': target_dir = [args.target_dir] @@ -1260,6 +1263,14 @@ def parse_args(args): help='Do not run GN. Instead configure the Impeller cmake example build.', ) + parser.add_argument( + '--slimpeller', + default=False, + action='store_true', + help='Enable optimizations that attempt to reduce binary size of the ' + + 'Flutter engine by assuming only the Impeller rendering engine is supported.' + ) + # Sanitizers. parser.add_argument('--asan', default=False, action='store_true') parser.add_argument('--lsan', default=False, action='store_true') From 7d6b10a22064978c40501269571433c71c431ac6 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Tue, 2 Apr 2024 11:42:09 -0700 Subject: [PATCH 2/2] Add links to the project. --- common/config.gni | 3 +++ tools/gn | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/common/config.gni b/common/config.gni index 1e9e771ca3806..6ec3e4c03e795 100644 --- a/common/config.gni +++ b/common/config.gni @@ -31,6 +31,9 @@ declare_args() { # Whether binary size optimizations with the assumption that Impeller is the # only supported rendering engine are enabled. + # + # See [go/slimpeller-dashboard](https://github.com/orgs/flutter/projects/21) + # for details. slimpeller = false } diff --git a/tools/gn b/tools/gn index f5d73dea9b662..88943c90cb892 100755 --- a/tools/gn +++ b/tools/gn @@ -1268,7 +1268,8 @@ def parse_args(args): default=False, action='store_true', help='Enable optimizations that attempt to reduce binary size of the ' + - 'Flutter engine by assuming only the Impeller rendering engine is supported.' + 'Flutter engine by assuming only the Impeller rendering engine is supported.' + + 'See [go/slimpeller-dashboard](https://github.com/orgs/flutter/projects/21) for details.' ) # Sanitizers.