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

Side by Side Diff: tools/create_sdk.py

Issue 10918106: Move lib/compiler to pkg/compiler in SDK (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 | « no previous file | no next file » | 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) 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 # ......dart_analyzer
20 # ......pub 20 # ......pub
21 # ....include/ 21 # ....include/
22 # ......dart_api.h 22 # ......dart_api.h
23 # ......dart_debugger_api.h 23 # ......dart_debugger_api.h
24 # ....lib/ 24 # ....lib/
25 # ......_internal/ 25 # ......_internal/
26 # ......compiler/
27 # ......core/ 26 # ......core/
28 # ......coreimpl/ 27 # ......coreimpl/
29 # ......crypto/ 28 # ......crypto/
30 # ......html/ 29 # ......html/
31 # ......io/ 30 # ......io/
32 # ......isolate/ 31 # ......isolate/
33 # ......json/ 32 # ......json/
34 # ......math/ 33 # ......math/
35 # ......mirrors/ 34 # ......mirrors/
36 # ......uri/ 35 # ......uri/
37 # ......utf/ 36 # ......utf/
38 # ....pkg/ 37 # ....pkg/
39 # ......args/ 38 # ......args/
39 # ......compiler/
40 # ......dartdoc/ 40 # ......dartdoc/
41 #.......htmlescape/ 41 #.......htmlescape/
42 # ......intl/ 42 # ......intl/
43 # ......logging/ 43 # ......logging/
44 # ......unittest/ 44 # ......unittest/
45 # ......(more will come here) 45 # ......(more will come here)
46 # ....util/ 46 # ....util/
47 # ......analyzer/ 47 # ......analyzer/
48 # ........dart_analyzer.jar 48 # ........dart_analyzer.jar
49 # ........(third-party libraries for dart_analyzer) 49 # ........(third-party libraries for dart_analyzer)
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 if utils.GuessOS() == 'win32': 95 if utils.GuessOS() == 'win32':
96 file_extension = '.bat' 96 file_extension = '.bat'
97 97
98 src = src_file + file_extension 98 src = src_file + file_extension
99 dest = join(dest_dir, basename(src_file) + file_extension) 99 dest = join(dest_dir, basename(src_file) + file_extension)
100 Copy(src, dest) 100 Copy(src, dest)
101 101
102 102
103 def CopyDart2Js(build_dir, sdk_root, revision): 103 def CopyDart2Js(build_dir, sdk_root, revision):
104 if revision: 104 if revision:
105 ReplaceInFiles([os.path.join(sdk_root, 'lib', 'compiler', 105 ReplaceInFiles([os.path.join(sdk_root, 'pkg', 'compiler',
106 'implementation', 'compiler.dart')], 106 'implementation', 'compiler.dart')],
107 [(r"BUILD_ID = 'build number could not be determined'", 107 [(r"BUILD_ID = 'build number could not be determined'",
108 r"BUILD_ID = '%s'" % revision)]) 108 r"BUILD_ID = '%s'" % revision)])
109 if utils.GuessOS() == 'win32': 109 if utils.GuessOS() == 'win32':
110 dart2js = os.path.join(sdk_root, 'bin', 'dart2js.bat') 110 dart2js = os.path.join(sdk_root, 'bin', 'dart2js.bat')
111 Copy(os.path.join(build_dir, 'dart2js.bat'), dart2js) 111 Copy(os.path.join(build_dir, 'dart2js.bat'), dart2js)
112 dartdoc = os.path.join(sdk_root, 'bin', 'dartdoc.bat') 112 dartdoc = os.path.join(sdk_root, 'bin', 'dartdoc.bat')
113 Copy(os.path.join(build_dir, 'dartdoc.bat'), dartdoc) 113 Copy(os.path.join(build_dir, 'dartdoc.bat'), dartdoc)
114 else: 114 else:
115 dart2js = os.path.join(sdk_root, 'bin', 'dart2js') 115 dart2js = os.path.join(sdk_root, 'bin', 'dart2js')
116 Copy(os.path.join(build_dir, 'dart2js'), dart2js) 116 Copy(os.path.join(build_dir, 'dart2js'), dart2js)
117 dartdoc = os.path.join(sdk_root, 'bin', 'dartdoc') 117 dartdoc = os.path.join(sdk_root, 'bin', 'dartdoc')
118 Copy(os.path.join(build_dir, 'dartdoc'), dartdoc) 118 Copy(os.path.join(build_dir, 'dartdoc'), dartdoc)
119 ReplaceInFiles([dart2js, dartdoc], 119
120 [(r'\$BIN_DIR/\.\./\.\.', r'$BIN_DIR/..')]) 120 # TODO(dgrove) - fix this once issue 4788 is addressed.
121 ReplaceInFiles([dart2js],
122 [(r'\$BIN_DIR/../../lib', r'$BIN_DIR/../pkg')])
123 ReplaceInFiles([dartdoc],
124 [(r'\$BIN_DIR/../..', r'$BIN_DIR/..')])
121 125
122 126
123 def Main(argv): 127 def Main(argv):
124 # Pull in all of the gpyi files which will be munged into the sdk. 128 # Pull in all of the gpyi files which will be munged into the sdk.
125 io_runtime_sources = \ 129 io_runtime_sources = \
126 (eval(open("runtime/bin/io_sources.gypi").read()))['sources'] 130 (eval(open("runtime/bin/io_sources.gypi").read()))['sources']
127 131
128 HOME = dirname(dirname(realpath(__file__))) 132 HOME = dirname(dirname(realpath(__file__)))
129 133
130 SDK_tmp = tempfile.mkdtemp() 134 SDK_tmp = tempfile.mkdtemp()
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 assert filename.endswith('.dart') 212 assert filename.endswith('.dart')
209 if filename == 'io.dart': 213 if filename == 'io.dart':
210 continue 214 continue
211 dest_file.write('#source("runtime/' + filename + '");\n') 215 dest_file.write('#source("runtime/' + filename + '");\n')
212 dest_file.close() 216 dest_file.close()
213 217
214 # 218 #
215 # Create and populate lib/{core, crypto, isolate, json, uri, utf, ...}. 219 # Create and populate lib/{core, crypto, isolate, json, uri, utf, ...}.
216 # 220 #
217 221
218 for library in ['_internal', 'compiler', 'html', 'core', 'coreimpl', 222 for library in ['_internal', 'html', 'core', 'coreimpl',
219 'crypto', 'isolate', 'json', 'math', 'mirrors', 'uri', 'utf']: 223 'crypto', 'isolate', 'json', 'math', 'mirrors', 'uri', 'utf']:
220 copytree(join(HOME, 'lib', library), join(LIB, library), 224 copytree(join(HOME, 'lib', library), join(LIB, library),
221 ignore=ignore_patterns('*.svn', 'doc', '*.py', '*.gypi', '*.sh')) 225 ignore=ignore_patterns('*.svn', 'doc', '*.py', '*.gypi', '*.sh'))
222 226
223 # TODO(dgrove): fix this really ugly hack
224 ReplaceInFiles(
225 [join(LIB, 'compiler', 'implementation', 'lib', 'io.dart')],
226 [('../../runtime/bin', '../io/runtime')])
227 227
228 # Create and copy pkg. 228 # Create and copy pkg.
229 PKG = join(SDK_tmp, 'pkg') 229 PKG = join(SDK_tmp, 'pkg')
230 os.makedirs(PKG) 230 os.makedirs(PKG)
231 231
232 # 232 #
233 # Create and populate pkg/{args, intl, logging, unittest} 233 # Create and populate pkg/{args, intl, logging, unittest}
234 # 234 #
235 235
236 for library in ['args', 'htmlescape', 'dartdoc', 'intl', 'logging', 236 for library in ['args', 'htmlescape', 'dartdoc', 'intl', 'logging',
237 'unittest']: 237 'unittest']:
238 copytree(join(HOME, 'pkg', library), join(PKG, library), 238 copytree(join(HOME, 'pkg', library), join(PKG, library),
239 ignore=ignore_patterns('*.svn', 'doc', 'docs', 239 ignore=ignore_patterns('*.svn', 'doc', 'docs',
240 '*.py', '*.gypi', '*.sh')) 240 '*.py', '*.gypi', '*.sh'))
241 241
242 # TODO(dgrove): Remove this once issue 4788 is addressed.
243 copytree(join(HOME, 'lib', 'compiler'), join(PKG, 'compiler'),
244 ignore=ignore_patterns('*.svn', 'doc', '*.py', '*.gypi', '*.sh'))
245
246 ReplaceInFiles(
247 [join(LIB, '_internal', 'libraries.dart')],
248 [('"compiler/', '"../pkg/compiler/')])
249
250 ReplaceInFiles(
251 [join(PKG, 'compiler', 'implementation', 'lib', 'io.dart')],
252 [('../../runtime/bin', '../../lib/io/runtime')])
253
242 # Fixup dartdoc 254 # Fixup dartdoc
243 ReplaceInFiles([ 255 ReplaceInFiles([
244 join(PKG, 'dartdoc', 'dartdoc.dart'), 256 join(PKG, 'dartdoc', 'dartdoc.dart'),
245 ], [ 257 ], [
246 ("final bool IN_SDK = false;", 258 ("final bool IN_SDK = false;",
247 "final bool IN_SDK = true;"), 259 "final bool IN_SDK = true;"),
260 ])
261
262 # TODO(dgrove): Remove this once issue 4788 is addressed.
263 ReplaceInFiles([
264 join(PKG, 'dartdoc', 'mirrors', 'dart2js_mirror.dart'),
265 join(PKG, 'dartdoc', 'mirrors', 'mirrors_util.dart'),
266 join(PKG, 'dartdoc', 'classify.dart'),
267 join(PKG, 'dartdoc', 'client-live-nav.dart'),
268 join(PKG, 'dartdoc', 'client-static.dart'),
269 join(PKG, 'dartdoc', 'dartdoc.dart'),
270 ], [
271 ("../../lib/compiler",
272 "../../pkg/compiler"),
248 ]) 273 ])
249 274
250
251 # Create and copy tools. 275 # Create and copy tools.
252 UTIL = join(SDK_tmp, 'util') 276 UTIL = join(SDK_tmp, 'util')
253 os.makedirs(UTIL) 277 os.makedirs(UTIL)
254 278
255 if ShouldCopyAnalyzer(): 279 if ShouldCopyAnalyzer():
256 # Create and copy Analyzer library into 'util' 280 # Create and copy Analyzer library into 'util'
257 ANALYZER_DEST = join(UTIL, 'analyzer') 281 ANALYZER_DEST = join(UTIL, 'analyzer')
258 os.makedirs(ANALYZER_DEST) 282 os.makedirs(ANALYZER_DEST)
259 283
260 analyzer_src_jar = join(ANALYZER_HOME, 'util', 'analyzer', 284 analyzer_src_jar = join(ANALYZER_HOME, 'util', 'analyzer',
(...skipping 24 matching lines...) Expand all
285 if revision is not None: 309 if revision is not None:
286 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: 310 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f:
287 f.write(revision + '\n') 311 f.write(revision + '\n')
288 f.close() 312 f.close()
289 313
290 move(SDK_tmp, SDK) 314 move(SDK_tmp, SDK)
291 utils.Touch(os.path.join(SDK, 'create.stamp')) 315 utils.Touch(os.path.join(SDK, 'create.stamp'))
292 316
293 if __name__ == '__main__': 317 if __name__ == '__main__':
294 sys.exit(Main(sys.argv)) 318 sys.exit(Main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698