OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 5 # BSD-style license that can be found in the LICENSE file. |
6 # | 6 # |
7 | 7 |
8 import optparse | 8 import optparse |
9 import os | 9 import os |
10 import re | 10 import re |
(...skipping 26 matching lines...) Expand all Loading... |
37 usage = """\ | 37 usage = """\ |
38 usage: %%prog [options] [targets] | 38 usage: %%prog [options] [targets] |
39 | 39 |
40 This script runs 'make' in the *current* directory. So, run it from | 40 This script runs 'make' in the *current* directory. So, run it from |
41 the Dart repo root, | 41 the Dart repo root, |
42 | 42 |
43 %s , | 43 %s , |
44 | 44 |
45 unless you really intend to use a non-default Makefile.""" % DART_ROOT | 45 unless you really intend to use a non-default Makefile.""" % DART_ROOT |
46 | 46 |
| 47 DART_USE_GN = "DART_USE_GN" |
| 48 |
| 49 |
| 50 def use_gn(): |
| 51 return DART_USE_GN in os.environ |
| 52 |
| 53 |
47 def BuildOptions(): | 54 def BuildOptions(): |
48 result = optparse.OptionParser(usage=usage) | 55 result = optparse.OptionParser(usage=usage) |
49 result.add_option("-m", "--mode", | 56 result.add_option("-m", "--mode", |
50 help='Build variants (comma-separated).', | 57 help='Build variants (comma-separated).', |
51 metavar='[all,debug,release,product]', | 58 metavar='[all,debug,release,product]', |
52 default='debug') | 59 default='debug') |
53 result.add_option("-v", "--verbose", | 60 result.add_option("-v", "--verbose", |
54 help='Verbose output.', | 61 help='Verbose output.', |
55 default=False, action="store_true") | 62 default=False, action="store_true") |
56 result.add_option("-a", "--arch", | 63 result.add_option("-a", "--arch", |
(...skipping 15 matching lines...) Expand all Loading... |
72 (vs_directory, vs_executable) = utils.GuessVisualStudioPath() | 79 (vs_directory, vs_executable) = utils.GuessVisualStudioPath() |
73 result.add_option("--devenv", | 80 result.add_option("--devenv", |
74 help='Path containing devenv.com on Windows', | 81 help='Path containing devenv.com on Windows', |
75 default=vs_directory) | 82 default=vs_directory) |
76 result.add_option("--executable", | 83 result.add_option("--executable", |
77 help='Name of the devenv.com/msbuild executable on Windows (varies for ' | 84 help='Name of the devenv.com/msbuild executable on Windows (varies for ' |
78 'different versions of Visual Studio)', | 85 'different versions of Visual Studio)', |
79 default=vs_executable) | 86 default=vs_executable) |
80 result.add_option("--gn", | 87 result.add_option("--gn", |
81 help='Build with GN/Ninja', | 88 help='Build with GN/Ninja', |
82 default=False, | 89 default=use_gn(), |
83 action='store_true') | 90 action='store_true') |
84 return result | 91 return result |
85 | 92 |
86 | 93 |
87 def ProcessOsOption(os_name): | 94 def ProcessOsOption(os_name): |
88 if os_name == 'host': | 95 if os_name == 'host': |
89 return HOST_OS | 96 return HOST_OS |
90 return os_name | 97 return os_name |
91 | 98 |
92 | 99 |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 else: | 596 else: |
590 if BuildOneConfig(options, target, target_os, | 597 if BuildOneConfig(options, target, target_os, |
591 mode, arch, cross_build) != 0: | 598 mode, arch, cross_build) != 0: |
592 return 1 | 599 return 1 |
593 | 600 |
594 return 0 | 601 return 0 |
595 | 602 |
596 | 603 |
597 if __name__ == '__main__': | 604 if __name__ == '__main__': |
598 sys.exit(Main()) | 605 sys.exit(Main()) |
OLD | NEW |