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 shutil | 9 import shutil |
10 import subprocess | 10 import subprocess |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 default=os_has_ide(HOST_OS), | 378 default=os_has_ide(HOST_OS), |
379 action='store_true') | 379 action='store_true') |
380 other_group.add_argument('--msan', | 380 other_group.add_argument('--msan', |
381 help='Build with MSAN', | 381 help='Build with MSAN', |
382 default=UseMSAN(), | 382 default=UseMSAN(), |
383 action='store_true') | 383 action='store_true') |
384 other_group.add_argument('--no-msan', | 384 other_group.add_argument('--no-msan', |
385 help='Disable MSAN', | 385 help='Disable MSAN', |
386 dest='msan', | 386 dest='msan', |
387 action='store_false') | 387 action='store_false') |
| 388 other_group.add_argument('--gn-args', |
| 389 help='Set extra GN args', |
| 390 dest='gn_args', |
| 391 action='append') |
388 other_group.add_argument('--platform-sdk', | 392 other_group.add_argument('--platform-sdk', |
389 help='Directs the create_sdk target to create a smaller "Platform" SDK', | 393 help='Directs the create_sdk target to create a smaller "Platform" SDK', |
390 default=MakePlatformSDK(), | 394 default=MakePlatformSDK(), |
391 action='store_true') | 395 action='store_true') |
392 other_group.add_argument('--target-sysroot', '-s', | 396 other_group.add_argument('--target-sysroot', '-s', |
393 type=str, | 397 type=str, |
394 help='Comma-separated list of arch=/path/to/sysroot mappings') | 398 help='Comma-separated list of arch=/path/to/sysroot mappings') |
395 other_group.add_argument('--toolchain-prefix', '-t', | 399 other_group.add_argument('--toolchain-prefix', '-t', |
396 type=str, | 400 type=str, |
397 help='Comma-separated list of arch=/path/to/toolchain-prefix mappings') | 401 help='Comma-separated list of arch=/path/to/toolchain-prefix mappings') |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 return 1 | 455 return 1 |
452 gn = os.path.join(DART_ROOT, 'buildtools', subdir, 'gn') | 456 gn = os.path.join(DART_ROOT, 'buildtools', subdir, 'gn') |
453 | 457 |
454 commands = [] | 458 commands = [] |
455 for target_os in args.os: | 459 for target_os in args.os: |
456 for mode in args.mode: | 460 for mode in args.mode: |
457 for arch in args.arch: | 461 for arch in args.arch: |
458 out_dir = GetOutDir(mode, arch, target_os) | 462 out_dir = GetOutDir(mode, arch, target_os) |
459 command = [gn, 'gen', out_dir, '--check'] | 463 command = [gn, 'gen', out_dir, '--check'] |
460 gn_args = ToCommandLine(ToGnArgs(args, mode, arch, target_os)) | 464 gn_args = ToCommandLine(ToGnArgs(args, mode, arch, target_os)) |
| 465 if args.gn_args != None: |
| 466 gn_args += args.gn_args |
461 if args.verbose: | 467 if args.verbose: |
462 print "gn gen --check in %s" % out_dir | 468 print "gn gen --check in %s" % out_dir |
463 if args.ide: | 469 if args.ide: |
464 command.append(ide_switch(HOST_OS)) | 470 command.append(ide_switch(HOST_OS)) |
465 command.append('--args=%s' % ' '.join(gn_args)) | 471 command.append('--args=%s' % ' '.join(gn_args)) |
466 commands.append(command) | 472 commands.append(command) |
467 | 473 |
468 pool = multiprocessing.Pool(args.workers) | 474 pool = multiprocessing.Pool(args.workers) |
469 results = pool.map(RunCommand, commands, chunksize=1) | 475 results = pool.map(RunCommand, commands, chunksize=1) |
470 for r in results: | 476 for r in results: |
471 if r != 0: | 477 if r != 0: |
472 print r.strip() | 478 print r.strip() |
473 return 1 | 479 return 1 |
474 | 480 |
475 endtime = time.time() | 481 endtime = time.time() |
476 if args.verbose: | 482 if args.verbose: |
477 print ("GN Time: %.3f seconds" % (endtime - starttime)) | 483 print ("GN Time: %.3f seconds" % (endtime - starttime)) |
478 return 0 | 484 return 0 |
479 | 485 |
480 | 486 |
481 if __name__ == '__main__': | 487 if __name__ == '__main__': |
482 sys.exit(Main(sys.argv)) | 488 sys.exit(Main(sys.argv)) |
OLD | NEW |