| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2013, 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 # A script which will be invoked from gyp to create a build of the editor. | 7 # A script which will be invoked from gyp to create a build of the editor. |
| 8 # | 8 # |
| 9 # TODO(devoncarew): currently this script is not callable from tools/build.py | 9 # TODO(devoncarew): currently this script is not callable from tools/build.py |
| 10 # Usage: ./tools/build.py editor | 10 # Usage: ./tools/build.py editor |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 | 78 |
| 79 def GetSdkPath(): | 79 def GetSdkPath(): |
| 80 return join(os.path.dirname(OUTPUT), 'dart-sdk') | 80 return join(os.path.dirname(OUTPUT), 'dart-sdk') |
| 81 | 81 |
| 82 | 82 |
| 83 def GetOutputParent(): | 83 def GetOutputParent(): |
| 84 return os.path.dirname(os.path.dirname(OUTPUT)) | 84 return os.path.dirname(os.path.dirname(OUTPUT)) |
| 85 | 85 |
| 86 | 86 |
| 87 def BuildOptions(): | 87 def BuildOptions(): |
| 88 options = optparse.OptionParser() | 88 options = optparse.OptionParser(usage='usage: %prog [options] <output>') |
| 89 options.add_option("-m", "--mode", | 89 options.add_option("-m", "--mode", |
| 90 help='Build variant', | 90 help='Build variant', |
| 91 metavar='[debug,release]') | 91 metavar='[debug,release]') |
| 92 options.add_option("-a", "--arch", | 92 options.add_option("-a", "--arch", |
| 93 help='Target architecture', | 93 help='Target architecture', |
| 94 metavar='[ia32,x64]') | 94 metavar='[ia32,x64]') |
| 95 return options | 95 return options |
| 96 | 96 |
| 97 | 97 |
| 98 def Main(): | 98 def Main(): |
| 99 global OUTPUT | 99 global OUTPUT |
| 100 | 100 |
| 101 parser = BuildOptions() | 101 parser = BuildOptions() |
| 102 (options, args) = parser.parse_args() | 102 (options, args) = parser.parse_args() |
| 103 | 103 |
| 104 if len(args) > 1: | 104 if len(args) > 1: |
| 105 print 'usage: tools/create_editor.py [options] <output>' | |
| 106 parser.print_help() | 105 parser.print_help() |
| 107 return 0 | 106 return 1 |
| 108 | 107 |
| 109 osName = utils.GuessOS() | 108 osName = utils.GuessOS() |
| 110 mode = 'debug' | 109 mode = 'debug' |
| 111 arch = utils.GuessArchitecture() | 110 arch = utils.GuessArchitecture() |
| 112 | 111 |
| 113 if args: | 112 if args: |
| 114 # TODO(devoncarew): Currently we scrape the output path to determine the | 113 # TODO(devoncarew): Currently we scrape the output path to determine the |
| 115 # mode and arch. This is fragile and should moved into one location | 114 # mode and arch. This is fragile and should moved into one location |
| 116 # (utils.py?) or made more explicit. | 115 # (utils.py?) or made more explicit. |
| 117 OUTPUT = args[0] | 116 OUTPUT = args[0] |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 ProcessEditorArchive(archives[0], OUTPUT) | 185 ProcessEditorArchive(archives[0], OUTPUT) |
| 187 | 186 |
| 188 if os.path.exists(GetEditorTemp()): | 187 if os.path.exists(GetEditorTemp()): |
| 189 shutil.rmtree(GetEditorTemp()) | 188 shutil.rmtree(GetEditorTemp()) |
| 190 | 189 |
| 191 print('\nEditor build successful') | 190 print('\nEditor build successful') |
| 192 | 191 |
| 193 | 192 |
| 194 if __name__ == '__main__': | 193 if __name__ == '__main__': |
| 195 sys.exit(Main()) | 194 sys.exit(Main()) |
| OLD | NEW |