OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 import buildbot_common | 6 import buildbot_common |
7 import make_rules | 7 import make_rules |
8 import optparse | 8 import optparse |
9 import os | 9 import os |
10 import sys | 10 import sys |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 'DEST': (str, '', True), | 276 'DEST': (str, '', True), |
277 }, False), | 277 }, False), |
278 'SEARCH': (list, '', False), | 278 'SEARCH': (list, '', False), |
279 'POST': (str, '', False), | 279 'POST': (str, '', False), |
280 'PRE': (str, '', False), | 280 'PRE': (str, '', False), |
281 'DEST': (str, ['examples', 'src'], True), | 281 'DEST': (str, ['examples', 'src'], True), |
282 'NAME': (str, '', False), | 282 'NAME': (str, '', False), |
283 'DATA': (list, '', False), | 283 'DATA': (list, '', False), |
284 'TITLE': (str, '', False), | 284 'TITLE': (str, '', False), |
285 'DESC': (str, '', False), | 285 'DESC': (str, '', False), |
286 'INFO': (str, '', False) | 286 'INFO': (str, '', False), |
| 287 'EXPERIMENTAL': (bool, [True, False], False) |
287 } | 288 } |
288 | 289 |
289 | 290 |
290 def ErrorMsgFunc(text): | 291 def ErrorMsgFunc(text): |
291 sys.stderr.write(text + '\n') | 292 sys.stderr.write(text + '\n') |
292 | 293 |
293 | 294 |
294 def ValidateFormat(src, format, ErrorMsg=ErrorMsgFunc): | 295 def ValidateFormat(src, format, ErrorMsg=ErrorMsgFunc): |
295 failed = False | 296 failed = False |
296 | 297 |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 parser.add_option('--master', help='Create master Makefile.', | 521 parser.add_option('--master', help='Create master Makefile.', |
521 action='store_true', dest='master', default=False) | 522 action='store_true', dest='master', default=False) |
522 parser.add_option('--newlib', help='Create newlib examples.', | 523 parser.add_option('--newlib', help='Create newlib examples.', |
523 action='store_true', dest='newlib', default=False) | 524 action='store_true', dest='newlib', default=False) |
524 parser.add_option('--glibc', help='Create glibc examples.', | 525 parser.add_option('--glibc', help='Create glibc examples.', |
525 action='store_true', dest='glibc', default=False) | 526 action='store_true', dest='glibc', default=False) |
526 parser.add_option('--pnacl', help='Create pnacl examples.', | 527 parser.add_option('--pnacl', help='Create pnacl examples.', |
527 action='store_true', dest='pnacl', default=False) | 528 action='store_true', dest='pnacl', default=False) |
528 parser.add_option('--host', help='Create host examples.', | 529 parser.add_option('--host', help='Create host examples.', |
529 action='store_true', dest='host', default=False) | 530 action='store_true', dest='host', default=False) |
| 531 parser.add_option('--experimental', help='Create experimental examples.', |
| 532 action='store_true', dest='experimental', default=False) |
530 | 533 |
531 toolchains = [] | 534 toolchains = [] |
532 platform = getos.GetPlatform() | 535 platform = getos.GetPlatform() |
533 | 536 |
534 options, args = parser.parse_args(argv) | 537 options, args = parser.parse_args(argv) |
535 if options.newlib: | 538 if options.newlib: |
536 toolchains.append('newlib') | 539 toolchains.append('newlib') |
537 if options.glibc: | 540 if options.glibc: |
538 toolchains.append('glibc') | 541 toolchains.append('glibc') |
539 if options.pnacl: | 542 if options.pnacl: |
(...skipping 10 matching lines...) Expand all Loading... |
550 print 'Using default toolchains: ' + ' '.join(toolchains) | 553 print 'Using default toolchains: ' + ' '.join(toolchains) |
551 | 554 |
552 examples = [] | 555 examples = [] |
553 libs = [] | 556 libs = [] |
554 for filename in args: | 557 for filename in args: |
555 desc = LoadProject(filename, toolchains) | 558 desc = LoadProject(filename, toolchains) |
556 if not desc: | 559 if not desc: |
557 print 'Skipping %s, not in [%s].' % (filename, ', '.join(toolchains)) | 560 print 'Skipping %s, not in [%s].' % (filename, ', '.join(toolchains)) |
558 continue | 561 continue |
559 | 562 |
| 563 if desc.get('EXPERIMENTAL', False) and not options.experimental: |
| 564 print 'Skipping %s, experimental only.' % (filename,) |
| 565 continue |
| 566 |
560 srcroot = os.path.dirname(os.path.abspath(filename)) | 567 srcroot = os.path.dirname(os.path.abspath(filename)) |
561 if not ProcessProject(srcroot, options.dstroot, desc, toolchains): | 568 if not ProcessProject(srcroot, options.dstroot, desc, toolchains): |
562 ErrorExit('\n*** Failed to process project: %s ***' % filename) | 569 ErrorExit('\n*** Failed to process project: %s ***' % filename) |
563 | 570 |
564 # if this is an example add it to the master make and update the html | 571 # if this is an example add it to the master make and update the html |
565 if desc['DEST'] == 'examples': | 572 if desc['DEST'] == 'examples': |
566 examples.append(desc['NAME']) | 573 examples.append(desc['NAME']) |
567 ProcessHTML(srcroot, options.dstroot, desc, toolchains) | 574 ProcessHTML(srcroot, options.dstroot, desc, toolchains) |
568 | 575 |
569 # if this is a library add it to the master make | 576 # if this is a library add it to the master make |
570 if desc['DEST'] == 'src': | 577 if desc['DEST'] == 'src': |
571 libs.append(desc['NAME']) | 578 libs.append(desc['NAME']) |
572 | 579 |
573 if options.master: | 580 if options.master: |
574 master_in = os.path.join(SDK_EXAMPLE_DIR, 'Makefile') | 581 master_in = os.path.join(SDK_EXAMPLE_DIR, 'Makefile') |
575 master_out = os.path.join(options.dstroot, 'examples', 'Makefile') | 582 master_out = os.path.join(options.dstroot, 'examples', 'Makefile') |
576 GenerateMasterMakefile(master_in, master_out, examples) | 583 GenerateMasterMakefile(master_in, master_out, examples) |
577 master_out = os.path.join(options.dstroot, 'src', 'Makefile') | 584 master_out = os.path.join(options.dstroot, 'src', 'Makefile') |
578 GenerateMasterMakefile(master_in, master_out, libs) | 585 GenerateMasterMakefile(master_in, master_out, libs) |
579 return 0 | 586 return 0 |
580 | 587 |
581 | 588 |
582 if __name__ == '__main__': | 589 if __name__ == '__main__': |
583 sys.exit(main(sys.argv[1:])) | 590 sys.exit(main(sys.argv[1:])) |
OLD | NEW |