diff --git a/tools/gn b/tools/gn index 33908609e5c16..38f41f69e843d 100755 --- a/tools/gn +++ b/tools/gn @@ -399,6 +399,11 @@ def to_gn_args(args): gn_args['dart_debug'] = True gn_args['dart_debug_optimization_level'] = '0' + if args.dart_optimization_level: + gn_args['dart_default_optimization_level'] = args.dart_optimization_level + elif gn_args['target_os'] in ['android', 'ios']: + gn_args['dart_default_optimization_level'] = 'z' + gn_args['flutter_use_fontconfig'] = args.enable_fontconfig gn_args['dart_component_kind' ] = 'static_library' # Always link Dart in statically. @@ -784,6 +789,12 @@ def parse_args(args): 'VM making it easier to step through VM code in the debugger.' ) + parser.add_argument( + '--dart-optimization-level', + type=str, + help='The default optimization level for the Dart VM runtime.', + ) + parser.add_argument( '--target-os', type=str,