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 # A script which will be invoked from gyp to create an SDK. | 7 # A script which will be invoked from gyp to create an SDK. |
8 # | 8 # |
9 # Usage: create_sdk.py sdk_directory | 9 # Usage: create_sdk.py sdk_directory |
10 # | 10 # |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 88 |
89 dest = open(path, 'w') | 89 dest = open(path, 'w') |
90 dest.write(contents) | 90 dest.write(contents) |
91 dest.close() | 91 dest.close() |
92 | 92 |
93 | 93 |
94 def Copy(src, dest): | 94 def Copy(src, dest): |
95 copyfile(src, dest) | 95 copyfile(src, dest) |
96 copymode(src, dest) | 96 copymode(src, dest) |
97 | 97 |
| 98 # TODO(zundel): this excludes the analyzer from the sdk build until builders |
| 99 # have all prerequisite software installed. Also update dart.gyp. |
| 100 def ShouldCopyAnalyzer(): |
| 101 os = utils.GuessOS(); |
| 102 return os == 'linux' or os == 'macos' |
| 103 |
98 | 104 |
99 def CopyShellScript(src_file, dest_dir): | 105 def CopyShellScript(src_file, dest_dir): |
100 '''Copies a shell/batch script to the given destination directory. Handles | 106 '''Copies a shell/batch script to the given destination directory. Handles |
101 using the appropriate platform-specific file extension.''' | 107 using the appropriate platform-specific file extension.''' |
102 file_extension = '' | 108 file_extension = '' |
103 if utils.GuessOS() == 'win32': | 109 if utils.GuessOS() == 'win32': |
104 file_extension = '.bat' | 110 file_extension = '.bat' |
105 | 111 |
106 src = src_file + file_extension | 112 src = src_file + file_extension |
107 dest = join(dest_dir, basename(src_file) + file_extension) | 113 dest = join(dest_dir, basename(src_file) + file_extension) |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 dart_file_extension = '.exe' | 191 dart_file_extension = '.exe' |
186 analyzer_file_extension = '.bat' # TODO(zundel): test on Windows | 192 analyzer_file_extension = '.bat' # TODO(zundel): test on Windows |
187 dart_import_lib_src = join(HOME, build_dir, 'dart.lib') | 193 dart_import_lib_src = join(HOME, build_dir, 'dart.lib') |
188 dart_import_lib_dest = join(BIN, 'dart.lib') | 194 dart_import_lib_dest = join(BIN, 'dart.lib') |
189 copyfile(dart_import_lib_src, dart_import_lib_dest) | 195 copyfile(dart_import_lib_src, dart_import_lib_dest) |
190 dart_src_binary = join(HOME, build_dir, 'dart' + dart_file_extension) | 196 dart_src_binary = join(HOME, build_dir, 'dart' + dart_file_extension) |
191 dart_dest_binary = join(BIN, 'dart' + dart_file_extension) | 197 dart_dest_binary = join(BIN, 'dart' + dart_file_extension) |
192 copyfile(dart_src_binary, dart_dest_binary) | 198 copyfile(dart_src_binary, dart_dest_binary) |
193 copymode(dart_src_binary, dart_dest_binary) | 199 copymode(dart_src_binary, dart_dest_binary) |
194 | 200 |
195 ANALYZER_HOME = join(HOME, build_dir, 'analyzer') | 201 if ShouldCopyAnalyzer(): |
196 dart_analyzer_src_binary = join(ANALYZER_HOME, 'bin', 'dart_analyzer') | 202 # Copy analyzer into sdk/bin |
197 dart_analyzer_dest_binary = join(BIN, | 203 ANALYZER_HOME = join(HOME, build_dir, 'analyzer') |
198 'dart_analyzer' + analyzer_file_extension) | 204 dart_analyzer_src_binary = join(ANALYZER_HOME, 'bin', 'dart_analyzer') |
199 copyfile(dart_analyzer_src_binary, dart_analyzer_dest_binary) | 205 dart_analyzer_dest_binary = join(BIN, |
200 copymode(dart_analyzer_src_binary, dart_analyzer_dest_binary) | 206 'dart_analyzer' + analyzer_file_extension) |
| 207 copyfile(dart_analyzer_src_binary, dart_analyzer_dest_binary) |
| 208 copymode(dart_analyzer_src_binary, dart_analyzer_dest_binary) |
201 | 209 |
202 # Create pub shell script. | 210 # Create pub shell script. |
203 pub_src_script = join(HOME, 'utils', 'pub', 'sdk', 'pub') | 211 pub_src_script = join(HOME, 'utils', 'pub', 'sdk', 'pub') |
204 CopyShellScript(pub_src_script, BIN) | 212 CopyShellScript(pub_src_script, BIN) |
205 | 213 |
206 # | 214 # |
207 # Create and populate sdk/include. | 215 # Create and populate sdk/include. |
208 # | 216 # |
209 INCLUDE = join(SDK_tmp, 'include') | 217 INCLUDE = join(SDK_tmp, 'include') |
210 os.makedirs(INCLUDE) | 218 os.makedirs(INCLUDE) |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 dest_file.write('#source("runtime/' + filename + '");\n') | 422 dest_file.write('#source("runtime/' + filename + '");\n') |
415 for filename in coreimpl_runtime_sources: | 423 for filename in coreimpl_runtime_sources: |
416 if filename.endswith('.dart'): | 424 if filename.endswith('.dart'): |
417 dest_file.write('#source("runtime/' + filename + '");\n') | 425 dest_file.write('#source("runtime/' + filename + '");\n') |
418 dest_file.close() | 426 dest_file.close() |
419 | 427 |
420 # Create and copy tools. | 428 # Create and copy tools. |
421 UTIL = join(SDK_tmp, 'util') | 429 UTIL = join(SDK_tmp, 'util') |
422 os.makedirs(UTIL) | 430 os.makedirs(UTIL) |
423 | 431 |
424 # Create and copy Analyzer library into 'util' | 432 if ShouldCopyAnalyzer(): |
425 ANALYZER_DEST = join(UTIL, 'analyzer') | 433 # Create and copy Analyzer library into 'util' |
426 os.makedirs(ANALYZER_DEST) | 434 ANALYZER_DEST = join(UTIL, 'analyzer') |
| 435 os.makedirs(ANALYZER_DEST) |
427 | 436 |
428 analyzer_src_jar = join(ANALYZER_HOME, 'util', 'analyzer', | 437 analyzer_src_jar = join(ANALYZER_HOME, 'util', 'analyzer', |
429 'dart_analyzer.jar') | 438 'dart_analyzer.jar') |
430 analyzer_dest_jar = join(ANALYZER_DEST, 'dart_analyzer.jar') | 439 analyzer_dest_jar = join(ANALYZER_DEST, 'dart_analyzer.jar') |
431 copyfile(analyzer_src_jar, analyzer_dest_jar) | 440 copyfile(analyzer_src_jar, analyzer_dest_jar) |
432 | 441 |
433 jarsToCopy = [ join("args4j", "2.0.12", "args4j-2.0.12.jar"), | 442 jarsToCopy = [ join("args4j", "2.0.12", "args4j-2.0.12.jar"), |
434 join("guava", "r09", "guava-r09.jar"), | 443 join("guava", "r09", "guava-r09.jar"), |
435 join("json", "r2_20080312", "json.jar") ] | 444 join("json", "r2_20080312", "json.jar") ] |
436 for jarToCopy in jarsToCopy: | 445 for jarToCopy in jarsToCopy: |
437 dest_dir = join (ANALYZER_DEST, os.path.dirname(jarToCopy)) | 446 dest_dir = join (ANALYZER_DEST, os.path.dirname(jarToCopy)) |
438 os.makedirs(dest_dir) | 447 os.makedirs(dest_dir) |
439 dest_file = join (ANALYZER_DEST, jarToCopy) | 448 dest_file = join (ANALYZER_DEST, jarToCopy) |
440 src_file = join(ANALYZER_HOME, 'util', 'analyzer', jarToCopy) | 449 src_file = join(ANALYZER_HOME, 'util', 'analyzer', jarToCopy) |
441 copyfile(src_file, dest_file) | 450 copyfile(src_file, dest_file) |
442 | 451 |
443 # Create and populate util/pub. | 452 # Create and populate util/pub. |
444 pub_src_dir = join(HOME, 'utils', 'pub') | 453 pub_src_dir = join(HOME, 'utils', 'pub') |
445 pub_dst_dir = join(UTIL, 'pub') | 454 pub_dst_dir = join(UTIL, 'pub') |
446 copytree(pub_src_dir, pub_dst_dir, | 455 copytree(pub_src_dir, pub_dst_dir, |
447 ignore=ignore_patterns('.svn', 'sdk')) | 456 ignore=ignore_patterns('.svn', 'sdk')) |
448 | 457 |
449 # Copy import maps. | 458 # Copy import maps. |
450 PLATFORMS = ['any', 'vm', 'dartium', 'dart2js' ] | 459 PLATFORMS = ['any', 'vm', 'dartium', 'dart2js' ] |
451 os.makedirs(join(LIB, 'config')) | 460 os.makedirs(join(LIB, 'config')) |
(...skipping 10 matching lines...) Expand all Loading... |
462 if revision is not None: | 471 if revision is not None: |
463 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: | 472 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: |
464 f.write(revision + '\n') | 473 f.write(revision + '\n') |
465 f.close() | 474 f.close() |
466 | 475 |
467 move(SDK_tmp, SDK) | 476 move(SDK_tmp, SDK) |
468 utils.Touch(os.path.join(SDK, 'create.stamp')) | 477 utils.Touch(os.path.join(SDK, 'create.stamp')) |
469 | 478 |
470 if __name__ == '__main__': | 479 if __name__ == '__main__': |
471 sys.exit(Main(sys.argv)) | 480 sys.exit(Main(sys.argv)) |
OLD | NEW |