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

Side by Side Diff: tools/create_sdk.py

Issue 10091038: Revert "Renamed the 'dartc' launch script to 'dart_analyzer' and adds it to dart-sdk" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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 # ......frogc.dart 17 # ......frogc.dart
18 # ......frogsh (coming later) 18 # ......frogsh (coming later)
19 # ......dart_analyzer
20 # ....lib/ 19 # ....lib/
21 # ......builtin/ 20 # ......builtin/
22 # ........builtin_runtime.dart 21 # ........builtin_runtime.dart
23 # ......io/ 22 # ......io/
24 # ........io_runtime.dart 23 # ........io_runtime.dart
25 # ........runtime/ 24 # ........runtime/
26 # ......core/ 25 # ......core/
27 # ........core_{frog, runtime}.dart 26 # ........core_{frog, runtime}.dart
28 # ........{frog, runtime}/ 27 # ........{frog, runtime}/
29 # ......coreimpl/ 28 # ......coreimpl/
(...skipping 11 matching lines...) Expand all
41 # ........html_dartium.dart 40 # ........html_dartium.dart
42 # ......json/ 41 # ......json/
43 # ........json_frog.dart 42 # ........json_frog.dart
44 #.........json.dart 43 #.........json.dart
45 # ........{frog}/ 44 # ........{frog}/
46 # ......uri/ 45 # ......uri/
47 # ........uri.dart 46 # ........uri.dart
48 # ......utf/ 47 # ......utf/
49 # ......(more will come here) 48 # ......(more will come here)
50 # ....util/ 49 # ....util/
51 # .......analyzer/
52 # .........dart_analyzer.jar
53 # .........(third-party libraries for dart_analyzer)
54 # ......(more will come here) 50 # ......(more will come here)
55 51
56 52
57 53
58 import os 54 import os
59 import re 55 import re
60 import sys 56 import sys
61 import tempfile 57 import tempfile
62 import utils 58 import utils
63 59
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 107
112 # Create and populate sdk/bin. 108 # Create and populate sdk/bin.
113 BIN = join(SDK_tmp, 'bin') 109 BIN = join(SDK_tmp, 'bin')
114 os.makedirs(BIN) 110 os.makedirs(BIN)
115 111
116 # Copy the Dart VM binary into sdk/bin. 112 # Copy the Dart VM binary into sdk/bin.
117 # TODO(dgrove) - deal with architectures that are not ia32. 113 # TODO(dgrove) - deal with architectures that are not ia32.
118 build_dir = os.path.dirname(argv[1]) 114 build_dir = os.path.dirname(argv[1])
119 frogc_file_extension = '' 115 frogc_file_extension = ''
120 dart_file_extension = '' 116 dart_file_extension = ''
121 analyzer_file_extension = ''
122 if utils.GuessOS() == 'win32': 117 if utils.GuessOS() == 'win32':
123 dart_file_extension = '.exe' 118 dart_file_extension = '.exe'
124 frogc_file_extension = '.bat' 119 frogc_file_extension = '.bat'
125 analyzer_file_extension = '.sh' # TODO(zundel): never tested on Windows
126 dart_src_binary = join(HOME, build_dir, 'dart' + dart_file_extension) 120 dart_src_binary = join(HOME, build_dir, 'dart' + dart_file_extension)
127 dart_dest_binary = join(BIN, 'dart' + dart_file_extension) 121 dart_dest_binary = join(BIN, 'dart' + dart_file_extension)
128 frogc_src_binary = join(HOME, 'frog', 'scripts', 'bootstrap', 122 frogc_src_binary = join(HOME, 'frog', 'scripts', 'bootstrap',
129 'frogc' + frogc_file_extension) 123 'frogc' + frogc_file_extension)
130 frogc_dest_binary = join(BIN, 'frogc' + frogc_file_extension) 124 frogc_dest_binary = join(BIN, 'frogc' + frogc_file_extension)
131 copyfile(dart_src_binary, dart_dest_binary) 125 copyfile(dart_src_binary, dart_dest_binary)
132 copymode(dart_src_binary, dart_dest_binary) 126 copymode(dart_src_binary, dart_dest_binary)
133 copyfile(frogc_src_binary, frogc_dest_binary) 127 copyfile(frogc_src_binary, frogc_dest_binary)
134 copymode(frogc_src_binary, frogc_dest_binary) 128 copymode(frogc_src_binary, frogc_dest_binary)
135 ANALYZER_HOME = join(HOME, build_dir, 'analyzer')
136 dart_analyzer_src_binary = join(ANALYZER_HOME, 'bin', 'dart_analyzer')
137 dart_analyzer_dest_binary = join(BIN,
138 'dart_analyzer' + analyzer_file_extension)
139 copyfile(dart_analyzer_src_binary, dart_analyzer_dest_binary)
140 copymode(dart_analyzer_src_binary, dart_analyzer_dest_binary)
141 129
142 # Create sdk/bin/frogc.dart, and hack as needed. 130 # Create sdk/bin/frogc.dart, and hack as needed.
143 frog_src_dir = join(HOME, 'frog') 131 frog_src_dir = join(HOME, 'frog')
144 132
145 # Convert frogc.dart's imports from import('*') -> import('frog/*'). 133 # Convert frogc.dart's imports from import('*') -> import('frog/*').
146 frogc_contents = open(join(frog_src_dir, 'frogc.dart')).read() 134 frogc_contents = open(join(frog_src_dir, 'frogc.dart')).read()
147 frogc_dest = open(join(BIN, 'frogc.dart'), 'w') 135 frogc_dest = open(join(BIN, 'frogc.dart'), 'w')
148 frogc_dest.write( 136 frogc_dest.write(
149 re.sub(r"#import\('([^.])", r"#import('../lib/frog/\1", frogc_contents)) 137 re.sub(r"#import\('([^.])", r"#import('../lib/frog/\1", frogc_contents))
150 frogc_dest.close() 138 frogc_dest.close()
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 for filename in coreimpl_runtime_sources: 409 for filename in coreimpl_runtime_sources:
422 if filename.endswith('.dart'): 410 if filename.endswith('.dart'):
423 dest_file.write('#source("runtime/' + filename + '");\n') 411 dest_file.write('#source("runtime/' + filename + '");\n')
424 dest_file.close() 412 dest_file.close()
425 413
426 # Create and copy tools. 414 # Create and copy tools.
427 415
428 UTIL = join(SDK_tmp, 'util') 416 UTIL = join(SDK_tmp, 'util')
429 os.makedirs(UTIL) 417 os.makedirs(UTIL)
430 418
431 # Create and copy Analyzer library.
432
433 ANALYZER_DEST = join(UTIL, 'analyzer')
434 os.makedirs(ANALYZER_DEST)
435 419
436 darta_src_jar = join(ANALYZER_HOME, 'util', 'analyzer', 'dart_analyzer.jar')
437 darta_dest_jar = join(ANALYZER_DEST, 'dart_analyzer.jar')
438 copyfile(darta_src_jar, darta_dest_jar)
439
440 jarsToCopy = [ join("args4j", "2.0.12", "args4j-2.0.12.jar"),
441 join("guava", "r09", "guava-r09.jar"),
442 join("json", "r2_20080312", "json.jar") ]
443 for jarToCopy in jarsToCopy:
444 dest_dir = join (ANALYZER_DEST, os.path.dirname(jarToCopy))
445 os.makedirs(dest_dir)
446 dest_file = join (ANALYZER_DEST, jarToCopy)
447 src_file = join(ANALYZER_HOME, 'util', 'analyzer', jarToCopy)
448 copyfile(src_file, dest_file)
449
450
451 # Copy import maps 420 # Copy import maps
452
453 PLATFORMS = ['any', 'vm', 'dartium', 'dart2js', 'frog' ] 421 PLATFORMS = ['any', 'vm', 'dartium', 'dart2js', 'frog' ]
454 os.makedirs(join(LIB, 'config')) 422 os.makedirs(join(LIB, 'config'))
455 for platform in PLATFORMS: 423 for platform in PLATFORMS:
456 import_src = join(HOME, 'lib', 'config', 'import_' + platform + '.config') 424 import_src = join(HOME, 'lib', 'config', 'import_' + platform + '.config')
457 import_dst = join(LIB, 'config', 'import_' + platform + '.config') 425 import_dst = join(LIB, 'config', 'import_' + platform + '.config')
458 copyfile(import_src, import_dst); 426 copyfile(import_src, import_dst);
459 427
460 move(SDK_tmp, SDK) 428 move(SDK_tmp, SDK)
461 429
462 if __name__ == '__main__': 430 if __name__ == '__main__':
463 sys.exit(Main(sys.argv)) 431 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