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 subprocess | 7 import subprocess |
8 import sys | 8 import sys |
9 import os | 9 import os |
10 import utils | 10 import utils |
(...skipping 27 matching lines...) Expand all Loading... |
38 if arch in ['simarm64']: | 38 if arch in ['simarm64']: |
39 return 'x64' | 39 return 'x64' |
40 if arch == 'mips': | 40 if arch == 'mips': |
41 return 'mipsel' | 41 return 'mipsel' |
42 if arch == 'simdbc': | 42 if arch == 'simdbc': |
43 return 'arm' if os == 'android' else 'x86' | 43 return 'arm' if os == 'android' else 'x86' |
44 if arch == 'simdbc64': | 44 if arch == 'simdbc64': |
45 return 'arm64' if os == 'android' else 'x64' | 45 return 'arm64' if os == 'android' else 'x64' |
46 return arch | 46 return arch |
47 | 47 |
| 48 def host_os_for_gn(os): |
| 49 if os.startswith('macos'): |
| 50 return 'mac' |
| 51 if os.startswith('win'): |
| 52 return 'win' |
| 53 return os |
| 54 |
48 def to_gn_args(args): | 55 def to_gn_args(args): |
49 gn_args = {} | 56 gn_args = {} |
50 | 57 |
51 host_os = HOST_OS | 58 host_os = host_os_for_gn(HOST_OS) |
52 if HOST_OS == 'macos': | |
53 host_os = 'mac' | |
54 if args.os == 'host': | 59 if args.os == 'host': |
55 gn_args['target_os'] = host_os | 60 gn_args['target_os'] = host_os |
56 else: | 61 else: |
57 gn_args['target_os'] = args.os | 62 gn_args['target_os'] = args.os |
58 | 63 |
59 gn_args['dart_target_arch'] = args.arch | 64 gn_args['dart_target_arch'] = args.arch |
60 gn_args['target_cpu'] = target_cpu_for_arch(args.arch, args.os) | 65 gn_args['target_cpu'] = target_cpu_for_arch(args.arch, args.os) |
61 gn_args['host_cpu'] = host_cpu_for_arch(args.arch) | 66 gn_args['host_cpu'] = host_cpu_for_arch(args.arch) |
62 | 67 |
63 # TODO(zra): This is for the observatory, which currently builds using the | 68 # TODO(zra): This is for the observatory, which currently builds using the |
64 # checked-in sdk. If/when the observatory no longer builds with the | 69 # checked-in sdk. If/when the observatory no longer builds with the |
65 # checked-in sdk, this can be removed. | 70 # checked-in sdk, this can be removed. |
| 71 pub = 'pub' |
| 72 if host_os == 'win': |
| 73 pub = pub + ".bat" |
66 gn_args['dart_host_pub_exe'] = os.path.join( | 74 gn_args['dart_host_pub_exe'] = os.path.join( |
67 DART_ROOT, 'tools', 'sdks', host_os, 'dart-sdk', 'bin', 'pub') | 75 DART_ROOT, 'tools', 'sdks', host_os, 'dart-sdk', 'bin', pub) |
68 | 76 |
69 # For Fuchsia support, the default is to not compile in the root | 77 # For Fuchsia support, the default is to not compile in the root |
70 # certificates. | 78 # certificates. |
71 gn_args['dart_use_fallback_root_certificates'] = True | 79 gn_args['dart_use_fallback_root_certificates'] = True |
72 | 80 |
73 gn_args['dart_zlib_path'] = "//runtime/bin/zlib" | 81 gn_args['dart_zlib_path'] = "//runtime/bin/zlib" |
74 | 82 |
75 gn_args['dart_use_tcmalloc'] = gn_args['target_os'] == 'linux' | 83 gn_args['dart_use_tcmalloc'] = gn_args['target_os'] == 'linux' |
76 | 84 |
77 gn_args['is_debug'] = args.mode == 'debug' | 85 gn_args['is_debug'] = args.mode == 'debug' |
78 gn_args['is_release'] = args.mode == 'release' | 86 gn_args['is_release'] = args.mode == 'release' |
79 gn_args['is_product'] = args.mode == 'product' | 87 gn_args['is_product'] = args.mode == 'product' |
80 gn_args['dart_debug'] = args.mode == 'debug' | 88 gn_args['dart_debug'] = args.mode == 'debug' |
81 | 89 |
82 # This setting is only meaningful for Flutter. Standalone builds of the VM | 90 # This setting is only meaningful for Flutter. Standalone builds of the VM |
83 # should leave this set to 'develop', which causes the build to defer to | 91 # should leave this set to 'develop', which causes the build to defer to |
84 # 'is_debug', 'is_release' and 'is_product'. | 92 # 'is_debug', 'is_release' and 'is_product'. |
85 gn_args['dart_runtime_mode'] = 'develop' | 93 gn_args['dart_runtime_mode'] = 'develop' |
86 | 94 |
87 gn_args['is_clang'] = args.clang and args.os not in ['android'] | 95 if host_os == 'win': |
| 96 gn_args['is_clang'] = False |
| 97 else: |
| 98 gn_args['is_clang'] = args.clang and args.os not in ['android'] |
88 | 99 |
89 if args.target_sysroot: | 100 if args.target_sysroot: |
90 gn_args['target_sysroot'] = args.target_sysroot | 101 gn_args['target_sysroot'] = args.target_sysroot |
91 | 102 |
92 if args.toolchain_prefix: | 103 if args.toolchain_prefix: |
93 gn_args['toolchain_prefix'] = args.toolchain_prefix | 104 gn_args['toolchain_prefix'] = args.toolchain_prefix |
94 | 105 |
95 goma_dir = os.environ.get('GOMA_DIR') | 106 goma_dir = os.environ.get('GOMA_DIR') |
96 goma_home_dir = os.path.join(os.getenv('HOME', ''), 'goma') | 107 goma_home_dir = os.path.join(os.getenv('HOME', ''), 'goma') |
97 if args.goma and goma_dir: | 108 if args.goma and goma_dir: |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 ] | 166 ] |
156 gn_args = to_command_line(to_gn_args(args)) | 167 gn_args = to_command_line(to_gn_args(args)) |
157 out_dir = get_out_dir(args) | 168 out_dir = get_out_dir(args) |
158 print "gn gen --check in %s" % out_dir | 169 print "gn gen --check in %s" % out_dir |
159 command.append(out_dir) | 170 command.append(out_dir) |
160 command.append('--args=%s' % ' '.join(gn_args)) | 171 command.append('--args=%s' % ' '.join(gn_args)) |
161 return subprocess.call(command, cwd=DART_ROOT) | 172 return subprocess.call(command, cwd=DART_ROOT) |
162 | 173 |
163 if __name__ == '__main__': | 174 if __name__ == '__main__': |
164 sys.exit(main(sys.argv)) | 175 sys.exit(main(sys.argv)) |
OLD | NEW |