OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2012, 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 # |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 file_extension = '' | 98 file_extension = '' |
99 if HOST_OS == 'win32': | 99 if HOST_OS == 'win32': |
100 file_extension = '.bat' | 100 file_extension = '.bat' |
101 | 101 |
102 src = src_file + file_extension | 102 src = src_file + file_extension |
103 dest = join(dest_dir, basename(src_file) + file_extension) | 103 dest = join(dest_dir, basename(src_file) + file_extension) |
104 Copy(src, dest) | 104 Copy(src, dest) |
105 | 105 |
106 | 106 |
107 def CopyDartScripts(home, sdk_root): | 107 def CopyDartScripts(home, sdk_root): |
108 for executable in ['dart2js', 'dartanalyzer', 'dartdoc', 'docgen', 'pub']: | 108 for executable in ['dart2js', 'dartanalyzer', 'docgen', 'pub']: |
109 CopyShellScript(os.path.join(home, 'sdk', 'bin', executable), | 109 CopyShellScript(os.path.join(home, 'sdk', 'bin', executable), |
110 os.path.join(sdk_root, 'bin')) | 110 os.path.join(sdk_root, 'bin')) |
111 | 111 |
112 | 112 |
113 def CopySnapshots(snapshots, sdk_root): | 113 def CopySnapshots(snapshots, sdk_root): |
114 for snapshot in ['dart2js', 'utils_wrapper', 'pub']: | 114 for snapshot in ['dart2js', 'utils_wrapper', 'pub']: |
115 snapshot += '.dart.snapshot' | 115 snapshot += '.dart.snapshot' |
116 copyfile(join(snapshots, snapshot), | 116 copyfile(join(snapshots, snapshot), |
117 join(sdk_root, 'bin', 'snapshots', snapshot)) | 117 join(sdk_root, 'bin', 'snapshots', snapshot)) |
118 | 118 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 os.makedirs(LIB) | 187 os.makedirs(LIB) |
188 | 188 |
189 # | 189 # |
190 # Create and populate lib/{core, crypto, isolate, ...}. | 190 # Create and populate lib/{core, crypto, isolate, ...}. |
191 # | 191 # |
192 | 192 |
193 os.makedirs(join(LIB, 'html')) | 193 os.makedirs(join(LIB, 'html')) |
194 | 194 |
195 for library in [join('_chrome', 'dart2js'), join('_chrome', 'dartium'), | 195 for library in [join('_chrome', 'dart2js'), join('_chrome', 'dartium'), |
196 join('_internal', 'compiler'), | 196 join('_internal', 'compiler'), |
197 join('_internal', 'dartdoc'), | |
198 join('_internal', 'lib'), | 197 join('_internal', 'lib'), |
199 'async', 'collection', 'convert', 'core', | 198 'async', 'collection', 'convert', 'core', |
200 'crypto', 'internal', 'io', 'isolate', | 199 'crypto', 'internal', 'io', 'isolate', |
201 join('html', 'dart2js'), join('html', 'dartium'), | 200 join('html', 'dart2js'), join('html', 'dartium'), |
202 join('html', 'html_common'), | 201 join('html', 'html_common'), |
203 join('indexed_db', 'dart2js'), join('indexed_db', 'dartium'), | 202 join('indexed_db', 'dart2js'), join('indexed_db', 'dartium'), |
204 'js', 'math', 'mirrors', 'typed_data', | 203 'js', 'math', 'mirrors', 'typed_data', |
205 join('svg', 'dart2js'), join('svg', 'dartium'), | 204 join('svg', 'dart2js'), join('svg', 'dartium'), |
206 join('web_audio', 'dart2js'), join('web_audio', 'dartium'), | 205 join('web_audio', 'dart2js'), join('web_audio', 'dartium'), |
207 join('web_gl', 'dart2js'), join('web_gl', 'dartium'), | 206 join('web_gl', 'dart2js'), join('web_gl', 'dartium'), |
(...skipping 21 matching lines...) Expand all Loading... |
229 copyfile(jarFile, join(DARTANALYZER_DEST, os.path.basename(jarFile))) | 228 copyfile(jarFile, join(DARTANALYZER_DEST, os.path.basename(jarFile))) |
230 | 229 |
231 # Copy in 7zip for Windows. | 230 # Copy in 7zip for Windows. |
232 if HOST_OS == 'win32': | 231 if HOST_OS == 'win32': |
233 RESOURCE = join(SDK_tmp, 'lib', '_internal', 'pub', 'resource') | 232 RESOURCE = join(SDK_tmp, 'lib', '_internal', 'pub', 'resource') |
234 os.makedirs(RESOURCE) | 233 os.makedirs(RESOURCE) |
235 copytree(join(HOME, 'third_party', '7zip'), | 234 copytree(join(HOME, 'third_party', '7zip'), |
236 join(RESOURCE, '7zip'), | 235 join(RESOURCE, '7zip'), |
237 ignore=ignore_patterns('.svn')) | 236 ignore=ignore_patterns('.svn')) |
238 | 237 |
239 # Copy dart2js/dartdoc/pub. | 238 # Copy dart2js/pub. |
240 CopyDartScripts(HOME, SDK_tmp) | 239 CopyDartScripts(HOME, SDK_tmp) |
241 CopySnapshots(SNAPSHOT, SDK_tmp) | 240 CopySnapshots(SNAPSHOT, SDK_tmp) |
242 | 241 |
243 # Write the 'version' file | 242 # Write the 'version' file |
244 version = utils.GetVersion() | 243 version = utils.GetVersion() |
245 versionFile = open(os.path.join(SDK_tmp, 'version'), 'w') | 244 versionFile = open(os.path.join(SDK_tmp, 'version'), 'w') |
246 versionFile.write(version + '\n') | 245 versionFile.write(version + '\n') |
247 versionFile.close() | 246 versionFile.close() |
248 | 247 |
249 # Write the 'revision' file | 248 # Write the 'revision' file |
250 revision = utils.GetSVNRevision() | 249 revision = utils.GetSVNRevision() |
251 | 250 |
252 if revision is not None: | 251 if revision is not None: |
253 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: | 252 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: |
254 f.write(revision + '\n') | 253 f.write(revision + '\n') |
255 f.close() | 254 f.close() |
256 | 255 |
257 Copy(join(HOME, 'README.dart-sdk'), join(SDK_tmp, 'README')) | 256 Copy(join(HOME, 'README.dart-sdk'), join(SDK_tmp, 'README')) |
258 | 257 |
259 move(SDK_tmp, SDK) | 258 move(SDK_tmp, SDK) |
260 | 259 |
261 if __name__ == '__main__': | 260 if __name__ == '__main__': |
262 sys.exit(Main(sys.argv)) | 261 sys.exit(Main(sys.argv)) |
OLD | NEW |