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

Side by Side Diff: tools/create_sdk.py

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