Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: tools/create_sdk.py

Issue 10583037: Enables building dart_analyzer on windows and packaging it in the SDK (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « dart.gyp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
104 98
105 def CopyShellScript(src_file, dest_dir): 99 def CopyShellScript(src_file, dest_dir):
106 '''Copies a shell/batch script to the given destination directory. Handles 100 '''Copies a shell/batch script to the given destination directory. Handles
107 using the appropriate platform-specific file extension.''' 101 using the appropriate platform-specific file extension.'''
108 file_extension = '' 102 file_extension = ''
109 if utils.GuessOS() == 'win32': 103 if utils.GuessOS() == 'win32':
110 file_extension = '.bat' 104 file_extension = '.bat'
111 105
112 src = src_file + file_extension 106 src = src_file + file_extension
113 dest = join(dest_dir, basename(src_file) + file_extension) 107 dest = join(dest_dir, basename(src_file) + file_extension)
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 dart_file_extension = '.exe' 185 dart_file_extension = '.exe'
192 analyzer_file_extension = '.bat' # TODO(zundel): test on Windows 186 analyzer_file_extension = '.bat' # TODO(zundel): test on Windows
193 dart_import_lib_src = join(HOME, build_dir, 'dart.lib') 187 dart_import_lib_src = join(HOME, build_dir, 'dart.lib')
194 dart_import_lib_dest = join(BIN, 'dart.lib') 188 dart_import_lib_dest = join(BIN, 'dart.lib')
195 copyfile(dart_import_lib_src, dart_import_lib_dest) 189 copyfile(dart_import_lib_src, dart_import_lib_dest)
196 dart_src_binary = join(HOME, build_dir, 'dart' + dart_file_extension) 190 dart_src_binary = join(HOME, build_dir, 'dart' + dart_file_extension)
197 dart_dest_binary = join(BIN, 'dart' + dart_file_extension) 191 dart_dest_binary = join(BIN, 'dart' + dart_file_extension)
198 copyfile(dart_src_binary, dart_dest_binary) 192 copyfile(dart_src_binary, dart_dest_binary)
199 copymode(dart_src_binary, dart_dest_binary) 193 copymode(dart_src_binary, dart_dest_binary)
200 194
201 if ShouldCopyAnalyzer(): 195 ANALYZER_HOME = join(HOME, build_dir, 'analyzer')
202 # Copy analyzer into sdk/bin 196 dart_analyzer_src_binary = join(ANALYZER_HOME, 'bin', 'dart_analyzer')
203 ANALYZER_HOME = join(HOME, build_dir, 'analyzer') 197 dart_analyzer_dest_binary = join(BIN,
204 dart_analyzer_src_binary = join(ANALYZER_HOME, 'bin', 'dart_analyzer') 198 'dart_analyzer' + analyzer_file_extension)
205 dart_analyzer_dest_binary = join(BIN, 199 copyfile(dart_analyzer_src_binary, dart_analyzer_dest_binary)
206 'dart_analyzer' + analyzer_file_extension) 200 copymode(dart_analyzer_src_binary, dart_analyzer_dest_binary)
207 copyfile(dart_analyzer_src_binary, dart_analyzer_dest_binary)
208 copymode(dart_analyzer_src_binary, dart_analyzer_dest_binary)
209 201
210 # Create pub shell script. 202 # Create pub shell script.
211 pub_src_script = join(HOME, 'utils', 'pub', 'sdk', 'pub') 203 pub_src_script = join(HOME, 'utils', 'pub', 'sdk', 'pub')
212 CopyShellScript(pub_src_script, BIN) 204 CopyShellScript(pub_src_script, BIN)
213 205
214 # 206 #
215 # Create and populate sdk/include. 207 # Create and populate sdk/include.
216 # 208 #
217 INCLUDE = join(SDK_tmp, 'include') 209 INCLUDE = join(SDK_tmp, 'include')
218 os.makedirs(INCLUDE) 210 os.makedirs(INCLUDE)
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 dest_file.write('#source("runtime/' + filename + '");\n') 414 dest_file.write('#source("runtime/' + filename + '");\n')
423 for filename in coreimpl_runtime_sources: 415 for filename in coreimpl_runtime_sources:
424 if filename.endswith('.dart'): 416 if filename.endswith('.dart'):
425 dest_file.write('#source("runtime/' + filename + '");\n') 417 dest_file.write('#source("runtime/' + filename + '");\n')
426 dest_file.close() 418 dest_file.close()
427 419
428 # Create and copy tools. 420 # Create and copy tools.
429 UTIL = join(SDK_tmp, 'util') 421 UTIL = join(SDK_tmp, 'util')
430 os.makedirs(UTIL) 422 os.makedirs(UTIL)
431 423
432 if ShouldCopyAnalyzer(): 424 # Create and copy Analyzer library into 'util'
433 # Create and copy Analyzer library into 'util' 425 ANALYZER_DEST = join(UTIL, 'analyzer')
434 ANALYZER_DEST = join(UTIL, 'analyzer') 426 os.makedirs(ANALYZER_DEST)
435 os.makedirs(ANALYZER_DEST)
436 427
437 analyzer_src_jar = join(ANALYZER_HOME, 'util', 'analyzer', 428 analyzer_src_jar = join(ANALYZER_HOME, 'util', 'analyzer',
438 'dart_analyzer.jar') 429 'dart_analyzer.jar')
439 analyzer_dest_jar = join(ANALYZER_DEST, 'dart_analyzer.jar') 430 analyzer_dest_jar = join(ANALYZER_DEST, 'dart_analyzer.jar')
440 copyfile(analyzer_src_jar, analyzer_dest_jar) 431 copyfile(analyzer_src_jar, analyzer_dest_jar)
441 432
442 jarsToCopy = [ join("args4j", "2.0.12", "args4j-2.0.12.jar"), 433 jarsToCopy = [ join("args4j", "2.0.12", "args4j-2.0.12.jar"),
443 join("guava", "r09", "guava-r09.jar"), 434 join("guava", "r09", "guava-r09.jar"),
444 join("json", "r2_20080312", "json.jar") ] 435 join("json", "r2_20080312", "json.jar") ]
445 for jarToCopy in jarsToCopy: 436 for jarToCopy in jarsToCopy:
446 dest_dir = join (ANALYZER_DEST, os.path.dirname(jarToCopy)) 437 dest_dir = join (ANALYZER_DEST, os.path.dirname(jarToCopy))
447 os.makedirs(dest_dir) 438 os.makedirs(dest_dir)
448 dest_file = join (ANALYZER_DEST, jarToCopy) 439 dest_file = join (ANALYZER_DEST, jarToCopy)
449 src_file = join(ANALYZER_HOME, 'util', 'analyzer', jarToCopy) 440 src_file = join(ANALYZER_HOME, 'util', 'analyzer', jarToCopy)
450 copyfile(src_file, dest_file) 441 copyfile(src_file, dest_file)
451 442
452 # Create and populate util/pub. 443 # Create and populate util/pub.
453 pub_src_dir = join(HOME, 'utils', 'pub') 444 pub_src_dir = join(HOME, 'utils', 'pub')
454 pub_dst_dir = join(UTIL, 'pub') 445 pub_dst_dir = join(UTIL, 'pub')
455 copytree(pub_src_dir, pub_dst_dir, 446 copytree(pub_src_dir, pub_dst_dir,
456 ignore=ignore_patterns('.svn', 'sdk')) 447 ignore=ignore_patterns('.svn', 'sdk'))
457 448
458 # Copy import maps. 449 # Copy import maps.
459 PLATFORMS = ['any', 'vm', 'dartium', 'dart2js' ] 450 PLATFORMS = ['any', 'vm', 'dartium', 'dart2js' ]
460 os.makedirs(join(LIB, 'config')) 451 os.makedirs(join(LIB, 'config'))
(...skipping 10 matching lines...) Expand all
471 if revision is not None: 462 if revision is not None:
472 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: 463 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f:
473 f.write(revision + '\n') 464 f.write(revision + '\n')
474 f.close() 465 f.close()
475 466
476 move(SDK_tmp, SDK) 467 move(SDK_tmp, SDK)
477 utils.Touch(os.path.join(SDK, 'create.stamp')) 468 utils.Touch(os.path.join(SDK, 'create.stamp'))
478 469
479 if __name__ == '__main__': 470 if __name__ == '__main__':
480 sys.exit(Main(sys.argv)) 471 sys.exit(Main(sys.argv))
OLDNEW
« no previous file with comments | « dart.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698