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

Side by Side Diff: tools/create_sdk.py

Issue 8784007: Skip building SDK in Debug mode. (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 | « 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) 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/
(...skipping 27 matching lines...) Expand all
38 38
39 import os 39 import os
40 import re 40 import re
41 import sys 41 import sys
42 import utils 42 import utils
43 43
44 from os.path import dirname, join, realpath, exists, isdir 44 from os.path import dirname, join, realpath, exists, isdir
45 from shutil import copyfile, copymode, copytree, ignore_patterns, rmtree 45 from shutil import copyfile, copymode, copytree, ignore_patterns, rmtree
46 46
47 def Main(argv): 47 def Main(argv):
48 # Pull in all of the gpyi files which will be munged into the sdk. 48 # Pull in all of the gpyi files which will be munged into the sdk.
49 corelib_sources = \ 49 corelib_sources = \
50 (eval(open("corelib/src/corelib_sources.gypi").read()))['sources'] 50 (eval(open("corelib/src/corelib_sources.gypi").read()))['sources']
51 corelib_frog_sources = \ 51 corelib_frog_sources = \
52 (eval(open("frog/lib/frog_corelib_sources.gypi").read()))['sources'] 52 (eval(open("frog/lib/frog_corelib_sources.gypi").read()))['sources']
53 corelib_runtime_sources = \ 53 corelib_runtime_sources = \
54 (eval(open("runtime/lib/lib_sources.gypi").read()))['sources'] 54 (eval(open("runtime/lib/lib_sources.gypi").read()))['sources']
55 corelib_compiler_sources = \ 55 corelib_compiler_sources = \
56 (eval(open("compiler/compiler_corelib_sources.gypi").read())) \ 56 (eval(open("compiler/compiler_corelib_sources.gypi").read())) \
57 ['variables']['compiler_corelib_resources'] 57 ['variables']['compiler_corelib_resources']
58 coreimpl_sources = \ 58 coreimpl_sources = \
59 (eval(open("corelib/src/implementation/corelib_impl_sources.gypi").read()))\ 59 (eval(open("corelib/src/implementation/corelib_impl_sources.gypi").read()))\
60 ['sources'] 60 ['sources']
61 coreimpl_frog_sources = \ 61 coreimpl_frog_sources = \
62 (eval(open("frog/lib/frog_coreimpl_sources.gypi").read()))['sources'] 62 (eval(open("frog/lib/frog_coreimpl_sources.gypi").read()))['sources']
63 coreimpl_runtime_sources = \ 63 coreimpl_runtime_sources = \
64 (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 = \ 65 json_compiler_sources = \
66 (eval(open("compiler/jsonlib_sources.gypi").read())) \ 66 (eval(open("compiler/jsonlib_sources.gypi").read())) \
67 ['variables']['jsonlib_resources'] 67 ['variables']['jsonlib_resources']
68 json_frog_sources = \ 68 json_frog_sources = \
69 (eval(open("frog/lib/frog_json_sources.gypi").read()))['sources'] 69 (eval(open("frog/lib/frog_json_sources.gypi").read()))['sources']
70 70
71 HOME = dirname(dirname(realpath(__file__))) 71 HOME = dirname(dirname(realpath(__file__)))
72 72
73 SDK = argv[1] 73 SDK = argv[1]
74
75 # TODO(dgrove) - deal with architectures that are not ia32.
76 if (os.path.basename(os.path.dirname(SDK)) !=
77 utils.GetBuildConf('release', 'ia32')):
78 print "SDK is not built in Debug mode."
79 exit(0)
80
74 if exists(SDK): 81 if exists(SDK):
75 rmtree(SDK) 82 rmtree(SDK)
76 83
77 # Create and populate sdk/bin. 84 # Create and populate sdk/bin.
78 BIN = join(SDK, 'bin') 85 BIN = join(SDK, 'bin')
79 os.makedirs(BIN) 86 os.makedirs(BIN)
80 87
81 # Copy the Dart VM binary into sdk/bin. 88 # Copy the Dart VM binary into sdk/bin.
82 # TODO(dgrove) - deal with architectures that are not ia32 89 # TODO(dgrove) - deal with architectures that are not ia32.
83 build_dir = utils.GetBuildRoot(utils.GuessOS(), 'release', 'ia32') 90 build_dir = utils.GetBuildRoot(utils.GuessOS(), 'release', 'ia32')
84 if utils.GuessOS() == 'win32': 91 if utils.GuessOS() == 'win32':
85 dart_src_binary = join(join(HOME, build_dir), 'dart.exe') 92 dart_src_binary = join(join(HOME, build_dir), 'dart.exe')
86 dart_dest_binary = join(BIN, 'dart.exe') 93 dart_dest_binary = join(BIN, 'dart.exe')
87 else: 94 else:
88 dart_src_binary = join(join(HOME, build_dir), 'dart') 95 dart_src_binary = join(join(HOME, build_dir), 'dart')
89 dart_dest_binary = join(BIN, 'dart') 96 dart_dest_binary = join(BIN, 'dart')
90 copyfile(dart_src_binary, dart_dest_binary) 97 copyfile(dart_src_binary, dart_dest_binary)
91 copymode(dart_src_binary, dart_dest_binary) 98 copymode(dart_src_binary, dart_dest_binary)
92 99
93 # Create sdk/bin/frogc.dart, and hack as needed. 100 # Create sdk/bin/frogc.dart, and hack as needed.
94 frog_src_dir = join(HOME, 'frog') 101 frog_src_dir = join(HOME, 'frog')
95 102
96 # Convert frogc.dart's imports from import('*') -> import('frog/*'). 103 # Convert frogc.dart's imports from import('*') -> import('frog/*').
97 frogc_contents = open(join(frog_src_dir, 'frogc.dart')).read() 104 frogc_contents = open(join(frog_src_dir, 'frogc.dart')).read()
98 frogc_dest = open(join(BIN, 'frogc.dart'), 'w') 105 frogc_dest = open(join(BIN, 'frogc.dart'), 'w')
99 frogc_dest.write( 106 frogc_dest.write(
100 re.sub("#import\('", "#import('../lib/frog/", frogc_contents)) 107 re.sub("#import\('", "#import('../lib/frog/", frogc_contents))
101 frogc_dest.close() 108 frogc_dest.close()
102 109
103 # TODO(dgrove): copy and fix up frog.dart, minfrogc.dart 110 # TODO(dgrove): copy and fix up frog.dart, minfrogc.dart.
104 111
105 # 112 #
106 # Create and populate sdk/lib. 113 # Create and populate sdk/lib.
107 # 114 #
108 115
109 LIB = join(SDK, 'lib') 116 LIB = join(SDK, 'lib')
110 os.makedirs(LIB) 117 os.makedirs(LIB)
111 corelib_dest_dir = join(LIB, 'core') 118 corelib_dest_dir = join(LIB, 'core')
112 os.makedirs(corelib_dest_dir) 119 os.makedirs(corelib_dest_dir)
113 os.makedirs(join(corelib_dest_dir, 'compiler')) 120 os.makedirs(join(corelib_dest_dir, 'compiler'))
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 dest_file = open(join(corelib_dest_dir, 'core_runtime.dart'), 'w') 263 dest_file = open(join(corelib_dest_dir, 'core_runtime.dart'), 'w')
257 dest_file.write('#library("dart:core");\n') 264 dest_file.write('#library("dart:core");\n')
258 dest_file.write('#import("dart:coreimpl");\n') 265 dest_file.write('#import("dart:coreimpl");\n')
259 for filename in corelib_sources: 266 for filename in corelib_sources:
260 dest_file.write('#source("runtime/' + filename + '");\n') 267 dest_file.write('#source("runtime/' + filename + '");\n')
261 for filename in corelib_runtime_sources: 268 for filename in corelib_runtime_sources:
262 if filename.endswith('.dart'): 269 if filename.endswith('.dart'):
263 dest_file.write('#source("runtime/' + filename + '");\n') 270 dest_file.write('#source("runtime/' + filename + '");\n')
264 dest_file.close() 271 dest_file.close()
265 272
266 # TODO(dgrove) - create lib/core/core_compiler.dart 273 # TODO(dgrove) - create lib/core/core_compiler.dart .
267 274
268 # 275 #
269 # Create and populate lib/coreimpl 276 # Create and populate lib/coreimpl.
270 # 277 #
271 278
272 # First, copy corelib/src/implementation to corelib/{compiler, frog, runtime}. 279 # First, copy corelib/src/implementation to corelib/{compiler, frog, runtime}.
273 for filename in coreimpl_sources: 280 for filename in coreimpl_sources:
274 for target_dir in ['compiler', 'frog', 'runtime']: 281 for target_dir in ['compiler', 'frog', 'runtime']:
275 copyfile(join('corelib', 'src', 'implementation', filename), 282 copyfile(join('corelib', 'src', 'implementation', filename),
276 join(coreimpl_dest_dir, target_dir, filename)) 283 join(coreimpl_dest_dir, target_dir, filename))
277 284
278 # Next, copy {compiler, frog, runtime}-specific implementations. 285 # Next, copy {compiler, frog, runtime}-specific implementations.
279 for filename in corelib_compiler_sources: 286 for filename in corelib_compiler_sources:
(...skipping 26 matching lines...) Expand all
306 # Construct lib/coreimpl/coreimpl_runtime.dart from whole cloth. 313 # Construct lib/coreimpl/coreimpl_runtime.dart from whole cloth.
307 dest_file = open(join(coreimpl_dest_dir, 'coreimpl_runtime.dart'), 'w') 314 dest_file = open(join(coreimpl_dest_dir, 'coreimpl_runtime.dart'), 'w')
308 dest_file.write('#library("dart:coreimpl");\n') 315 dest_file.write('#library("dart:coreimpl");\n')
309 for filename in coreimpl_sources: 316 for filename in coreimpl_sources:
310 dest_file.write('#source("runtime/' + filename + '");\n') 317 dest_file.write('#source("runtime/' + filename + '");\n')
311 for filename in coreimpl_runtime_sources: 318 for filename in coreimpl_runtime_sources:
312 if filename.endswith('.dart'): 319 if filename.endswith('.dart'):
313 dest_file.write('#source("runtime/' + filename + '");\n') 320 dest_file.write('#source("runtime/' + filename + '");\n')
314 dest_file.close() 321 dest_file.close()
315 322
316 # TODO(dgrove) - create lib/coreimpl/coreimpl_compiler.dart 323 # TODO(dgrove) - create lib/coreimpl/coreimpl_compiler.dart .
317 324
318 # Create and copy tools. 325 # Create and copy tools.
319 326
320 UTIL = join(SDK, 'tools') 327 UTIL = join(SDK, 'tools')
321 os.makedirs(UTIL) 328 os.makedirs(UTIL)
322 329
323 copytree(join(HOME, 'utils', 'dartdoc'), join(UTIL, 'dartdoc'), 330 copytree(join(HOME, 'utils', 'dartdoc'), join(UTIL, 'dartdoc'),
324 ignore=ignore_patterns('.svn')) 331 ignore=ignore_patterns('.svn'))
325 332
326 if __name__ == '__main__': 333 if __name__ == '__main__':
327 sys.exit(Main(sys.argv)) 334 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