| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2016 The Dart project authors. All rights reserved. | 2 # Copyright 2016 The Dart project authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import argparse | 6 import argparse |
| 7 import multiprocessing | 7 import multiprocessing |
| 8 import os | 8 import os |
| 9 import subprocess | 9 import subprocess |
| 10 import sys | 10 import sys |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 pub = pub + ".bat" | 80 pub = pub + ".bat" |
| 81 gn_args['dart_host_pub_exe'] = os.path.join( | 81 gn_args['dart_host_pub_exe'] = os.path.join( |
| 82 DART_ROOT, 'tools', 'sdks', host_os, 'dart-sdk', 'bin', pub) | 82 DART_ROOT, 'tools', 'sdks', host_os, 'dart-sdk', 'bin', pub) |
| 83 | 83 |
| 84 # For Fuchsia support, the default is to not compile in the root | 84 # For Fuchsia support, the default is to not compile in the root |
| 85 # certificates. | 85 # certificates. |
| 86 gn_args['dart_use_fallback_root_certificates'] = True | 86 gn_args['dart_use_fallback_root_certificates'] = True |
| 87 | 87 |
| 88 gn_args['dart_zlib_path'] = "//runtime/bin/zlib" | 88 gn_args['dart_zlib_path'] = "//runtime/bin/zlib" |
| 89 | 89 |
| 90 gn_args['dart_use_tcmalloc'] = gn_args['target_os'] == 'linux' | 90 # Use tcmalloc only when targeting Linux and when not using ASAN. |
| 91 gn_args['dart_use_tcmalloc'] = (gn_args['target_os'] == 'linux' |
| 92 and not args.asan) |
| 91 | 93 |
| 92 gn_args['is_debug'] = mode == 'debug' | 94 gn_args['is_debug'] = mode == 'debug' |
| 93 gn_args['is_release'] = mode == 'release' | 95 gn_args['is_release'] = mode == 'release' |
| 94 gn_args['is_product'] = mode == 'product' | 96 gn_args['is_product'] = mode == 'product' |
| 95 gn_args['dart_debug'] = mode == 'debug' | 97 gn_args['dart_debug'] = mode == 'debug' |
| 96 | 98 |
| 97 # This setting is only meaningful for Flutter. Standalone builds of the VM | 99 # This setting is only meaningful for Flutter. Standalone builds of the VM |
| 98 # should leave this set to 'develop', which causes the build to defer to | 100 # should leave this set to 'develop', which causes the build to defer to |
| 99 # 'is_debug', 'is_release' and 'is_product'. | 101 # 'is_debug', 'is_release' and 'is_product'. |
| 100 gn_args['dart_runtime_mode'] = 'develop' | 102 gn_args['dart_runtime_mode'] = 'develop' |
| 101 | 103 |
| 102 # TODO(zra): Investigate using clang with these configurations. | 104 # TODO(zra): Investigate using clang with these configurations. |
| 103 has_clang = (host_os != 'win' | 105 has_clang = (host_os != 'win' |
| 104 and args.os not in ['android'] | 106 and args.os not in ['android'] |
| 105 and not gn_args['target_cpu'].startswith('arm') | 107 and not gn_args['target_cpu'].startswith('arm') |
| 106 and not gn_args['target_cpu'].startswith('mips')) | 108 and not gn_args['target_cpu'].startswith('mips')) |
| 107 gn_args['is_clang'] = args.clang and has_clang | 109 gn_args['is_clang'] = args.clang and has_clang |
| 108 | 110 |
| 111 gn_args['is_asan'] = args.asan and gn_args['is_clang'] |
| 112 |
| 109 if args.target_sysroot: | 113 if args.target_sysroot: |
| 110 gn_args['target_sysroot'] = args.target_sysroot | 114 gn_args['target_sysroot'] = args.target_sysroot |
| 111 | 115 |
| 112 if args.toolchain_prefix: | 116 if args.toolchain_prefix: |
| 113 gn_args['toolchain_prefix'] = args.toolchain_prefix | 117 gn_args['toolchain_prefix'] = args.toolchain_prefix |
| 114 | 118 |
| 115 goma_dir = os.environ.get('GOMA_DIR') | 119 goma_dir = os.environ.get('GOMA_DIR') |
| 116 goma_home_dir = os.path.join(os.getenv('HOME', ''), 'goma') | 120 goma_home_dir = os.path.join(os.getenv('HOME', ''), 'goma') |
| 117 if args.goma and goma_dir: | 121 if args.goma and goma_dir: |
| 118 gn_args['use_goma'] = True | 122 gn_args['use_goma'] = True |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 type=str, | 195 type=str, |
| 192 help='Target OSs (comma-separated).', | 196 help='Target OSs (comma-separated).', |
| 193 metavar='[all,host,android]', | 197 metavar='[all,host,android]', |
| 194 default='host') | 198 default='host') |
| 195 parser.add_argument('--arch', '-a', | 199 parser.add_argument('--arch', '-a', |
| 196 type=str, | 200 type=str, |
| 197 help='Target architectures (comma-separated).', | 201 help='Target architectures (comma-separated).', |
| 198 metavar='[all,ia32,x64,simarm,arm,simarmv6,armv6,simarmv5te,armv5te,' | 202 metavar='[all,ia32,x64,simarm,arm,simarmv6,armv6,simarmv5te,armv5te,' |
| 199 'simmips,mips,simarm64,arm64,simdbc,armsimdbc]', | 203 'simmips,mips,simarm64,arm64,simdbc,armsimdbc]', |
| 200 default='x64') | 204 default='x64') |
| 205 parser.add_argument('--asan', |
| 206 help='Build with ASAN', |
| 207 default=False, |
| 208 action='store_true') |
| 201 parser.add_argument('--goma', | 209 parser.add_argument('--goma', |
| 202 help='Use goma', | 210 help='Use goma', |
| 203 default=True, | 211 default=True, |
| 204 action='store_true') | 212 action='store_true') |
| 205 parser.add_argument('--no-goma', | 213 parser.add_argument('--no-goma', |
| 206 help='Disable goma', | 214 help='Disable goma', |
| 207 dest='goma', | 215 dest='goma', |
| 208 action='store_false') | 216 action='store_false') |
| 209 parser.add_argument('--clang', | 217 parser.add_argument('--clang', |
| 210 help='Use Clang', | 218 help='Use Clang', |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 return 1 | 290 return 1 |
| 283 | 291 |
| 284 endtime = time.time() | 292 endtime = time.time() |
| 285 if args.verbose: | 293 if args.verbose: |
| 286 print ("GN Time: %.3f seconds" % (endtime - starttime)) | 294 print ("GN Time: %.3f seconds" % (endtime - starttime)) |
| 287 return 0 | 295 return 0 |
| 288 | 296 |
| 289 | 297 |
| 290 if __name__ == '__main__': | 298 if __name__ == '__main__': |
| 291 sys.exit(main(sys.argv)) | 299 sys.exit(main(sys.argv)) |
| OLD | NEW |