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

Side by Side Diff: tools/create_sdk.py

Issue 8786009: Move JSON to its own lib directory in sdk. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years 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 | « frog/reader.dart ('k') | 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) 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 # ......core/ 16 # ......core/
17 # ........core_{compiler, frog, runtime}.dart 17 # ........core_{compiler, frog, runtime}.dart
18 # ........{compiler, frog, runtime}/ 18 # ........{compiler, frog, runtime}/
19 # ......coreimpl/ 19 # ......coreimpl/
20 # ........coreimpl_{compiler, frog, runtime}.dart 20 # ........coreimpl_{compiler, frog, runtime}.dart
21 # ........{compiler, frog, runtime}/ 21 # ........{compiler, frog, runtime}/
22 # ......dom/ 22 # ......dom/
23 # ........dom.dart 23 # ........dom.dart
24 # ......frog/ 24 # ......frog/
25 # ......html/ 25 # ......html/
26 # ........html.dart 26 # ........html.dart
27 # ......htmlimpl/ 27 # ......htmlimpl/
28 # ........htmlimpl.dart 28 # ........htmlimpl.dart
29 # ......json/
30 # ........json_{compiler, frog}.dart
31 # ........{compiler, frog}/
29 # ......(more will come here - io, etc) 32 # ......(more will come here - io, etc)
30 # ....tools/ 33 # ....tools/
31 # ......dartdoc/ 34 # ......dartdoc/
32 # ......(more will come here) 35 # ......(more will come here)
33 36
34 37
35 38
36 import os 39 import os
37 import re 40 import re
38 import sys 41 import sys
(...skipping 13 matching lines...) Expand all
52 corelib_compiler_sources = \ 55 corelib_compiler_sources = \
53 (eval(open("compiler/compiler_corelib_sources.gypi").read())) \ 56 (eval(open("compiler/compiler_corelib_sources.gypi").read())) \
54 ['variables']['compiler_corelib_resources'] 57 ['variables']['compiler_corelib_resources']
55 coreimpl_sources = \ 58 coreimpl_sources = \
56 (eval(open("corelib/src/implementation/corelib_impl_sources.gypi").read()))\ 59 (eval(open("corelib/src/implementation/corelib_impl_sources.gypi").read()))\
57 ['sources'] 60 ['sources']
58 coreimpl_frog_sources = \ 61 coreimpl_frog_sources = \
59 (eval(open("frog/lib/frog_coreimpl_sources.gypi").read()))['sources'] 62 (eval(open("frog/lib/frog_coreimpl_sources.gypi").read()))['sources']
60 coreimpl_runtime_sources = \ 63 coreimpl_runtime_sources = \
61 (eval(open("runtime/lib/lib_impl_sources.gypi").read()))['sources'] 64 (eval(open("runtime/lib/lib_impl_sources.gypi").read()))['sources']
65 json_compiler_sources = \
66 (eval(open("compiler/jsonlib_sources.gypi").read())) \
67 ['variables']['jsonlib_resources']
68 json_frog_sources = \
69 (eval(open("frog/lib/frog_json_sources.gypi").read()))['sources']
62 70
63 HOME = dirname(dirname(realpath(__file__))) 71 HOME = dirname(dirname(realpath(__file__)))
64 72
65 SDK = argv[1] 73 SDK = argv[1]
66 if exists(SDK): 74 if exists(SDK):
67 rmtree(SDK) 75 rmtree(SDK)
68 76
69 # Create and populate sdk/bin. 77 # Create and populate sdk/bin.
70 BIN = join(SDK, 'bin') 78 BIN = join(SDK, 'bin')
71 os.makedirs(BIN) 79 os.makedirs(BIN)
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 copyfile(join(html_src_dir, 'release', 'htmlimpl.dart'), 157 copyfile(join(html_src_dir, 'release', 'htmlimpl.dart'),
150 join(htmlimpl_dest_dir, 'htmlimpl.dart')) 158 join(htmlimpl_dest_dir, 'htmlimpl.dart'))
151 159
152 # TODO(dgrove): prune the correct files in html and htmlimpl. 160 # TODO(dgrove): prune the correct files in html and htmlimpl.
153 for target_dir in [html_dest_dir, htmlimpl_dest_dir]: 161 for target_dir in [html_dest_dir, htmlimpl_dest_dir]:
154 copytree(join(html_src_dir, 'src'), join(target_dir, 'src'), 162 copytree(join(html_src_dir, 'src'), join(target_dir, 'src'),
155 ignore=ignore_patterns('.svn')) 163 ignore=ignore_patterns('.svn'))
156 copytree(join(html_src_dir, 'generated'), join(target_dir, 'generated'), 164 copytree(join(html_src_dir, 'generated'), join(target_dir, 'generated'),
157 ignore=ignore_patterns('.svn')) 165 ignore=ignore_patterns('.svn'))
158 166
167
168 #
169 # Create and populate lib/json.
170 #
171
172 json_frog_dest_dir = join(LIB, 'json', 'frog')
173 json_compiler_dest_dir = join(LIB, 'json', 'compiler')
174 os.makedirs(json_frog_dest_dir)
175 os.makedirs(json_compiler_dest_dir)
176
177 for filename in json_frog_sources:
178 copyfile(join(HOME, 'frog', 'lib', filename),
179 join(json_frog_dest_dir, filename))
180
181 for filename in json_compiler_sources:
182 copyfile(join(HOME, 'compiler', filename),
183 join(json_compiler_dest_dir, os.path.basename(filename)))
184
185 # Create json_compiler.dart and json_frog.dart from whole cloth.
186 dest_file = open(join(LIB, 'json', 'json_compiler.dart'), 'w')
187 dest_file.write('#library("dart:json");\n')
188 dest_file.write('#import("compiler/json.dart");\n')
189 dest_file.close()
190 dest_file = open(join(LIB, 'json', 'json_frog.dart'), 'w')
191 dest_file.write('#library("dart:json");\n')
192 dest_file.write('#import("frog/json.dart");\n')
193 dest_file.close()
194
159 # 195 #
160 # Create and populate lib/dom. 196 # Create and populate lib/dom.
161 # 197 #
162 dom_src_dir = join(HOME, 'client', 'dom') 198 dom_src_dir = join(HOME, 'client', 'dom')
163 dom_dest_dir = join(LIB, 'dom') 199 dom_dest_dir = join(LIB, 'dom')
164 os.makedirs(dom_dest_dir) 200 os.makedirs(dom_dest_dir)
165 201
166 for filename in os.listdir(dom_src_dir): 202 for filename in os.listdir(dom_src_dir):
167 src_file = join(dom_src_dir, filename) 203 src_file = join(dom_src_dir, filename)
168 dest_file = join(dom_dest_dir, filename) 204 dest_file = join(dom_dest_dir, filename)
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 # Create and copy tools. 318 # Create and copy tools.
283 319
284 UTIL = join(SDK, 'tools') 320 UTIL = join(SDK, 'tools')
285 os.makedirs(UTIL) 321 os.makedirs(UTIL)
286 322
287 copytree(join(HOME, 'utils', 'dartdoc'), join(UTIL, 'dartdoc'), 323 copytree(join(HOME, 'utils', 'dartdoc'), join(UTIL, 'dartdoc'),
288 ignore=ignore_patterns('.svn')) 324 ignore=ignore_patterns('.svn'))
289 325
290 if __name__ == '__main__': 326 if __name__ == '__main__':
291 sys.exit(Main(sys.argv)) 327 sys.exit(Main(sys.argv))
OLDNEW
« no previous file with comments | « frog/reader.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698