diff --git a/common/config.gni b/common/config.gni index ef1b0288bb844..6ec3e4c03e795 100644 --- a/common/config.gni +++ b/common/config.gni @@ -28,6 +28,13 @@ 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. + # + # See [go/slimpeller-dashboard](https://github.com/orgs/flutter/projects/21) + # for details. + slimpeller = false } # feature_defines_list --------------------------------------------------------- @@ -62,6 +69,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..88943c90cb892 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,15 @@ 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.' + + 'See [go/slimpeller-dashboard](https://github.com/orgs/flutter/projects/21) for details.' + ) + # Sanitizers. parser.add_argument('--asan', default=False, action='store_true') parser.add_argument('--lsan', default=False, action='store_true')