Skip to content

Commit

Permalink
Add a GN flag to set the Dart VM's optimization level (flutter#43743)
Browse files Browse the repository at this point in the history
And set the level to `-Oz` for iOS and Android.
  • Loading branch information
zanderso authored Jul 18, 2023
1 parent f2958f9 commit 77ec923
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tools/gn
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 77ec923

Please sign in to comment.