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

Side by Side Diff: tools/create_sdk.py

Issue 240723006: Replace Java based analyzer with Dart based analyzer when building SDK (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address comments Created 6 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
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 #
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 # ......dartfmt 18 # ......dartfmt
19 # ......dart2js 19 # ......dart2js
20 # ......dartanalyzer 20 # ......dartanalyzer
21 # ......pub 21 # ......pub
22 # ......snapshots/ 22 # ......snapshots/
23 # ........dart2js.dart.snapshot 23 # ........dart2js.dart.snapshot
24 # ........dartanalyzer.dart.snapshot
24 # ........dartfmt.dart.snapshot 25 # ........dartfmt.dart.snapshot
25 # ........pub.dart.snapshot 26 # ........pub.dart.snapshot
26 # ........utils_wrapper.dart.snapshot 27 # ........utils_wrapper.dart.snapshot
27 # ....include/ 28 # ....include/
28 # ......dart_api.h 29 # ......dart_api.h
29 # ......dart_debugger_api.h 30 # ......dart_debugger_api.h
30 # ......dart_mirrors_api.h 31 # ......dart_mirrors_api.h
31 # ......dart_native_api.h 32 # ......dart_native_api.h
32 # ....lib/ 33 # ....lib/
33 # ......_internal/ 34 # ......_internal/
34 # ......async/ 35 # ......async/
35 # ......collection/ 36 # ......collection/
36 # ......convert/ 37 # ......convert/
37 # ......core/ 38 # ......core/
38 # ......html/ 39 # ......html/
39 # ......internal/ 40 # ......internal/
40 # ......io/ 41 # ......io/
41 # ......isolate/ 42 # ......isolate/
42 # ......js/ 43 # ......js/
43 # ......math/ 44 # ......math/
44 # ......mirrors/ 45 # ......mirrors/
45 # ......typed_data/ 46 # ......typed_data/
46 # ....util/ 47 # ....util/
47 # ......dartanalyzer/
48 # ........dartanalyzer.jar
49 # ........(third-party libraries for dart_analyzer)
50 # ......(more will come here) 48 # ......(more will come here)
51 49
52 50
53 import glob 51 import glob
54 import optparse 52 import optparse
55 import os 53 import os
56 import re 54 import re
57 import sys 55 import sys
58 import subprocess 56 import subprocess
59 import tempfile 57 import tempfile
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 Copy(src, dest) 105 Copy(src, dest)
108 106
109 107
110 def CopyDartScripts(home, sdk_root): 108 def CopyDartScripts(home, sdk_root):
111 for executable in ['dart2js', 'dartanalyzer', 'dartfmt', 'docgen', 'pub']: 109 for executable in ['dart2js', 'dartanalyzer', 'dartfmt', 'docgen', 'pub']:
112 CopyShellScript(os.path.join(home, 'sdk', 'bin', executable), 110 CopyShellScript(os.path.join(home, 'sdk', 'bin', executable),
113 os.path.join(sdk_root, 'bin')) 111 os.path.join(sdk_root, 'bin'))
114 112
115 113
116 def CopySnapshots(snapshots, sdk_root): 114 def CopySnapshots(snapshots, sdk_root):
117 for snapshot in ['dart2js', 'dartfmt', 'utils_wrapper', 'pub']: 115 for snapshot in ['dart2js', 'dartanalyzer', 'dartfmt', 'utils_wrapper',
116 'pub']:
118 snapshot += '.dart.snapshot' 117 snapshot += '.dart.snapshot'
119 copyfile(join(snapshots, snapshot), 118 copyfile(join(snapshots, snapshot),
120 join(sdk_root, 'bin', 'snapshots', snapshot)) 119 join(sdk_root, 'bin', 'snapshots', snapshot))
121 120
122 121
123 def Main(argv): 122 def Main(argv):
124 # Pull in all of the gypi files which will be munged into the sdk. 123 # Pull in all of the gypi files which will be munged into the sdk.
125 HOME = dirname(dirname(realpath(__file__))) 124 HOME = dirname(dirname(realpath(__file__)))
126 125
127 (options, args) = GetOptions() 126 (options, args) = GetOptions()
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 '.gitignore')) 212 '.gitignore'))
214 213
215 # Copy lib/_internal/libraries.dart. 214 # Copy lib/_internal/libraries.dart.
216 copyfile(join(HOME, 'sdk', 'lib', '_internal', 'libraries.dart'), 215 copyfile(join(HOME, 'sdk', 'lib', '_internal', 'libraries.dart'),
217 join(LIB, '_internal', 'libraries.dart')) 216 join(LIB, '_internal', 'libraries.dart'))
218 217
219 # Create and copy tools. 218 # Create and copy tools.
220 UTIL = join(SDK_tmp, 'util') 219 UTIL = join(SDK_tmp, 'util')
221 os.makedirs(UTIL) 220 os.makedirs(UTIL)
222 221
223 # Create and copy dartanalyzer into 'util'
224 DARTANALYZER_SRC = join(HOME, build_dir, 'dartanalyzer')
225 DARTANALYZER_DEST = join(UTIL, 'dartanalyzer')
226 os.makedirs(DARTANALYZER_DEST)
227
228 jarFiles = glob.glob(join(DARTANALYZER_SRC, '*.jar'))
229
230 for jarFile in jarFiles:
231 copyfile(jarFile, join(DARTANALYZER_DEST, os.path.basename(jarFile)))
232
233 RESOURCE = join(SDK_tmp, 'lib', '_internal', 'pub', 'asset') 222 RESOURCE = join(SDK_tmp, 'lib', '_internal', 'pub', 'asset')
234 os.makedirs(os.path.dirname(RESOURCE)) 223 os.makedirs(os.path.dirname(RESOURCE))
235 copytree(join(HOME, 'sdk', 'lib', '_internal', 'pub', 'asset'), 224 copytree(join(HOME, 'sdk', 'lib', '_internal', 'pub', 'asset'),
236 join(RESOURCE), 225 join(RESOURCE),
237 ignore=ignore_patterns('.svn')) 226 ignore=ignore_patterns('.svn'))
238 227
239 # Copy in 7zip for Windows. 228 # Copy in 7zip for Windows.
240 if HOST_OS == 'win32': 229 if HOST_OS == 'win32':
241 copytree(join(HOME, 'third_party', '7zip'), 230 copytree(join(HOME, 'third_party', '7zip'),
242 join(RESOURCE, '7zip'), 231 join(RESOURCE, '7zip'),
(...skipping 16 matching lines...) Expand all
259 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: 248 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f:
260 f.write(revision + '\n') 249 f.write(revision + '\n')
261 f.close() 250 f.close()
262 251
263 Copy(join(HOME, 'README.dart-sdk'), join(SDK_tmp, 'README')) 252 Copy(join(HOME, 'README.dart-sdk'), join(SDK_tmp, 'README'))
264 253
265 move(SDK_tmp, SDK) 254 move(SDK_tmp, SDK)
266 255
267 if __name__ == '__main__': 256 if __name__ == '__main__':
268 sys.exit(Main(sys.argv)) 257 sys.exit(Main(sys.argv))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698