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

Side by Side Diff: tools/create_sdk.py

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