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

Side by Side Diff: tools/create_sdk.py

Issue 10545048: Reverts r8373 "Renamed the 'dartc' launch script to 'dart_analysis'" (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') | tools/testing/dart/test_suite.dart » ('j') | 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) 2011, 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 #
11 # The SDK will be used either from the command-line or from the editor. 11 # The SDK will be used either from the command-line or from the editor.
12 # Top structure is 12 # Top structure is
13 # 13 #
14 # ..dart-sdk/ 14 # ..dart-sdk/
15 # ....bin/ 15 # ....bin/
16 # ......dart or dart.exe (executable) 16 # ......dart or dart.exe (executable)
17 # ......dart.lib (import library for VM native extensions on Windows) 17 # ......dart.lib (import library for VM native extensions on Windows)
18 # ......dart2js 18 # ......dart2js
19 # ......dart_analyzer
20 # ......pub 19 # ......pub
21 # ....include/ 20 # ....include/
22 # ......dart_api.h 21 # ......dart_api.h
23 # ......dart_debugger_api.h 22 # ......dart_debugger_api.h
24 # ....lib/ 23 # ....lib/
25 # ......builtin/ 24 # ......builtin/
26 # ........builtin_runtime.dart 25 # ........builtin_runtime.dart
27 # ......io/ 26 # ......io/
28 # ........io_runtime.dart 27 # ........io_runtime.dart
29 # ........runtime/ 28 # ........runtime/
(...skipping 19 matching lines...) Expand all
49 # ........(implementation files) 48 # ........(implementation files)
50 # ......json/ 49 # ......json/
51 # ........json_frog.dart 50 # ........json_frog.dart
52 #.........json.dart 51 #.........json.dart
53 # ........{frog}/ 52 # ........{frog}/
54 # ......uri/ 53 # ......uri/
55 # ........uri.dart 54 # ........uri.dart
56 # ......utf/ 55 # ......utf/
57 # ......(more will come here) 56 # ......(more will come here)
58 # ....util/ 57 # ....util/
59 # ......analyzer/
60 # ........dart_analyzer.jar
61 # ........(third-party libraries for dart_analyzer)
62 # ......pub/ 58 # ......pub/
63 # ......(more will come here) 59 # ......(more will come here)
64 60
65 61
66 62
67 import os 63 import os
68 import re 64 import re
69 import sys 65 import sys
70 import tempfile 66 import tempfile
71 import utils 67 import utils
(...skipping 14 matching lines...) Expand all
86 82
87 dest = open(path, 'w') 83 dest = open(path, 'w')
88 dest.write(contents) 84 dest.write(contents)
89 dest.close() 85 dest.close()
90 86
91 87
92 def Copy(src, dest): 88 def Copy(src, dest):
93 copyfile(src, dest) 89 copyfile(src, dest)
94 copymode(src, dest) 90 copymode(src, dest)
95 91
96 def ShouldCopyAnalyzer():
97 return utils.GuessOS() == 'linux'
98
99 92
100 def CopyShellScript(src_file, dest_dir): 93 def CopyShellScript(src_file, dest_dir):
101 '''Copies a shell/batch script to the given destination directory. Handles 94 '''Copies a shell/batch script to the given destination directory. Handles
102 using the appropriate platform-specific file extension.''' 95 using the appropriate platform-specific file extension.'''
103 file_extension = '' 96 file_extension = ''
104 if utils.GuessOS() == 'win32': 97 if utils.GuessOS() == 'win32':
105 file_extension = '.bat' 98 file_extension = '.bat'
106 99
107 src = src_file + file_extension 100 src = src_file + file_extension
108 dest = join(dest_dir, basename(src_file) + file_extension) 101 dest = join(dest_dir, basename(src_file) + file_extension)
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 # Create and populate sdk/bin. 171 # Create and populate sdk/bin.
179 BIN = join(SDK_tmp, 'bin') 172 BIN = join(SDK_tmp, 'bin')
180 os.makedirs(BIN) 173 os.makedirs(BIN)
181 174
182 # Copy the Dart VM binary and the Windows Dart VM link library 175 # Copy the Dart VM binary and the Windows Dart VM link library
183 # into sdk/bin. 176 # into sdk/bin.
184 # 177 #
185 # TODO(dgrove) - deal with architectures that are not ia32. 178 # TODO(dgrove) - deal with architectures that are not ia32.
186 build_dir = os.path.dirname(argv[1]) 179 build_dir = os.path.dirname(argv[1])
187 dart_file_extension = '' 180 dart_file_extension = ''
188 analyzer_file_extension = ''
189 if utils.GuessOS() == 'win32': 181 if utils.GuessOS() == 'win32':
190 dart_file_extension = '.exe' 182 dart_file_extension = '.exe'
191 analyzer_file_extension = '.bat' # TODO(zundel): test on Windows
192 dart_import_lib_src = join(HOME, build_dir, 'dart.lib') 183 dart_import_lib_src = join(HOME, build_dir, 'dart.lib')
193 dart_import_lib_dest = join(BIN, 'dart.lib') 184 dart_import_lib_dest = join(BIN, 'dart.lib')
194 copyfile(dart_import_lib_src, dart_import_lib_dest) 185 copyfile(dart_import_lib_src, dart_import_lib_dest)
195 dart_src_binary = join(HOME, build_dir, 'dart' + dart_file_extension) 186 dart_src_binary = join(HOME, build_dir, 'dart' + dart_file_extension)
196 dart_dest_binary = join(BIN, 'dart' + dart_file_extension) 187 dart_dest_binary = join(BIN, 'dart' + dart_file_extension)
197 copyfile(dart_src_binary, dart_dest_binary) 188 copyfile(dart_src_binary, dart_dest_binary)
198 copymode(dart_src_binary, dart_dest_binary) 189 copymode(dart_src_binary, dart_dest_binary)
199 190
200 if ShouldCopyAnalyzer():
201 # Copy analyzer into sdk/bin
202 ANALYZER_HOME = join(HOME, build_dir, 'analyzer')
203 dart_analyzer_src_binary = join(ANALYZER_HOME, 'bin', 'dart_analyzer')
204 dart_analyzer_dest_binary = join(BIN,
205 'dart_analyzer' + analyzer_file_extension)
206 copyfile(dart_analyzer_src_binary, dart_analyzer_dest_binary)
207 copymode(dart_analyzer_src_binary, dart_analyzer_dest_binary)
208
209 # Create pub shell script. 191 # Create pub shell script.
210 pub_src_script = join(HOME, 'utils', 'pub', 'sdk', 'pub') 192 pub_src_script = join(HOME, 'utils', 'pub', 'sdk', 'pub')
211 CopyShellScript(pub_src_script, BIN) 193 CopyShellScript(pub_src_script, BIN)
212 194
213 # 195 #
214 # Create and populate sdk/include. 196 # Create and populate sdk/include.
215 # 197 #
216 INCLUDE = join(SDK_tmp, 'include') 198 INCLUDE = join(SDK_tmp, 'include')
217 os.makedirs(INCLUDE) 199 os.makedirs(INCLUDE)
218 copyfile(join(HOME, 'runtime', 'include', 'dart_api.h'), 200 copyfile(join(HOME, 'runtime', 'include', 'dart_api.h'),
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 dest_file.write('#source("runtime/' + filename + '");\n') 459 dest_file.write('#source("runtime/' + filename + '");\n')
478 for filename in coreimpl_runtime_sources: 460 for filename in coreimpl_runtime_sources:
479 if filename.endswith('.dart'): 461 if filename.endswith('.dart'):
480 dest_file.write('#source("runtime/' + filename + '");\n') 462 dest_file.write('#source("runtime/' + filename + '");\n')
481 dest_file.close() 463 dest_file.close()
482 464
483 # Create and copy tools. 465 # Create and copy tools.
484 UTIL = join(SDK_tmp, 'util') 466 UTIL = join(SDK_tmp, 'util')
485 os.makedirs(UTIL) 467 os.makedirs(UTIL)
486 468
487 if ShouldCopyAnalyzer():
488 # Create and copy Analyzer library into 'util'
489 ANALYZER_DEST = join(UTIL, 'analyzer')
490 os.makedirs(ANALYZER_DEST)
491
492 analyzer_src_jar = join(ANALYZER_HOME, 'util', 'analyzer',
493 'dart_analyzer.jar')
494 analyzer_dest_jar = join(ANALYZER_DEST, 'dart_analyzer.jar')
495 copyfile(analyzer_src_jar, analyzer_dest_jar)
496
497 jarsToCopy = [ join("args4j", "2.0.12", "args4j-2.0.12.jar"),
498 join("guava", "r09", "guava-r09.jar"),
499 join("json", "r2_20080312", "json.jar") ]
500 for jarToCopy in jarsToCopy:
501 dest_dir = join (ANALYZER_DEST, os.path.dirname(jarToCopy))
502 os.makedirs(dest_dir)
503 dest_file = join (ANALYZER_DEST, jarToCopy)
504 src_file = join(ANALYZER_HOME, 'util', 'analyzer', jarToCopy)
505 copyfile(src_file, dest_file)
506
507 # Create and populate util/pub. 469 # Create and populate util/pub.
508 pub_src_dir = join(HOME, 'utils', 'pub') 470 pub_src_dir = join(HOME, 'utils', 'pub')
509 pub_dst_dir = join(UTIL, 'pub') 471 pub_dst_dir = join(UTIL, 'pub')
510 copytree(pub_src_dir, pub_dst_dir, 472 copytree(pub_src_dir, pub_dst_dir,
511 ignore=ignore_patterns('.svn', 'sdk')) 473 ignore=ignore_patterns('.svn', 'sdk'))
512 474
513 # Copy import maps. 475 # Copy import maps.
514 PLATFORMS = ['any', 'vm', 'dartium', 'dart2js' ] 476 PLATFORMS = ['any', 'vm', 'dartium', 'dart2js' ]
515 os.makedirs(join(LIB, 'config')) 477 os.makedirs(join(LIB, 'config'))
516 for platform in PLATFORMS: 478 for platform in PLATFORMS:
517 import_src = join(HOME, 'lib', 'config', 'import_' + platform + '.config') 479 import_src = join(HOME, 'lib', 'config', 'import_' + platform + '.config')
518 import_dst = join(LIB, 'config', 'import_' + platform + '.config') 480 import_dst = join(LIB, 'config', 'import_' + platform + '.config')
519 copyfile(import_src, import_dst); 481 copyfile(import_src, import_dst);
520 482
521 # Copy dart2js. 483 # Copy dart2js.
522 CopyDart2Js(build_dir, SDK_tmp) 484 CopyDart2Js(build_dir, SDK_tmp)
523 485
524 # Write the 'revision' file 486 # Write the 'revision' file
525 revision = utils.GetSVNRevision() 487 revision = utils.GetSVNRevision()
526 if revision is not None: 488 if revision is not None:
527 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: 489 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f:
528 f.write(revision + '\n') 490 f.write(revision + '\n')
529 f.close() 491 f.close()
530 492
531 move(SDK_tmp, SDK) 493 move(SDK_tmp, SDK)
532 utils.Touch(os.path.join(SDK, 'create.stamp')) 494 utils.Touch(os.path.join(SDK, 'create.stamp'))
533 495
534 if __name__ == '__main__': 496 if __name__ == '__main__':
535 sys.exit(Main(sys.argv)) 497 sys.exit(Main(sys.argv))
OLDNEW
« no previous file with comments | « dart.gyp ('k') | tools/testing/dart/test_suite.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698