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

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: 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', 'pub'] :
ahe 2014/04/22 09:38:13 Long line.
danrubel 2014/04/22 18:37:54 Done.
118 snapshot += '.dart.snapshot' 116 snapshot += '.dart.snapshot'
119 copyfile(join(snapshots, snapshot), 117 copyfile(join(snapshots, snapshot),
120 join(sdk_root, 'bin', 'snapshots', snapshot)) 118 join(sdk_root, 'bin', 'snapshots', snapshot))
121 119
122 120
123 def Main(argv): 121 def Main(argv):
124 # Pull in all of the gypi files which will be munged into the sdk. 122 # Pull in all of the gypi files which will be munged into the sdk.
125 HOME = dirname(dirname(realpath(__file__))) 123 HOME = dirname(dirname(realpath(__file__)))
126 124
127 (options, args) = GetOptions() 125 (options, args) = GetOptions()
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 '.gitignore')) 211 '.gitignore'))
214 212
215 # Copy lib/_internal/libraries.dart. 213 # Copy lib/_internal/libraries.dart.
216 copyfile(join(HOME, 'sdk', 'lib', '_internal', 'libraries.dart'), 214 copyfile(join(HOME, 'sdk', 'lib', '_internal', 'libraries.dart'),
217 join(LIB, '_internal', 'libraries.dart')) 215 join(LIB, '_internal', 'libraries.dart'))
218 216
219 # Create and copy tools. 217 # Create and copy tools.
220 UTIL = join(SDK_tmp, 'util') 218 UTIL = join(SDK_tmp, 'util')
221 os.makedirs(UTIL) 219 os.makedirs(UTIL)
222 220
223 # Create and copy dartanalyzer into 'util' 221 # Create and copy dartanalyzer into 'lib/_internal/dartanalyzer'
224 DARTANALYZER_SRC = join(HOME, build_dir, 'dartanalyzer') 222 DARTANALYZER = join(SDK_tmp, 'lib', '_internal', 'dartanalyzer')
ahe 2014/04/22 09:38:13 Why is this needed?
danrubel 2014/04/22 18:37:54 Good point. We run the snapshot so we don't need i
225 DARTANALYZER_DEST = join(UTIL, 'dartanalyzer') 223 copytree(join(HOME, 'pkg', 'analyzer'),
226 os.makedirs(DARTANALYZER_DEST) 224 join(DARTANALYZER),
227 225 ignore=ignore_patterns('.svn'))
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 226
233 RESOURCE = join(SDK_tmp, 'lib', '_internal', 'pub', 'asset') 227 RESOURCE = join(SDK_tmp, 'lib', '_internal', 'pub', 'asset')
234 os.makedirs(os.path.dirname(RESOURCE)) 228 os.makedirs(os.path.dirname(RESOURCE))
235 copytree(join(HOME, 'sdk', 'lib', '_internal', 'pub', 'asset'), 229 copytree(join(HOME, 'sdk', 'lib', '_internal', 'pub', 'asset'),
236 join(RESOURCE), 230 join(RESOURCE),
237 ignore=ignore_patterns('.svn')) 231 ignore=ignore_patterns('.svn'))
238 232
239 # Copy in 7zip for Windows. 233 # Copy in 7zip for Windows.
240 if HOST_OS == 'win32': 234 if HOST_OS == 'win32':
241 copytree(join(HOME, 'third_party', '7zip'), 235 copytree(join(HOME, 'third_party', '7zip'),
(...skipping 17 matching lines...) Expand all
259 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: 253 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f:
260 f.write(revision + '\n') 254 f.write(revision + '\n')
261 f.close() 255 f.close()
262 256
263 Copy(join(HOME, 'README.dart-sdk'), join(SDK_tmp, 'README')) 257 Copy(join(HOME, 'README.dart-sdk'), join(SDK_tmp, 'README'))
264 258
265 move(SDK_tmp, SDK) 259 move(SDK_tmp, SDK)
266 260
267 if __name__ == '__main__': 261 if __name__ == '__main__':
268 sys.exit(Main(sys.argv)) 262 sys.exit(Main(sys.argv))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698