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

Side by Side Diff: tools/create_sdk.py

Issue 10269025: Update SDK with VM native extension development files. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 months 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. 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 # ......dart.lib (import library for VM native extensions on Windows)
17 # ......frogc.dart 18 # ......frogc.dart
19 # ....include/
20 # ......dart_api.h
21 # ......dart_debugger_api.h
18 # ....lib/ 22 # ....lib/
19 # ......builtin/ 23 # ......builtin/
20 # ........builtin_runtime.dart 24 # ........builtin_runtime.dart
21 # ......io/ 25 # ......io/
22 # ........io_runtime.dart 26 # ........io_runtime.dart
23 # ........runtime/ 27 # ........runtime/
24 # ......core/ 28 # ......core/
25 # ........core_{frog, runtime}.dart 29 # ........core_{frog, runtime}.dart
26 # ........{frog, runtime}/ 30 # ........{frog, runtime}/
27 # ......coreimpl/ 31 # ......coreimpl/
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 105
102 # TODO(dgrove) - deal with architectures that are not ia32. 106 # TODO(dgrove) - deal with architectures that are not ia32.
103 107
104 if exists(SDK): 108 if exists(SDK):
105 rmtree(SDK) 109 rmtree(SDK)
106 110
107 # Create and populate sdk/bin. 111 # Create and populate sdk/bin.
108 BIN = join(SDK_tmp, 'bin') 112 BIN = join(SDK_tmp, 'bin')
109 os.makedirs(BIN) 113 os.makedirs(BIN)
110 114
111 # Copy the Dart VM binary into sdk/bin. 115 # Copy the Dart VM binary, frogc and Windows dart VM link library
116 # into sdk/bin.
117 #
112 # TODO(dgrove) - deal with architectures that are not ia32. 118 # TODO(dgrove) - deal with architectures that are not ia32.
113 build_dir = os.path.dirname(argv[1]) 119 build_dir = os.path.dirname(argv[1])
114 frogc_file_extension = '' 120 frogc_file_extension = ''
115 dart_file_extension = '' 121 dart_file_extension = ''
116 if utils.GuessOS() == 'win32': 122 if utils.GuessOS() == 'win32':
117 dart_file_extension = '.exe' 123 dart_file_extension = '.exe'
118 frogc_file_extension = '.bat' 124 frogc_file_extension = '.bat'
125 dart_import_lib_src = join(HOME, build_dir, 'dart.lib')
126 dart_import_lib_dest = join(BIN, 'dart.lib')
127 copyfile(dart_import_lib_src, dart_import_lib_dest)
119 dart_src_binary = join(HOME, build_dir, 'dart' + dart_file_extension) 128 dart_src_binary = join(HOME, build_dir, 'dart' + dart_file_extension)
120 dart_dest_binary = join(BIN, 'dart' + dart_file_extension) 129 dart_dest_binary = join(BIN, 'dart' + dart_file_extension)
121 frogc_src_binary = join(HOME, 'frog', 'scripts', 'bootstrap', 130 frogc_src_binary = join(HOME, 'frog', 'scripts', 'bootstrap',
122 'frogc' + frogc_file_extension) 131 'frogc' + frogc_file_extension)
123 frogc_dest_binary = join(BIN, 'frogc' + frogc_file_extension) 132 frogc_dest_binary = join(BIN, 'frogc' + frogc_file_extension)
124 copyfile(dart_src_binary, dart_dest_binary) 133 copyfile(dart_src_binary, dart_dest_binary)
125 copymode(dart_src_binary, dart_dest_binary) 134 copymode(dart_src_binary, dart_dest_binary)
126 copyfile(frogc_src_binary, frogc_dest_binary) 135 copyfile(frogc_src_binary, frogc_dest_binary)
127 copymode(frogc_src_binary, frogc_dest_binary) 136 copymode(frogc_src_binary, frogc_dest_binary)
128 137
129 # Create sdk/bin/frogc.dart, and hack as needed. 138 # Create sdk/bin/frogc.dart, and hack as needed.
130 frog_src_dir = join(HOME, 'frog') 139 frog_src_dir = join(HOME, 'frog')
131 140
132 # Convert frogc.dart's imports from import('*') -> import('frog/*'). 141 # Convert frogc.dart's imports from import('*') -> import('frog/*').
133 frogc_contents = open(join(frog_src_dir, 'frogc.dart')).read() 142 frogc_contents = open(join(frog_src_dir, 'frogc.dart')).read()
134 frogc_dest = open(join(BIN, 'frogc.dart'), 'w') 143 frogc_dest = open(join(BIN, 'frogc.dart'), 'w')
135 frogc_dest.write( 144 frogc_dest.write(
136 re.sub(r"#import\('([^.])", r"#import('../lib/frog/\1", frogc_contents)) 145 re.sub(r"#import\('([^.])", r"#import('../lib/frog/\1", frogc_contents))
137 frogc_dest.close() 146 frogc_dest.close()
138 147
139 # TODO(dgrove): copy and fix up frog.dart, minfrogc.dart. 148 # TODO(dgrove): copy and fix up frog.dart, minfrogc.dart.
140 149
141 # 150 #
151 # Create and populate sdk/include.
152 #
153 INCLUDE = join(SDK_tmp, 'include')
154 os.makedirs(INCLUDE)
155 copyfile(join(HOME, 'runtime', 'include', 'dart_api.h'),
156 join(INCLUDE, 'dart_api.h'))
157 copyfile(join(HOME, 'runtime', 'include', 'dart_debugger_api.h'),
158 join(INCLUDE, 'dart_debugger_api.h'))
159
160 #
142 # Create and populate sdk/lib. 161 # Create and populate sdk/lib.
143 # 162 #
144 163
145 LIB = join(SDK_tmp, 'lib') 164 LIB = join(SDK_tmp, 'lib')
146 os.makedirs(LIB) 165 os.makedirs(LIB)
147 corelib_dest_dir = join(LIB, 'core') 166 corelib_dest_dir = join(LIB, 'core')
148 os.makedirs(corelib_dest_dir) 167 os.makedirs(corelib_dest_dir)
149 os.makedirs(join(corelib_dest_dir, 'frog')) 168 os.makedirs(join(corelib_dest_dir, 'frog'))
150 os.makedirs(join(corelib_dest_dir, 'runtime')) 169 os.makedirs(join(corelib_dest_dir, 'runtime'))
151 170
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 if revision is not None: 448 if revision is not None:
430 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: 449 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f:
431 f.write(revision + '\n') 450 f.write(revision + '\n')
432 f.close() 451 f.close()
433 452
434 move(SDK_tmp, SDK) 453 move(SDK_tmp, SDK)
435 utils.Touch(os.path.join(SDK, 'create.stamp')) 454 utils.Touch(os.path.join(SDK, 'create.stamp'))
436 455
437 if __name__ == '__main__': 456 if __name__ == '__main__':
438 sys.exit(Main(sys.argv)) 457 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