OLD | NEW |
---|---|
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 # |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
142 '--script_snapshot=%s' % | 142 '--script_snapshot=%s' % |
143 os.path.join(sdk_root, 'pkg', 'compiler', | 143 os.path.join(sdk_root, 'pkg', 'compiler', |
144 'implementation', 'dart2js.dart.snapshot'), | 144 'implementation', 'dart2js.dart.snapshot'), |
145 os.path.join(sdk_root, 'pkg', 'compiler', | 145 os.path.join(sdk_root, 'pkg', 'compiler', |
146 'implementation', 'dart2js.dart')]) | 146 'implementation', 'dart2js.dart')]) |
147 | 147 |
148 | 148 |
149 | 149 |
150 def Main(argv): | 150 def Main(argv): |
151 # Pull in all of the gpyi files which will be munged into the sdk. | 151 # Pull in all of the gpyi files which will be munged into the sdk. |
152 io_runtime_sources = \ | |
153 (eval(open("runtime/bin/io_sources.gypi").read()))['sources'] | |
154 | |
155 HOME = dirname(dirname(realpath(__file__))) | 152 HOME = dirname(dirname(realpath(__file__))) |
156 | 153 |
157 SDK = argv[1] | 154 SDK = argv[1] |
158 SDK_tmp = '%s.tmp' % SDK | 155 SDK_tmp = '%s.tmp' % SDK |
159 | 156 |
160 # TODO(dgrove) - deal with architectures that are not ia32. | 157 # TODO(dgrove) - deal with architectures that are not ia32. |
161 | 158 |
162 if exists(SDK): | 159 if exists(SDK): |
163 rmtree(SDK) | 160 rmtree(SDK) |
164 | 161 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
215 join(INCLUDE, 'dart_debugger_api.h')) | 212 join(INCLUDE, 'dart_debugger_api.h')) |
216 | 213 |
217 # | 214 # |
218 # Create and populate sdk/lib. | 215 # Create and populate sdk/lib. |
219 # | 216 # |
220 | 217 |
221 LIB = join(SDK_tmp, 'lib') | 218 LIB = join(SDK_tmp, 'lib') |
222 os.makedirs(LIB) | 219 os.makedirs(LIB) |
223 | 220 |
224 # | 221 # |
225 # Create and populate lib/io. | |
226 # | |
227 io_dest_dir = join(LIB, 'io') | |
228 os.makedirs(io_dest_dir) | |
229 os.makedirs(join(io_dest_dir, 'runtime')) | |
230 for filename in io_runtime_sources: | |
231 assert filename.endswith('.dart') | |
232 if filename == 'io.dart': | |
233 copyfile(join(HOME, 'runtime', 'bin', filename), | |
234 join(io_dest_dir, 'io_runtime.dart')) | |
235 else: | |
236 copyfile(join(HOME, 'runtime', 'bin', filename), | |
237 join(io_dest_dir, 'runtime', filename)) | |
238 | |
239 # Construct lib/io/io_runtime.dart from whole cloth. | |
240 dest_file = open(join(io_dest_dir, 'io_runtime.dart'), 'a') | |
241 for filename in io_runtime_sources: | |
242 assert filename.endswith('.dart') | |
243 if filename == 'io.dart': | |
244 continue | |
245 dest_file.write('#source("runtime/' + filename + '");\n') | |
246 dest_file.close() | |
247 | |
248 # | |
249 # Create and populate lib/{core, crypto, isolate, json, uri, utf, ...}. | 222 # Create and populate lib/{core, crypto, isolate, json, uri, utf, ...}. |
250 # | 223 # |
251 | 224 |
252 os.makedirs(join(LIB, 'html')) | 225 os.makedirs(join(LIB, 'html')) |
253 for library in ['_internal', 'collection', 'core', 'coreimpl', 'crypto', | 226 for library in ['_internal', 'collection', 'core', 'coreimpl', 'crypto', 'io', |
Søren Gjesse
2012/10/30 09:28:32
Nice!
Mads Ager (google)
2012/10/30 11:12:40
Yes! :)
| |
254 'isolate', join('html', 'dart2js'), join('html', 'dartium'), | 227 'isolate', join('html', 'dart2js'), join('html', 'dartium'), |
255 'json', 'math', 'mirrors', 'scalarlist', 'uri', 'utf']: | 228 'json', 'math', 'mirrors', 'scalarlist', 'uri', 'utf']: |
256 copytree(join(HOME, 'lib', library), join(LIB, library), | 229 copytree(join(HOME, 'lib', library), join(LIB, library), |
257 ignore=ignore_patterns('*.svn', 'doc', '*.py', '*.gypi', '*.sh')) | 230 ignore=ignore_patterns('*.svn', 'doc', '*.py', '*.gypi', '*.sh')) |
258 | 231 |
259 | 232 |
260 # Create and copy pkg. | 233 # Create and copy pkg. |
261 PKG = join(SDK_tmp, 'pkg') | 234 PKG = join(SDK_tmp, 'pkg') |
262 os.makedirs(PKG) | 235 os.makedirs(PKG) |
263 | 236 |
264 # | 237 # |
265 # Create and populate pkg/{args, intl, logging, meta, unittest} | 238 # Create and populate pkg/{args, intl, logging, meta, unittest} |
266 # | 239 # |
267 | 240 |
268 for library in ['args', 'htmlescape', 'dartdoc', 'intl', 'logging', | 241 for library in ['args', 'htmlescape', 'dartdoc', 'intl', 'logging', |
269 'meta', 'unittest']: | 242 'meta', 'unittest']: |
270 copytree(join(HOME, 'pkg', library), join(PKG, library), | 243 copytree(join(HOME, 'pkg', library), join(PKG, library), |
271 ignore=ignore_patterns('*.svn', 'doc', 'docs', | 244 ignore=ignore_patterns('*.svn', 'doc', 'docs', |
272 '*.py', '*.gypi', '*.sh')) | 245 '*.py', '*.gypi', '*.sh')) |
273 | 246 |
274 # TODO(dgrove): Remove this once issue 4788 is addressed. | 247 # TODO(dgrove): Remove this once issue 4788 is addressed. |
275 copytree(join(HOME, 'lib', 'compiler'), join(PKG, 'compiler'), | 248 copytree(join(HOME, 'lib', 'compiler'), join(PKG, 'compiler'), |
276 ignore=ignore_patterns('*.svn', 'doc', '*.py', '*.gypi', '*.sh')) | 249 ignore=ignore_patterns('*.svn', 'doc', '*.py', '*.gypi', '*.sh')) |
277 | 250 |
278 ReplaceInFiles( | 251 ReplaceInFiles( |
279 [join(LIB, '_internal', 'libraries.dart')], | 252 [join(LIB, '_internal', 'libraries.dart')], |
280 [('"compiler/', '"../pkg/compiler/')]) | 253 [('"compiler/', '"../pkg/compiler/')]) |
281 | 254 |
282 ReplaceInFiles( | |
283 [join(PKG, 'compiler', 'implementation', 'lib', 'io.dart')], | |
284 [('../../runtime/bin', '../../lib/io/runtime')]) | |
285 | |
286 # Fixup dartdoc | 255 # Fixup dartdoc |
287 # TODO(dgrove): Remove this once issue 4788 is addressed. | 256 # TODO(dgrove): Remove this once issue 4788 is addressed. |
288 ReplaceInFiles([ | 257 ReplaceInFiles([ |
289 join(PKG, 'dartdoc', 'lib', 'src', 'mirrors', 'dart2js_mirror.dart'), | 258 join(PKG, 'dartdoc', 'lib', 'src', 'mirrors', 'dart2js_mirror.dart'), |
290 join(PKG, 'dartdoc', 'lib', 'mirrors_util.dart'), | 259 join(PKG, 'dartdoc', 'lib', 'mirrors_util.dart'), |
291 join(PKG, 'dartdoc', 'lib', 'classify.dart'), | 260 join(PKG, 'dartdoc', 'lib', 'classify.dart'), |
292 join(PKG, 'dartdoc', 'lib', 'src', 'client', 'client-live-nav.dart'), | 261 join(PKG, 'dartdoc', 'lib', 'src', 'client', 'client-live-nav.dart'), |
293 join(PKG, 'dartdoc', 'lib', 'src', 'client', 'client-static.dart'), | 262 join(PKG, 'dartdoc', 'lib', 'src', 'client', 'client-static.dart'), |
294 join(PKG, 'dartdoc', 'lib', 'dartdoc.dart'), | 263 join(PKG, 'dartdoc', 'lib', 'dartdoc.dart'), |
295 ], [ | 264 ], [ |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
355 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: | 324 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: |
356 f.write(revision + '\n') | 325 f.write(revision + '\n') |
357 f.close() | 326 f.close() |
358 | 327 |
359 Copy(join(HOME, 'README.dart-sdk'), join(SDK_tmp, 'README')) | 328 Copy(join(HOME, 'README.dart-sdk'), join(SDK_tmp, 'README')) |
360 | 329 |
361 move(SDK_tmp, SDK) | 330 move(SDK_tmp, SDK) |
362 | 331 |
363 if __name__ == '__main__': | 332 if __name__ == '__main__': |
364 sys.exit(Main(sys.argv)) | 333 sys.exit(Main(sys.argv)) |
OLD | NEW |