| OLD | NEW |
| 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) 2011, 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. The SDK will be | 7 # A script which will be invoked from gyp to create an SDK. The SDK will be |
| 8 # used either from the command-line or from the editor. Top structure is | 8 # used either from the command-line or from the editor. Top structure is |
| 9 # | 9 # |
| 10 # ..sdk/ | 10 # ..sdk/ |
| 11 # ....bin/ | 11 # ....bin/ |
| 12 # ......dart or dart.exe (executable) | 12 # ......dart or dart.exe (executable) |
| 13 # ......frogc.dart | 13 # ......frogc.dart |
| 14 # ......frogsh (coming later) | 14 # ......frogsh (coming later) |
| 15 # ....lib/ | 15 # ....lib/ |
| 16 # ......builtin/ |
| 17 # ........builtin_runtime.dart |
| 18 # ........runtime/ |
| 16 # ......core/ | 19 # ......core/ |
| 17 # ........core_{compiler, frog, runtime}.dart | 20 # ........core_{compiler, frog, runtime}.dart |
| 18 # ........{compiler, frog, runtime}/ | 21 # ........{compiler, frog, runtime}/ |
| 19 # ......coreimpl/ | 22 # ......coreimpl/ |
| 20 # ........coreimpl_{compiler, frog, runtime}.dart | 23 # ........coreimpl_{compiler, frog, runtime}.dart |
| 21 # ........{compiler, frog, runtime}/ | 24 # ........{compiler, frog, runtime}/ |
| 22 # ......dom/ | 25 # ......dom/ |
| 23 # ........dom.dart | 26 # ........dom.dart |
| 24 # ......frog/ | 27 # ......frog/ |
| 25 # ......html/ | 28 # ......html/ |
| (...skipping 13 matching lines...) Expand all Loading... |
| 39 import os | 42 import os |
| 40 import re | 43 import re |
| 41 import sys | 44 import sys |
| 42 import utils | 45 import utils |
| 43 | 46 |
| 44 from os.path import dirname, join, realpath, exists, isdir | 47 from os.path import dirname, join, realpath, exists, isdir |
| 45 from shutil import copyfile, copymode, copytree, ignore_patterns, rmtree | 48 from shutil import copyfile, copymode, copytree, ignore_patterns, rmtree |
| 46 | 49 |
| 47 def Main(argv): | 50 def Main(argv): |
| 48 # Pull in all of the gpyi files which will be munged into the sdk. | 51 # Pull in all of the gpyi files which will be munged into the sdk. |
| 52 builtin_runtime_sources = \ |
| 53 (eval(open("runtime/bin/builtin_sources.gypi").read()))['sources'] |
| 49 corelib_sources = \ | 54 corelib_sources = \ |
| 50 (eval(open("corelib/src/corelib_sources.gypi").read()))['sources'] | 55 (eval(open("corelib/src/corelib_sources.gypi").read()))['sources'] |
| 51 corelib_frog_sources = \ | 56 corelib_frog_sources = \ |
| 52 (eval(open("frog/lib/frog_corelib_sources.gypi").read()))['sources'] | 57 (eval(open("frog/lib/frog_corelib_sources.gypi").read()))['sources'] |
| 53 corelib_runtime_sources = \ | 58 corelib_runtime_sources = \ |
| 54 (eval(open("runtime/lib/lib_sources.gypi").read()))['sources'] | 59 (eval(open("runtime/lib/lib_sources.gypi").read()))['sources'] |
| 55 corelib_compiler_sources = \ | 60 corelib_compiler_sources = \ |
| 56 (eval(open("compiler/compiler_corelib_sources.gypi").read())) \ | 61 (eval(open("compiler/compiler_corelib_sources.gypi").read())) \ |
| 57 ['variables']['compiler_corelib_resources'] | 62 ['variables']['compiler_corelib_resources'] |
| 58 coreimpl_sources = \ | 63 coreimpl_sources = \ |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 128 |
| 124 coreimpl_dest_dir = join(LIB, 'coreimpl') | 129 coreimpl_dest_dir = join(LIB, 'coreimpl') |
| 125 os.makedirs(coreimpl_dest_dir) | 130 os.makedirs(coreimpl_dest_dir) |
| 126 os.makedirs(join(coreimpl_dest_dir, 'compiler')) | 131 os.makedirs(join(coreimpl_dest_dir, 'compiler')) |
| 127 os.makedirs(join(coreimpl_dest_dir, 'frog')) | 132 os.makedirs(join(coreimpl_dest_dir, 'frog')) |
| 128 os.makedirs(join(coreimpl_dest_dir, 'frog', 'node')) | 133 os.makedirs(join(coreimpl_dest_dir, 'frog', 'node')) |
| 129 os.makedirs(join(coreimpl_dest_dir, 'runtime')) | 134 os.makedirs(join(coreimpl_dest_dir, 'runtime')) |
| 130 | 135 |
| 131 | 136 |
| 132 # | 137 # |
| 138 # Create and populate lib/runtime. |
| 139 # |
| 140 builtin_dest_dir = join(LIB, 'builtin') |
| 141 os.makedirs(builtin_dest_dir) |
| 142 os.makedirs(join(builtin_dest_dir, 'runtime')) |
| 143 for filename in builtin_runtime_sources: |
| 144 if filename.endswith('.dart'): |
| 145 copyfile(join(HOME, 'runtime', 'bin', filename), |
| 146 join(builtin_dest_dir, 'runtime', filename)) |
| 147 |
| 148 # Construct lib/builtin/builtin_runtime.dart from whole cloth. |
| 149 dest_file = open(join(builtin_dest_dir, 'builtin_runtime.dart'), 'w') |
| 150 dest_file.write('#library("dart:builtin");\n') |
| 151 for filename in builtin_runtime_sources: |
| 152 if filename.endswith('.dart'): |
| 153 dest_file.write('#source("runtime/' + filename + '");\n') |
| 154 dest_file.close() |
| 155 |
| 156 # |
| 133 # Create and populate lib/frog. | 157 # Create and populate lib/frog. |
| 134 # | 158 # |
| 135 frog_dest_dir = join(LIB, 'frog') | 159 frog_dest_dir = join(LIB, 'frog') |
| 136 os.makedirs(frog_dest_dir) | 160 os.makedirs(frog_dest_dir) |
| 137 | 161 |
| 138 for filename in os.listdir(frog_src_dir): | 162 for filename in os.listdir(frog_src_dir): |
| 139 if filename == 'frog_options.dart': | 163 if filename == 'frog_options.dart': |
| 140 # change config from 'dev' to 'sdk' in frog_options.dart | 164 # change config from 'dev' to 'sdk' in frog_options.dart |
| 141 frog_options_contents = open(join(frog_src_dir, filename)).read() | 165 frog_options_contents = open(join(frog_src_dir, filename)).read() |
| 142 frog_options_dest = open(join(frog_dest_dir, filename), 'w') | 166 frog_options_dest = open(join(frog_dest_dir, filename), 'w') |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 # Create and copy tools. | 349 # Create and copy tools. |
| 326 | 350 |
| 327 UTIL = join(SDK, 'tools') | 351 UTIL = join(SDK, 'tools') |
| 328 os.makedirs(UTIL) | 352 os.makedirs(UTIL) |
| 329 | 353 |
| 330 copytree(join(HOME, 'utils', 'dartdoc'), join(UTIL, 'dartdoc'), | 354 copytree(join(HOME, 'utils', 'dartdoc'), join(UTIL, 'dartdoc'), |
| 331 ignore=ignore_patterns('.svn')) | 355 ignore=ignore_patterns('.svn')) |
| 332 | 356 |
| 333 if __name__ == '__main__': | 357 if __name__ == '__main__': |
| 334 sys.exit(Main(sys.argv)) | 358 sys.exit(Main(sys.argv)) |
| OLD | NEW |