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. | 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 # ......frogc.dart | 17 # ......frogc.dart |
18 # ......frogsh (coming later) | 18 # ......frogsh (coming later) |
19 # ....lib/ | 19 # ....lib/ |
20 # ......builtin/ | 20 # ......builtin/ |
21 # ........builtin_runtime.dart | 21 # ........builtin_runtime.dart |
22 # ......io/ | 22 # ......io/ |
23 # ........io_runtime.dart | 23 # ........io_runtime.dart |
24 # ........runtime/ | 24 # ........runtime/ |
25 # ......core/ | 25 # ......core/ |
26 # ........core_{frog, runtime}.dart | 26 # ........core_{frog, runtime}.dart |
27 # ........{frog, runtime}/ | 27 # ........{frog, runtime}/ |
28 # ......coreimpl/ | 28 # ......coreimpl/ |
29 # ........coreimpl_{frog, runtime}.dart | 29 # ........coreimpl_{frog, runtime}.dart |
30 # ........{frog, runtime}/ | 30 # ........{frog, runtime}/ |
31 # ......dartdoc/ | |
31 # ......isolate/ | 32 # ......isolate/ |
32 # ........isolate_{frog, runtime}.dart | 33 # ........isolate_{frog, runtime}.dart |
33 # ........{frog, runtime}/ | 34 # ........{frog, runtime}/ |
34 # ......dom/ | 35 # ......dom/ |
35 # ........dom.dart | 36 # ........dom.dart |
36 # ......frog/ | 37 # ......frog/ |
37 # ......html/ | 38 # ......html/ |
38 # ........html.dart | 39 # ........html.dart |
39 # ......htmlimpl/ | 40 # ......htmlimpl/ |
40 # ........htmlimpl.dart | 41 # ........htmlimpl.dart |
41 # ......json/ | 42 # ......json/ |
42 # ........json_frog.dart | 43 # ........json_frog.dart |
43 #.........json.dart | 44 #.........json.dart |
44 # ........{frog}/ | 45 # ........{frog}/ |
45 # ......uri/ | 46 # ......uri/ |
46 # ........uri.dart | 47 # ........uri.dart |
47 # ......utf8/ | 48 # ......utf8/ |
48 # ........utf8.dart | 49 # ........utf8.dart |
49 # ......(more will come here) | 50 # ......(more will come here) |
50 # ....util/ | 51 # ....util/ |
51 # ......(more will come here) | 52 # ......(more will come here) |
52 | 53 |
53 | 54 |
54 | 55 |
55 import os | 56 import os |
56 import re | 57 import re |
57 import sys | 58 import sys |
58 import tempfile | 59 import tempfile |
59 import utils | 60 import utils |
60 | 61 |
61 from os.path import dirname, join, realpath, exists, isdir | 62 from os.path import dirname, join, realpath, exists, isdir |
62 from shutil import copyfile, copymode, copytree, ignore_patterns, rmtree, move | 63 from shutil import copyfile, copymode, copytree, ignore_patterns, rmtree, move |
63 | 64 |
65 def ReplaceInFile(path, subs): | |
66 '''Reads a file, applies a series of substitutions to it, and saves it back | |
67 out. subs should by a list of (pattern, replace) tuples.''' | |
68 contents = open(path).read() | |
69 for pattern, replace in subs: | |
70 contents = re.sub(pattern, replace, contents) | |
71 | |
72 dest = open(path, 'w') | |
73 dest.write(contents) | |
74 dest.close() | |
75 | |
64 def Main(argv): | 76 def Main(argv): |
65 # Pull in all of the gpyi files which will be munged into the sdk. | 77 # Pull in all of the gpyi files which will be munged into the sdk. |
66 builtin_runtime_sources = \ | 78 builtin_runtime_sources = \ |
67 (eval(open("runtime/bin/builtin_sources.gypi").read()))['sources'] | 79 (eval(open("runtime/bin/builtin_sources.gypi").read()))['sources'] |
68 io_runtime_sources = \ | 80 io_runtime_sources = \ |
69 (eval(open("runtime/bin/io_sources.gypi").read()))['sources'] | 81 (eval(open("runtime/bin/io_sources.gypi").read()))['sources'] |
70 corelib_sources = \ | 82 corelib_sources = \ |
71 (eval(open("corelib/src/corelib_sources.gypi").read()))['sources'] | 83 (eval(open("corelib/src/corelib_sources.gypi").read()))['sources'] |
72 corelib_frog_sources = \ | 84 corelib_frog_sources = \ |
73 (eval(open("frog/lib/frog_corelib_sources.gypi").read()))['sources'] | 85 (eval(open("frog/lib/frog_corelib_sources.gypi").read()))['sources'] |
(...skipping 24 matching lines...) Expand all Loading... | |
98 # Copy the Dart VM binary into sdk/bin. | 110 # Copy the Dart VM binary into sdk/bin. |
99 # TODO(dgrove) - deal with architectures that are not ia32. | 111 # TODO(dgrove) - deal with architectures that are not ia32. |
100 build_dir = os.path.dirname(argv[1]) | 112 build_dir = os.path.dirname(argv[1]) |
101 frogc_file_extension = '' | 113 frogc_file_extension = '' |
102 dart_file_extension = '' | 114 dart_file_extension = '' |
103 if utils.GuessOS() == 'win32': | 115 if utils.GuessOS() == 'win32': |
104 dart_file_extension = '.exe' | 116 dart_file_extension = '.exe' |
105 frogc_file_extension = '.bat' | 117 frogc_file_extension = '.bat' |
106 dart_src_binary = join(HOME, build_dir, 'dart' + dart_file_extension) | 118 dart_src_binary = join(HOME, build_dir, 'dart' + dart_file_extension) |
107 dart_dest_binary = join(BIN, 'dart' + dart_file_extension) | 119 dart_dest_binary = join(BIN, 'dart' + dart_file_extension) |
108 frogc_src_binary = join(HOME, 'frog', 'scripts', 'bootstrap', | 120 frogc_src_binary = join(HOME, 'frog', 'scripts', 'bootstrap', |
109 'frogc' + frogc_file_extension) | 121 'frogc' + frogc_file_extension) |
110 frogc_dest_binary = join(BIN, 'frogc' + frogc_file_extension) | 122 frogc_dest_binary = join(BIN, 'frogc' + frogc_file_extension) |
111 copyfile(dart_src_binary, dart_dest_binary) | 123 copyfile(dart_src_binary, dart_dest_binary) |
112 copymode(dart_src_binary, dart_dest_binary) | 124 copymode(dart_src_binary, dart_dest_binary) |
113 copyfile(frogc_src_binary, frogc_dest_binary) | 125 copyfile(frogc_src_binary, frogc_dest_binary) |
114 copymode(frogc_src_binary, frogc_dest_binary) | 126 copymode(frogc_src_binary, frogc_dest_binary) |
115 | 127 |
116 # Create sdk/bin/frogc.dart, and hack as needed. | 128 # Create sdk/bin/frogc.dart, and hack as needed. |
117 frog_src_dir = join(HOME, 'frog') | 129 frog_src_dir = join(HOME, 'frog') |
118 | 130 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
183 # Create and populate lib/frog. | 195 # Create and populate lib/frog. |
184 # | 196 # |
185 frog_dest_dir = join(LIB, 'frog') | 197 frog_dest_dir = join(LIB, 'frog') |
186 os.makedirs(frog_dest_dir) | 198 os.makedirs(frog_dest_dir) |
187 | 199 |
188 for filename in os.listdir(frog_src_dir): | 200 for filename in os.listdir(frog_src_dir): |
189 if filename == 'frog_options.dart': | 201 if filename == 'frog_options.dart': |
190 # change config from 'dev' to 'sdk' in frog_options.dart | 202 # change config from 'dev' to 'sdk' in frog_options.dart |
191 frog_options_contents = open(join(frog_src_dir, filename)).read() | 203 frog_options_contents = open(join(frog_src_dir, filename)).read() |
192 frog_options_dest = open(join(frog_dest_dir, filename), 'w') | 204 frog_options_dest = open(join(frog_dest_dir, filename), 'w') |
193 frog_options_dest.write(re.sub("final config = \'dev\';", | 205 frog_options_dest.write(re.sub("final config = \'dev\';", |
194 "final config = \'sdk\';", | 206 "final config = \'sdk\';", |
195 frog_options_contents)) | 207 frog_options_contents)) |
196 frog_options_dest.close() | 208 frog_options_dest.close() |
197 elif filename.endswith('.dart'): | 209 elif filename.endswith('.dart'): |
198 copyfile(join(frog_src_dir, filename), join(frog_dest_dir, filename)) | 210 copyfile(join(frog_src_dir, filename), join(frog_dest_dir, filename)) |
199 | 211 |
200 leg_dest_dir = join(frog_dest_dir, 'leg') | 212 leg_dest_dir = join(frog_dest_dir, 'leg') |
201 copytree(join(frog_src_dir, 'leg'), leg_dest_dir, | 213 copytree(join(frog_src_dir, 'leg'), leg_dest_dir, |
202 ignore=ignore_patterns('.svn')) | 214 ignore=ignore_patterns('.svn')) |
203 | 215 |
204 # Remap imports in frog/leg/* . | 216 # Remap imports in frog/leg/* . |
205 for filename in os.listdir(leg_dest_dir): | 217 for filename in os.listdir(leg_dest_dir): |
206 if filename.endswith('.dart'): | 218 if filename.endswith('.dart'): |
207 file_contents = open(join(leg_dest_dir, filename)).read() | 219 file_contents = open(join(leg_dest_dir, filename)).read() |
208 file = open(join(leg_dest_dir, filename), 'w') | 220 file = open(join(leg_dest_dir, filename), 'w') |
209 file.write(re.sub("../../lib", "../..", file_contents)) | 221 file.write(re.sub("../../lib", "../..", file_contents)) |
210 file.close() | 222 file.close() |
211 | 223 |
212 copytree(join(frog_src_dir, 'server'), join(frog_dest_dir, 'server'), | 224 copytree(join(frog_src_dir, 'server'), join(frog_dest_dir, 'server'), |
213 ignore=ignore_patterns('.svn')) | 225 ignore=ignore_patterns('.svn')) |
214 | 226 |
215 # Remap imports in frog/... . | 227 # Remap imports in frog/... . |
216 for (dirpath, subdirs, _) in os.walk(frog_dest_dir): | 228 for (dirpath, subdirs, _) in os.walk(frog_dest_dir): |
217 for subdir in subdirs: | 229 for subdir in subdirs: |
218 for filename in os.listdir(join(dirpath, subdir)): | 230 for filename in os.listdir(join(dirpath, subdir)): |
219 if filename.endswith('.dart'): | 231 if filename.endswith('.dart'): |
220 file_contents = open(join(dirpath, subdir, filename)).read() | 232 file_contents = open(join(dirpath, subdir, filename)).read() |
221 file = open(join(dirpath, subdir, filename), 'w') | 233 file = open(join(dirpath, subdir, filename), 'w') |
222 file.write(re.sub("../lib/", "../", file_contents)) | 234 file.write(re.sub("../lib/", "../", file_contents)) |
223 file.close() | 235 file.close() |
224 | 236 |
225 # | 237 # |
226 # Create and populate lib/html and lib/htmlimpl. | 238 # Create and populate lib/html and lib/htmlimpl. |
227 # | 239 # |
228 html_src_dir = join(HOME, 'client', 'html') | 240 html_src_dir = join(HOME, 'client', 'html') |
229 html_dest_dir = join(LIB, 'html') | 241 html_dest_dir = join(LIB, 'html') |
230 os.makedirs(html_dest_dir) | 242 os.makedirs(html_dest_dir) |
231 htmlimpl_dest_dir = join(LIB, 'htmlimpl') | 243 htmlimpl_dest_dir = join(LIB, 'htmlimpl') |
232 os.makedirs(htmlimpl_dest_dir) | 244 os.makedirs(htmlimpl_dest_dir) |
233 | 245 |
234 copyfile(join(html_src_dir, 'release', 'html.dart'), | 246 copyfile(join(html_src_dir, 'release', 'html.dart'), |
235 join(html_dest_dir, 'html.dart')) | 247 join(html_dest_dir, 'html.dart')) |
236 copyfile(join(html_src_dir, 'release', 'htmlimpl.dart'), | 248 copyfile(join(html_src_dir, 'release', 'htmlimpl.dart'), |
237 join(htmlimpl_dest_dir, 'htmlimpl.dart')) | 249 join(htmlimpl_dest_dir, 'htmlimpl.dart')) |
238 | 250 |
239 # TODO(dgrove): prune the correct files in html and htmlimpl. | 251 # TODO(dgrove): prune the correct files in html and htmlimpl. |
240 for target_dir in [html_dest_dir, htmlimpl_dest_dir]: | 252 for target_dir in [html_dest_dir, htmlimpl_dest_dir]: |
241 copytree(join(html_src_dir, 'src'), join(target_dir, 'src'), | 253 copytree(join(html_src_dir, 'src'), join(target_dir, 'src'), |
242 ignore=ignore_patterns('.svn')) | 254 ignore=ignore_patterns('.svn')) |
243 copytree(join(html_src_dir, 'generated'), join(target_dir, 'generated'), | 255 copytree(join(html_src_dir, 'generated'), join(target_dir, 'generated'), |
244 ignore=ignore_patterns('.svn')) | 256 ignore=ignore_patterns('.svn')) |
245 | 257 |
246 | 258 |
247 # | 259 # |
248 # Create and populate lib/dom. | 260 # Create and populate lib/dom. |
249 # | 261 # |
250 dom_src_dir = join(HOME, 'client', 'dom') | 262 dom_src_dir = join(HOME, 'client', 'dom') |
251 dom_dest_dir = join(LIB, 'dom') | 263 dom_dest_dir = join(LIB, 'dom') |
252 os.makedirs(dom_dest_dir) | 264 os.makedirs(dom_dest_dir) |
253 | 265 |
254 for filename in os.listdir(dom_src_dir): | 266 for filename in os.listdir(dom_src_dir): |
255 src_file = join(dom_src_dir, filename) | 267 src_file = join(dom_src_dir, filename) |
256 dest_file = join(dom_dest_dir, filename) | 268 dest_file = join(dom_dest_dir, filename) |
257 if filename.endswith('.dart') or filename.endswith('.js'): | 269 if filename.endswith('.dart') or filename.endswith('.js'): |
258 copyfile(src_file, dest_file) | 270 copyfile(src_file, dest_file) |
259 elif isdir(src_file): | 271 elif isdir(src_file): |
260 if filename not in ['benchmarks', 'idl', 'scripts', 'snippets', '.svn']: | 272 if filename not in ['benchmarks', 'idl', 'scripts', 'snippets', '.svn']: |
261 copytree(src_file, dest_file, | 273 copytree(src_file, dest_file, |
262 ignore=ignore_patterns('.svn', 'interface', 'wrapping', | 274 ignore=ignore_patterns('.svn', 'interface', 'wrapping', |
263 '*monkey*')) | 275 '*monkey*')) |
264 | 276 |
265 # | 277 # |
266 # Create and populate lib/{json, uri, utf8} . | 278 # Create and populate lib/{json, uri, utf8} . |
267 # | 279 # |
268 | 280 |
269 for library in ['json', 'uri', 'utf8']: | 281 for library in ['json', 'uri', 'utf8']: |
270 src_dir = join(HOME, 'lib', library) | 282 src_dir = join(HOME, 'lib', library) |
271 dest_dir = join(LIB, library) | 283 dest_dir = join(LIB, library) |
272 os.makedirs(dest_dir) | 284 os.makedirs(dest_dir) |
273 | 285 |
274 for filename in os.listdir(src_dir): | 286 for filename in os.listdir(src_dir): |
275 if filename.endswith('.dart'): | 287 if filename.endswith('.dart'): |
276 copyfile(join(src_dir, filename), join(dest_dir, filename)) | 288 copyfile(join(src_dir, filename), join(dest_dir, filename)) |
277 | 289 |
290 # Create and populate lib/dartdoc | |
291 dartdoc_src_dir = join(HOME, 'utils', 'dartdoc') | |
dgrove
2012/03/01 08:38:00
I think we should move dartdoc from utils/dartdoc
Bob Nystrom
2012/03/01 23:03:27
Should we move apidoc there too?
More important q
| |
292 dartdoc_dest_dir = join(LIB, 'dartdoc') | |
293 copytree(dartdoc_src_dir, dartdoc_dest_dir, | |
294 ignore=ignore_patterns('.svn', 'docs')) | |
295 ReplaceInFile(join(LIB, 'dartdoc', 'dartdoc'), [ | |
296 ("../../frog/minfrog", "../../bin/frogc"), | |
297 ("--libdir=../../frog/lib", "--libdir=../") | |
298 ]) | |
299 ReplaceInFile(join(LIB, 'dartdoc', 'dartdoc.dart'), [ | |
300 ("#import\('../../frog", "#import('../frog"), | |
301 ("'../../frog'", "'../frog'"), | |
302 ("'--libdir=../../frog/lib'", "'--libdir=../'") | |
303 ]) | |
304 ReplaceInFile(join(LIB, 'dartdoc', 'classify.dart'), [ | |
305 ("#import\('../../frog", "#import('../frog") | |
306 ]) | |
307 ReplaceInFile(join(LIB, 'dartdoc', 'client-live-nav.dart'), [ | |
308 ("#import\('../../frog", "#import('../frog") | |
309 ]) | |
310 ReplaceInFile(join(LIB, 'dartdoc', 'client-static.dart'), [ | |
311 ("#import\('../../frog", "#import('../frog") | |
dgrove
2012/03/01 08:38:00
it would be nice if ReplaceInFile were ReplaceInFi
| |
312 ]) | |
313 | |
278 # Create and populate lib/isolate | 314 # Create and populate lib/isolate |
279 copytree(join(HOME, 'lib', 'isolate'), join(LIB, 'isolate'), | 315 copytree(join(HOME, 'lib', 'isolate'), join(LIB, 'isolate'), |
280 ignore=ignore_patterns('.svn')) | 316 ignore=ignore_patterns('.svn')) |
281 | 317 |
282 # | 318 # |
283 # Create and populate lib/core. | 319 # Create and populate lib/core. |
284 # | 320 # |
285 | 321 |
286 # First, copy corelib/* to lib/{frog, runtime} | 322 # First, copy corelib/* to lib/{frog, runtime} |
287 for filename in corelib_sources: | 323 for filename in corelib_sources: |
288 for target_dir in ['frog', 'runtime']: | 324 for target_dir in ['frog', 'runtime']: |
289 copyfile(join('corelib', 'src', filename), | 325 copyfile(join('corelib', 'src', filename), |
290 join(corelib_dest_dir, target_dir, filename)) | 326 join(corelib_dest_dir, target_dir, filename)) |
291 | 327 |
292 # Next, copy the frog library source on top of core/frog | 328 # Next, copy the frog library source on top of core/frog |
293 # TOOD(dgrove): move json to top-level | 329 # TOOD(dgrove): move json to top-level |
294 for filename in corelib_frog_sources: | 330 for filename in corelib_frog_sources: |
295 copyfile(join('frog', 'lib', filename), | 331 copyfile(join('frog', 'lib', filename), |
296 join(corelib_dest_dir, 'frog', filename)) | 332 join(corelib_dest_dir, 'frog', filename)) |
297 | 333 |
298 # Next, copy the runtime library source on top of core/runtime | 334 # Next, copy the runtime library source on top of core/runtime |
299 for filename in corelib_runtime_sources: | 335 for filename in corelib_runtime_sources: |
300 if filename.endswith('.dart'): | 336 if filename.endswith('.dart'): |
301 copyfile(join('runtime', 'lib', filename), | 337 copyfile(join('runtime', 'lib', filename), |
302 join(corelib_dest_dir, 'runtime', filename)) | 338 join(corelib_dest_dir, 'runtime', filename)) |
303 | 339 |
304 # | 340 # |
305 # At this point, it's time to create lib/core/core*dart . | 341 # At this point, it's time to create lib/core/core*dart . |
306 # | 342 # |
307 # munge frog/lib/corelib.dart into lib/core_frog.dart . | 343 # munge frog/lib/corelib.dart into lib/core_frog.dart . |
308 src_file = join('frog', 'lib', 'corelib.dart') | 344 src_file = join('frog', 'lib', 'corelib.dart') |
309 dest_file = open(join(corelib_dest_dir, 'core_frog.dart'), 'w') | 345 dest_file = open(join(corelib_dest_dir, 'core_frog.dart'), 'w') |
310 contents = open(src_file).read() | 346 contents = open(src_file).read() |
311 contents = re.sub('source\(\"../../corelib/src/', 'source(\"', contents) | 347 contents = re.sub('source\(\"../../corelib/src/', 'source(\"', contents) |
312 contents = re.sub("source\(\"", "source(\"frog/", contents) | 348 contents = re.sub("source\(\"", "source(\"frog/", contents) |
313 dest_file.write(contents) | 349 dest_file.write(contents) |
(...skipping 10 matching lines...) Expand all Loading... | |
324 dest_file.write('#source("runtime/' + filename + '");\n') | 360 dest_file.write('#source("runtime/' + filename + '");\n') |
325 dest_file.close() | 361 dest_file.close() |
326 | 362 |
327 # | 363 # |
328 # Create and populate lib/coreimpl. | 364 # Create and populate lib/coreimpl. |
329 # | 365 # |
330 | 366 |
331 # First, copy corelib/src/implementation to corelib/{frog, runtime}. | 367 # First, copy corelib/src/implementation to corelib/{frog, runtime}. |
332 for filename in coreimpl_sources: | 368 for filename in coreimpl_sources: |
333 for target_dir in ['frog', 'runtime']: | 369 for target_dir in ['frog', 'runtime']: |
334 copyfile(join('corelib', 'src', 'implementation', filename), | 370 copyfile(join('corelib', 'src', 'implementation', filename), |
335 join(coreimpl_dest_dir, target_dir, filename)) | 371 join(coreimpl_dest_dir, target_dir, filename)) |
336 | 372 |
337 for filename in coreimpl_frog_sources: | 373 for filename in coreimpl_frog_sources: |
338 copyfile(join('frog', 'lib', filename), | 374 copyfile(join('frog', 'lib', filename), |
339 join(coreimpl_dest_dir, 'frog', filename)) | 375 join(coreimpl_dest_dir, 'frog', filename)) |
340 | 376 |
341 for filename in coreimpl_runtime_sources: | 377 for filename in coreimpl_runtime_sources: |
342 if filename.endswith('.dart'): | 378 if filename.endswith('.dart'): |
343 copyfile(join('runtime', 'lib', filename), | 379 copyfile(join('runtime', 'lib', filename), |
344 join(coreimpl_dest_dir, 'runtime', filename)) | 380 join(coreimpl_dest_dir, 'runtime', filename)) |
345 | 381 |
346 | 382 |
347 # Create and fix up lib/coreimpl/coreimpl_frog.dart . | 383 # Create and fix up lib/coreimpl/coreimpl_frog.dart . |
348 src_file = join('frog', 'lib', 'corelib_impl.dart') | 384 src_file = join('frog', 'lib', 'corelib_impl.dart') |
349 dest_file = open(join(coreimpl_dest_dir, 'coreimpl_frog.dart'), 'w') | 385 dest_file = open(join(coreimpl_dest_dir, 'coreimpl_frog.dart'), 'w') |
350 contents = open(src_file).read() | 386 contents = open(src_file).read() |
351 contents = re.sub('source\(\"../../corelib/src/implementation/', | 387 contents = re.sub('source\(\"../../corelib/src/implementation/', |
352 'source(\"', contents) | 388 'source(\"', contents) |
353 contents = re.sub('source\(\"', 'source(\"frog/', contents) | 389 contents = re.sub('source\(\"', 'source(\"frog/', contents) |
354 dest_file.write(contents) | 390 dest_file.write(contents) |
355 dest_file.close() | 391 dest_file.close() |
356 | 392 |
357 # Construct lib/coreimpl/coreimpl_runtime.dart from whole cloth. | 393 # Construct lib/coreimpl/coreimpl_runtime.dart from whole cloth. |
358 dest_file = open(join(coreimpl_dest_dir, 'coreimpl_runtime.dart'), 'w') | 394 dest_file = open(join(coreimpl_dest_dir, 'coreimpl_runtime.dart'), 'w') |
359 dest_file.write('#library("dart:coreimpl");\n') | 395 dest_file.write('#library("dart:coreimpl");\n') |
360 for filename in coreimpl_sources: | 396 for filename in coreimpl_sources: |
361 dest_file.write('#source("runtime/' + filename + '");\n') | 397 dest_file.write('#source("runtime/' + filename + '");\n') |
362 for filename in coreimpl_runtime_sources: | 398 for filename in coreimpl_runtime_sources: |
363 if filename.endswith('.dart'): | 399 if filename.endswith('.dart'): |
364 dest_file.write('#source("runtime/' + filename + '");\n') | 400 dest_file.write('#source("runtime/' + filename + '");\n') |
365 dest_file.close() | 401 dest_file.close() |
366 | 402 |
367 # Create and copy tools. | 403 # Create and copy tools. |
368 | 404 |
369 UTIL = join(SDK_tmp, 'util') | 405 UTIL = join(SDK_tmp, 'util') |
370 os.makedirs(UTIL) | 406 os.makedirs(UTIL) |
371 | 407 |
372 move(SDK_tmp, SDK) | 408 move(SDK_tmp, SDK) |
373 | 409 |
374 if __name__ == '__main__': | 410 if __name__ == '__main__': |
375 sys.exit(Main(sys.argv)) | 411 sys.exit(Main(sys.argv)) |
OLD | NEW |