OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium 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 # This a simple script to make building/testing Mojo components easier. | 6 # This a simple script to make building/testing Mojo components easier. |
7 | 7 |
8 import argparse | 8 import argparse |
9 from copy import deepcopy | 9 from copy import deepcopy |
10 import os | 10 import os |
11 import subprocess | 11 import subprocess |
12 import sys | 12 import sys |
13 | 13 |
14 from get_test_list import GetTestList | 14 from get_test_list import GetTestList |
15 from mopy.config import Config | 15 from mopy.config import Config |
16 from mopy.paths import Paths | 16 from mopy.paths import Paths |
17 from mopy.gn import GNArgsForConfig, ParseGNConfig, CommandLineForGNArgs | 17 from mopy.gn import GNArgsForConfig, ParseGNConfig, CommandLineForGNArgs |
18 | 18 |
19 | 19 |
20 def _args_to_config(args): | 20 def _args_to_config(args): |
21 # Default to host OS. | 21 # Default to host OS. |
22 target_os = None | 22 target_os = None |
23 if args.android: | 23 if args.android: |
24 target_os = Config.OS_ANDROID | 24 target_os = Config.OS_ANDROID |
25 elif args.chromeos: | 25 elif args.chromeos: |
26 target_os = Config.OS_CHROMEOS | 26 target_os = Config.OS_CHROMEOS |
27 | 27 |
28 target_arch = args.target_arch | 28 target_cpu = args.target_cpu |
29 | 29 |
30 additional_args = {} | 30 additional_args = {} |
31 | 31 |
32 if 'clang' in args: | 32 if 'clang' in args: |
33 additional_args['is_clang'] = args.clang | 33 additional_args['is_clang'] = args.clang |
34 | 34 |
35 if 'asan' in args and args.asan: | 35 if 'asan' in args and args.asan: |
36 additional_args['sanitizer'] = Config.SANITIZER_ASAN | 36 additional_args['sanitizer'] = Config.SANITIZER_ASAN |
37 | 37 |
38 # Additional non-standard config entries: | 38 # Additional non-standard config entries: |
(...skipping 18 matching lines...) Expand all Loading... |
57 | 57 |
58 if 'builder_name' in args: | 58 if 'builder_name' in args: |
59 additional_args['builder_name'] = args.builder_name | 59 additional_args['builder_name'] = args.builder_name |
60 if 'build_number' in args: | 60 if 'build_number' in args: |
61 additional_args['build_number'] = args.build_number | 61 additional_args['build_number'] = args.build_number |
62 if 'master_name' in args: | 62 if 'master_name' in args: |
63 additional_args['master_name'] = args.master_name | 63 additional_args['master_name'] = args.master_name |
64 if 'test_results_server' in args: | 64 if 'test_results_server' in args: |
65 additional_args['test_results_server'] = args.test_results_server | 65 additional_args['test_results_server'] = args.test_results_server |
66 | 66 |
67 return Config(target_os=target_os, target_arch=target_arch, | 67 return Config(target_os=target_os, target_cpu=target_cpu, |
68 is_debug=args.debug, dcheck_always_on=args.dcheck_always_on, | 68 is_debug=args.debug, dcheck_always_on=args.dcheck_always_on, |
69 **additional_args) | 69 **additional_args) |
70 | 70 |
71 | 71 |
72 def _get_out_dir(config): | 72 def _get_out_dir(config): |
73 paths = Paths(config) | 73 paths = Paths(config) |
74 return paths.SrcRelPath(paths.build_dir) | 74 return paths.SrcRelPath(paths.build_dir) |
75 | 75 |
76 | 76 |
77 def sync(config): | 77 def sync(config): |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 default=True, action='store_true') | 184 default=True, action='store_true') |
185 debug_group.add_argument('--release', help='Release build', default=False, | 185 debug_group.add_argument('--release', help='Release build', default=False, |
186 dest='debug', action='store_false') | 186 dest='debug', action='store_false') |
187 | 187 |
188 os_group = parent_parser.add_mutually_exclusive_group() | 188 os_group = parent_parser.add_mutually_exclusive_group() |
189 os_group.add_argument('--android', help='Build for Android', | 189 os_group.add_argument('--android', help='Build for Android', |
190 action='store_true') | 190 action='store_true') |
191 os_group.add_argument('--chromeos', help='Build for ChromeOS', | 191 os_group.add_argument('--chromeos', help='Build for ChromeOS', |
192 action='store_true') | 192 action='store_true') |
193 | 193 |
194 parent_parser.add_argument('--target-arch', | 194 parent_parser.add_argument('--target-cpu', |
195 help='CPU architecture to build for.', | 195 help='CPU architecture to build for.', |
196 choices=['x64', 'x86', 'arm']) | 196 choices=['x64', 'x86', 'arm']) |
197 | 197 |
198 parent_parser.add_argument('--nacl', help='Add in NaCl', default=False, | 198 parent_parser.add_argument('--nacl', help='Add in NaCl', default=False, |
199 action='store_true') | 199 action='store_true') |
200 | 200 |
201 subparsers = parser.add_subparsers() | 201 subparsers = parser.add_subparsers() |
202 | 202 |
203 sync_parser = subparsers.add_parser('sync', parents=[parent_parser], | 203 sync_parser = subparsers.add_parser('sync', parents=[parent_parser], |
204 help='Sync using gclient (does not run gn).') | 204 help='Sync using gclient (does not run gn).') |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 help='Run NaCl unit tests (does not build).') | 244 help='Run NaCl unit tests (does not build).') |
245 nacltest_parser.set_defaults(func=nacltest) | 245 nacltest_parser.set_defaults(func=nacltest) |
246 | 246 |
247 args = parser.parse_args() | 247 args = parser.parse_args() |
248 config = _args_to_config(args) | 248 config = _args_to_config(args) |
249 return args.func(config) | 249 return args.func(config) |
250 | 250 |
251 | 251 |
252 if __name__ == '__main__': | 252 if __name__ == '__main__': |
253 sys.exit(main()) | 253 sys.exit(main()) |
OLD | NEW |