diff --git a/sky/tools/gn b/sky/tools/gn index 9589a62b2119119c6778026ca5aa7d9268708e5a..e98744807bac509b2fad44e58858f8e849c370f1 100755 --- a/sky/tools/gn +++ b/sky/tools/gn @@ -11,31 +11,25 @@ import os SRC_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) def get_out_dir(args): - target_dir = '' - if args.target_os == 'android': - target_dir += 'android_' - elif args.target_os == 'ios': - target_dir += 'ios_' + if args.target_os is not None: + target_dir = [args.target_os] + else: + target_dir = ['host'] + + target_dir.append(args.runtime_mode) if args.simulator: - target_dir += 'sim_' + target_dir.append('sim') if args.debug: - target_dir += 'Debug' - else: - target_dir += 'Release' - - # Currently --develop does not change the out-dir. - if not args.develop: - target_dir += '_Deploy' + target_dir.append('debug') if args.android_cpu != 'arm': - target_dir += '_' + args.android_cpu - + target_dir.append(args.android_cpu) if args.ios_force_armv7: - target_dir += '_armv7' + target_dir.append('armv7') - return os.path.join('out', target_dir) + return os.path.join('out', '_'.join(target_dir)) def to_command_line(gn_args): def merge(key, value): @@ -45,34 +39,40 @@ def to_command_line(gn_args): return [merge(x, y) for x, y in gn_args.iteritems()] def to_gn_args(args): + if args.simulator: + if args.target_os == 'android': + raise Exception('--simulator is not supported on Android') + elif args.target_os == 'ios': + if args.runtime_mode != 'develop': + raise Exception('iOS simulator only supports develop mode') + gn_args = {} gn_args['is_debug'] = args.debug gn_args['is_clang'] = args.clang and args.target_os not in ['android'] - ios_target_cpu = 'arm64' if args.ios_force_armv7: ios_target_cpu = 'arm' + aot = args.runtime_mode != 'develop' if args.target_os == 'android': gn_args['target_os'] = 'android' - aot = not args.develop elif args.target_os == 'ios': gn_args['target_os'] = 'ios' gn_args['ios_deployment_target'] = '7.0' gn_args['use_ios_simulator'] = args.simulator if args.simulator: gn_args['use_libjpeg_turbo'] = False - aot = False else: - # The iOS simulator snapshot is host targetted + # Always use AOT on iOS devices until the interpreter stabilizes aot = True else: gn_args['use_aura'] = False gn_args['use_system_harfbuzz'] = False aot = False + gn_args['dart_runtime_mode'] = args.runtime_mode if args.target_os == 'android': gn_args['target_cpu'] = args.android_cpu elif args.target_os == 'ios': @@ -86,12 +86,6 @@ def to_gn_args(args): gn_args['flutter_aot'] = aot if aot: gn_args['dart_target_arch'] = gn_args['target_cpu'] - if args.debug: - gn_args['dart_runtime_mode'] = 'profile' - else: - gn_args['dart_runtime_mode'] = 'release' - else: - gn_args['dart_runtime_mode'] = 'develop' gn_args['dart_experimental_interpreter'] = args.experimental_interpreter @@ -126,13 +120,10 @@ def parse_args(args): args = args[1:] parser = argparse.ArgumentParser(description='A script run` gn gen`.') - parser.add_argument('--debug', default=True, action='store_true') - parser.add_argument('--release', default=False, dest='debug', action='store_false') + parser.add_argument('--debug', default=False, action='store_true') + + parser.add_argument('--runtime-mode', type=str, choices=['develop', 'profile', 'release'], default='develop') - # Deploy is a placeholder for https://github.com/flutter/flutter/issues/3263 - # Adding it now unblocks bot/tool work. - parser.add_argument('--develop', default=True, action='store_true') - parser.add_argument('--deploy', default=False, dest='develop', action='store_false') parser.add_argument('--experimental-interpreter', default=False, dest='experimental_interpreter', action='store_true') parser.add_argument('--target-os', type=str, choices=['android', 'ios']) diff --git a/travis/analyze.sh b/travis/analyze.sh index 9475c30a2b91ec94c19a2eec361deee4f43a76c8..393a8a44fde8b9ffa9c1a70dda351d4561615425 100755 --- a/travis/analyze.sh +++ b/travis/analyze.sh @@ -10,7 +10,7 @@ RESULTS=`dartanalyzer \ --strong-hints \ --fatal-hints \ --lints \ - out/Debug/gen/sky/bindings/dart_ui.dart \ + out/host_develop_debug/gen/sky/bindings/dart_ui.dart \ 2>&1 \ | grep -v "\[error\] Target of URI does not exist: 'dart:mojo.internal'" \ | grep -v "\[error\] Native functions can only be declared in the SDK and code that is loaded through native extensions" \ @@ -23,7 +23,7 @@ RESULTS=`dartanalyzer \ | grep -Ev "Unused import .+dart_ui\.dart" \ | grep -v "\[info\] TODO" \ | grep -Ev "[0-9]+ errors.*found." \ - | grep -v "Analyzing \[out/Debug/gen/sky/bindings/dart_ui.dart\]\.\.\."` + | grep -v "Analyzing \[out/host_develop_debug/gen/sky/bindings/dart_ui.dart\]\.\.\."` echo "$RESULTS" if [ -n "$RESULTS" ]; diff --git a/travis/build.sh b/travis/build.sh index fef52fd31c784866e5540e47cd8fc991b969792c..8e21547d27b1afb347129a0e93185c5e5e385179 100755 --- a/travis/build.sh +++ b/travis/build.sh @@ -4,5 +4,5 @@ set -ex PATH="$HOME/depot_tools:$PATH" sky/tools/gn --debug -ninja -C out/Debug generate_dart_ui +ninja -C out/host_develop_debug generate_dart_ui travis/analyze.sh