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

Side by Side Diff: tools/create_sdk.py

Issue 14297021: Move pub into sdk/lib/_internal. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Disallow package: imports of pub. Created 7 years, 8 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 | « sdk/lib/_internal/pub/test/version_test.dart ('k') | tools/test.dart » ('j') | 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) 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 # ......meta/ 46 # ......meta/
47 # ......serialization 47 # ......serialization
48 # ......unittest/ 48 # ......unittest/
49 # ......(more will come here) 49 # ......(more will come here)
50 # ....util/ 50 # ....util/
51 # ......analyzer/ 51 # ......analyzer/
52 # ........dart_analyzer.jar 52 # ........dart_analyzer.jar
53 # ......dartanalyzer/ 53 # ......dartanalyzer/
54 # ........dartanalyzer.jar 54 # ........dartanalyzer.jar
55 # ........(third-party libraries for dart_analyzer) 55 # ........(third-party libraries for dart_analyzer)
56 # ......pub/
57 # ......(more will come here) 56 # ......(more will come here)
58 57
59 58
60 import glob 59 import glob
61 import optparse 60 import optparse
62 import os 61 import os
63 import re 62 import re
64 import sys 63 import sys
65 import subprocess 64 import subprocess
66 import tempfile 65 import tempfile
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 file_extension = '' 107 file_extension = ''
109 if HOST_OS == 'win32': 108 if HOST_OS == 'win32':
110 file_extension = '.bat' 109 file_extension = '.bat'
111 110
112 src = src_file + file_extension 111 src = src_file + file_extension
113 dest = join(dest_dir, basename(src_file) + file_extension) 112 dest = join(dest_dir, basename(src_file) + file_extension)
114 Copy(src, dest) 113 Copy(src, dest)
115 114
116 115
117 def CopyDartScripts(home, sdk_root): 116 def CopyDartScripts(home, sdk_root):
118 # TODO(dgrove) - add pub once issue 6619 is fixed 117 for executable in ['dart2js', 'dartanalyzer', 'dartdoc', 'pub']:
119 for executable in ['dart2js', 'dartanalyzer', 'dartdoc']:
120 CopyShellScript(os.path.join(home, 'sdk', 'bin', executable), 118 CopyShellScript(os.path.join(home, 'sdk', 'bin', executable),
121 os.path.join(sdk_root, 'bin')) 119 os.path.join(sdk_root, 'bin'))
122 120
123 121
124 def CopySnapshots(snapshot, sdk_root): 122 def CopySnapshots(snapshot, sdk_root):
125 copyfile(snapshot, join(sdk_root, 'bin', 'snapshots', basename(snapshot))) 123 copyfile(snapshot, join(sdk_root, 'bin', 'snapshots', basename(snapshot)))
126 124
127 125
128 def Main(argv): 126 def Main(argv):
129 # Pull in all of the gypi files which will be munged into the sdk. 127 # Pull in all of the gypi files which will be munged into the sdk.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 175
178 # Copy analyzer into sdk/bin 176 # Copy analyzer into sdk/bin
179 ANALYZER_HOME = join(HOME, build_dir, 'analyzer') 177 ANALYZER_HOME = join(HOME, build_dir, 'analyzer')
180 dart_analyzer_src_binary = join(ANALYZER_HOME, 'bin', 178 dart_analyzer_src_binary = join(ANALYZER_HOME, 'bin',
181 'dart_analyzer' + analyzer_file_extension) 179 'dart_analyzer' + analyzer_file_extension)
182 dart_analyzer_dest_binary = join(BIN, 180 dart_analyzer_dest_binary = join(BIN,
183 'dart_analyzer' + analyzer_file_extension) 181 'dart_analyzer' + analyzer_file_extension)
184 copyfile(dart_analyzer_src_binary, dart_analyzer_dest_binary) 182 copyfile(dart_analyzer_src_binary, dart_analyzer_dest_binary)
185 copymode(dart_analyzer_src_binary, dart_analyzer_dest_binary) 183 copymode(dart_analyzer_src_binary, dart_analyzer_dest_binary)
186 184
187 # Create pub shell script.
188 # TODO(dgrove) - delete this once issue 6619 is fixed
189 pub_src_script = join(HOME, 'utils', 'pub', 'sdk', 'pub')
190 CopyShellScript(pub_src_script, BIN)
191
192 # 185 #
193 # Create and populate sdk/include. 186 # Create and populate sdk/include.
194 # 187 #
195 INCLUDE = join(SDK_tmp, 'include') 188 INCLUDE = join(SDK_tmp, 'include')
196 os.makedirs(INCLUDE) 189 os.makedirs(INCLUDE)
197 copyfile(join(HOME, 'runtime', 'include', 'dart_api.h'), 190 copyfile(join(HOME, 'runtime', 'include', 'dart_api.h'),
198 join(INCLUDE, 'dart_api.h')) 191 join(INCLUDE, 'dart_api.h'))
199 copyfile(join(HOME, 'runtime', 'include', 'dart_debugger_api.h'), 192 copyfile(join(HOME, 'runtime', 'include', 'dart_debugger_api.h'),
200 join(INCLUDE, 'dart_debugger_api.h')) 193 join(INCLUDE, 'dart_debugger_api.h'))
201 194
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 # Create and copy dartanalyzer into 'util' 261 # Create and copy dartanalyzer into 'util'
269 DARTANALYZER_SRC = join(HOME, build_dir, 'dartanalyzer') 262 DARTANALYZER_SRC = join(HOME, build_dir, 'dartanalyzer')
270 DARTANALYZER_DEST = join(UTIL, 'dartanalyzer') 263 DARTANALYZER_DEST = join(UTIL, 'dartanalyzer')
271 os.makedirs(DARTANALYZER_DEST) 264 os.makedirs(DARTANALYZER_DEST)
272 265
273 jarFiles = glob.glob(join(DARTANALYZER_SRC, '*.jar')) 266 jarFiles = glob.glob(join(DARTANALYZER_SRC, '*.jar'))
274 267
275 for jarFile in jarFiles: 268 for jarFile in jarFiles:
276 copyfile(jarFile, join(DARTANALYZER_DEST, os.path.basename(jarFile))) 269 copyfile(jarFile, join(DARTANALYZER_DEST, os.path.basename(jarFile)))
277 270
278 # Create and populate util/pub. 271 PUB_DEST = join(SDK_tmp, 'lib', '_internal', 'pub')
279 copytree(join(HOME, 'utils', 'pub'), join(UTIL, 'pub'), 272
280 ignore=ignore_patterns('.svn', 'sdk'))
281 273
282 # Copy in 7zip for Windows. 274 # Copy in 7zip for Windows.
283 if HOST_OS == 'win32': 275 if HOST_OS == 'win32':
284 copytree(join(HOME, 'third_party', '7zip'), 276 copytree(join(HOME, 'third_party', '7zip'),
285 join(join(UTIL, 'pub'), '7zip'), 277 join(PUB_DEST, 'resource', '7zip'),
286 ignore=ignore_patterns('.svn')) 278 ignore=ignore_patterns('.svn'))
287 279
288 ReplaceInFiles([ 280 ReplaceInFiles([
289 join(UTIL, 'pub', 'io.dart'), 281 join(PUB_DEST, 'lib', 'src', 'io.dart'),
290 ], [ 282 ], [
291 ("../../third_party/7zip/7za.exe", 283 ("../../../../third_party/7zip/7za.exe",
292 "7zip/7za.exe"), 284 "resource/7zip/7za.exe"),
293 ]) 285 ])
294 286
295 # Copy dart2js/dartdoc/pub. 287 # Copy dart2js/dartdoc/pub.
296 CopyDartScripts(HOME, SDK_tmp) 288 CopyDartScripts(HOME, SDK_tmp)
297 CopySnapshots(SNAPSHOT, SDK_tmp) 289 CopySnapshots(SNAPSHOT, SDK_tmp)
298 290
299 # Write the 'version' file 291 # Write the 'version' file
300 version = utils.GetVersion() 292 version = utils.GetVersion()
301 versionFile = open(os.path.join(SDK_tmp, 'version'), 'w') 293 versionFile = open(os.path.join(SDK_tmp, 'version'), 'w')
302 versionFile.write(version + '\n') 294 versionFile.write(version + '\n')
303 versionFile.close() 295 versionFile.close()
304 296
305 # Write the 'revision' file 297 # Write the 'revision' file
306 revision = utils.GetSVNRevision() 298 revision = utils.GetSVNRevision()
307 299
308 if revision is not None: 300 if revision is not None:
309 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: 301 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f:
310 f.write(revision + '\n') 302 f.write(revision + '\n')
311 f.close() 303 f.close()
312 304
313 Copy(join(HOME, 'README.dart-sdk'), join(SDK_tmp, 'README')) 305 Copy(join(HOME, 'README.dart-sdk'), join(SDK_tmp, 'README'))
314 306
315 move(SDK_tmp, SDK) 307 move(SDK_tmp, SDK)
316 308
317 if __name__ == '__main__': 309 if __name__ == '__main__':
318 sys.exit(Main(sys.argv)) 310 sys.exit(Main(sys.argv))
OLDNEW
« no previous file with comments | « sdk/lib/_internal/pub/test/version_test.dart ('k') | tools/test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698