OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 2 # |
| 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 4 # for details. All rights reserved. Use of this source code is governed by a |
| 5 # BSD-style license that can be found in the LICENSE file. |
| 6 # |
| 7 |
| 8 import optparse |
| 9 import shutil |
| 10 import sys |
| 11 import utils |
| 12 |
| 13 HOST_OS = utils.GuessOS() |
| 14 |
| 15 def BuildOptions(): |
| 16 result = optparse.OptionParser() |
| 17 result.add_option("-m", "--mode", |
| 18 help='Build variants (comma-separated).', |
| 19 metavar='[all,debug,release]', |
| 20 default='debug') |
| 21 result.add_option("--arch", |
| 22 help='Target architectures (comma-separated).', |
| 23 metavar='[all,ia32,x64,simarm,arm]', |
| 24 default=utils.GuessArchitecture()) |
| 25 return result |
| 26 |
| 27 def ProcessOptions(options): |
| 28 if options.arch == 'all': |
| 29 options.arch = 'ia32,x64' |
| 30 if options.mode == 'all': |
| 31 options.mode = 'release,debug' |
| 32 options.mode = options.mode.split(',') |
| 33 options.arch = options.arch.split(',') |
| 34 for mode in options.mode: |
| 35 if not mode in ['debug', 'release']: |
| 36 print "Unknown mode %s" % mode |
| 37 return False |
| 38 for arch in options.arch: |
| 39 if not arch in ['ia32', 'x64', 'simarm', 'arm']: |
| 40 print "Unknown arch %s" % arch |
| 41 return False |
| 42 return True |
| 43 |
| 44 def Main(): |
| 45 parser = BuildOptions() |
| 46 (options, args) = parser.parse_args() |
| 47 if not ProcessOptions(options): |
| 48 parser.print_help() |
| 49 return 1 |
| 50 |
| 51 # Delete the output for the targets for each requested configuration. |
| 52 for mode in options.mode: |
| 53 for arch in options.arch: |
| 54 build_root = utils.GetBuildRoot(HOST_OS, mode=mode, arch=arch) |
| 55 print "Deleting %s" % (build_root) |
| 56 shutil.rmtree(build_root, ignore_errors=True) |
| 57 return 0 |
| 58 |
| 59 if __name__ == '__main__': |
| 60 sys.exit(Main()) |
OLD | NEW |