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

Side by Side Diff: tools/create_sdk.py

Issue 11238047: Add a version file to the SDK (in preparation for eventually removing the revision file). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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 | « README.dart-sdk ('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) 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 dest.close() 80 dest.close()
81 81
82 82
83 def Copy(src, dest): 83 def Copy(src, dest):
84 copyfile(src, dest) 84 copyfile(src, dest)
85 copymode(src, dest) 85 copymode(src, dest)
86 86
87 # TODO(zundel): this excludes the analyzer from the sdk build until builders 87 # TODO(zundel): this excludes the analyzer from the sdk build until builders
88 # have all prerequisite software installed. Also update dart.gyp. 88 # have all prerequisite software installed. Also update dart.gyp.
89 def ShouldCopyAnalyzer(): 89 def ShouldCopyAnalyzer():
90 os = utils.GuessOS(); 90 os = utils.GuessOS()
91 return os == 'linux' or os == 'macos' 91 return os == 'linux' or os == 'macos'
92 92
93 93
94 def CopyShellScript(src_file, dest_dir): 94 def CopyShellScript(src_file, dest_dir):
95 '''Copies a shell/batch script to the given destination directory. Handles 95 '''Copies a shell/batch script to the given destination directory. Handles
96 using the appropriate platform-specific file extension.''' 96 using the appropriate platform-specific file extension.'''
97 file_extension = '' 97 file_extension = ''
98 if utils.GuessOS() == 'win32': 98 if utils.GuessOS() == 'win32':
99 file_extension = '.bat' 99 file_extension = '.bat'
100 100
101 src = src_file + file_extension 101 src = src_file + file_extension
102 dest = join(dest_dir, basename(src_file) + file_extension) 102 dest = join(dest_dir, basename(src_file) + file_extension)
103 Copy(src, dest) 103 Copy(src, dest)
104 104
105 105
106 def CopyDart2Js(build_dir, sdk_root, version): 106 def CopyDart2Js(build_dir, sdk_root, version):
107 if version: 107 if version:
108 ReplaceInFiles([os.path.join(sdk_root, 'pkg', 'compiler', 108 ReplaceInFiles([os.path.join(sdk_root, 'pkg', 'compiler',
109 'implementation', 'compiler.dart')], 109 'implementation', 'compiler.dart')],
110 [(r"BUILD_ID = 'build number could not be determined'", 110 [(r"BUILD_ID = 'build number could not be determined'",
111 r"BUILD_ID = '%s'" % version)]) 111 r"BUILD_ID = '%s'" % version)])
112 if utils.GuessOS() == 'win32': 112 if utils.GuessOS() == 'win32':
113 dart2js = os.path.join(sdk_root, 'bin', 'dart2js.bat') 113 dart2js = os.path.join(sdk_root, 'bin', 'dart2js.bat')
114 Copy(os.path.join(build_dir, 'dart2js.bat'), dart2js) 114 Copy(os.path.join(build_dir, 'dart2js.bat'), dart2js)
115 dartdoc = os.path.join(sdk_root, 'bin', 'dartdoc.bat') 115 dartdoc = os.path.join(sdk_root, 'bin', 'dartdoc.bat')
116 Copy(os.path.join(build_dir, 'dartdoc.bat'), dartdoc) 116 Copy(os.path.join(build_dir, 'dartdoc.bat'), dartdoc)
117 # TODO(dgrove) - fix this once issue 4788 is addressed. 117 # TODO(dgrove) - fix this once issue 4788 is addressed.
118 ReplaceInFiles([dart2js], 118 ReplaceInFiles([dart2js],
119 [(r'%SCRIPTPATH%\.\.\\\.\.\\lib', r'%SCRIPTPATH%..\\pkg')]); 119 [(r'%SCRIPTPATH%\.\.\\\.\.\\lib', r'%SCRIPTPATH%..\\pkg')])
120 ReplaceInFiles([dartdoc], 120 ReplaceInFiles([dartdoc],
121 [(r'%SCRIPTPATH%\.\.\\\.\.\\pkg', r'%SCRIPTPATH%..\\pkg')]); 121 [(r'%SCRIPTPATH%\.\.\\\.\.\\pkg', r'%SCRIPTPATH%..\\pkg')])
122 else: 122 else:
123 dart2js = os.path.join(sdk_root, 'bin', 'dart2js') 123 dart2js = os.path.join(sdk_root, 'bin', 'dart2js')
124 Copy(os.path.join(build_dir, 'dart2js'), dart2js) 124 Copy(os.path.join(build_dir, 'dart2js'), dart2js)
125 dartdoc = os.path.join(sdk_root, 'bin', 'dartdoc') 125 dartdoc = os.path.join(sdk_root, 'bin', 'dartdoc')
126 Copy(os.path.join(build_dir, 'dartdoc'), dartdoc) 126 Copy(os.path.join(build_dir, 'dartdoc'), dartdoc)
127 127
128 # TODO(dgrove) - fix this once issue 4788 is addressed. 128 # TODO(dgrove) - fix this once issue 4788 is addressed.
129 ReplaceInFiles([dart2js], 129 ReplaceInFiles([dart2js],
130 [(r'\$BIN_DIR/\.\./\.\./lib', r'$BIN_DIR/../pkg')]) 130 [(r'\$BIN_DIR/\.\./\.\./lib', r'$BIN_DIR/../pkg')])
131 ReplaceInFiles([dartdoc], 131 ReplaceInFiles([dartdoc],
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 302
303 analyzer_src_jar = join(ANALYZER_HOME, 'util', 'analyzer', 303 analyzer_src_jar = join(ANALYZER_HOME, 'util', 'analyzer',
304 'dart_analyzer.jar') 304 'dart_analyzer.jar')
305 analyzer_dest_jar = join(ANALYZER_DEST, 'dart_analyzer.jar') 305 analyzer_dest_jar = join(ANALYZER_DEST, 'dart_analyzer.jar')
306 copyfile(analyzer_src_jar, analyzer_dest_jar) 306 copyfile(analyzer_src_jar, analyzer_dest_jar)
307 307
308 jarsToCopy = [ join("args4j", "2.0.12", "args4j-2.0.12.jar"), 308 jarsToCopy = [ join("args4j", "2.0.12", "args4j-2.0.12.jar"),
309 join("guava", "r09", "guava-r09.jar"), 309 join("guava", "r09", "guava-r09.jar"),
310 join("json", "r2_20080312", "json.jar") ] 310 join("json", "r2_20080312", "json.jar") ]
311 for jarToCopy in jarsToCopy: 311 for jarToCopy in jarsToCopy:
312 dest_dir = join (ANALYZER_DEST, os.path.dirname(jarToCopy)) 312 dest_dir = join (ANALYZER_DEST, os.path.dirname(jarToCopy))
313 os.makedirs(dest_dir) 313 os.makedirs(dest_dir)
314 dest_file = join (ANALYZER_DEST, jarToCopy) 314 dest_file = join (ANALYZER_DEST, jarToCopy)
315 src_file = join(ANALYZER_HOME, 'util', 'analyzer', jarToCopy) 315 src_file = join(ANALYZER_HOME, 'util', 'analyzer', jarToCopy)
316 copyfile(src_file, dest_file) 316 copyfile(src_file, dest_file)
317 317
318 # Create and populate util/pub. 318 # Create and populate util/pub.
319 copytree(join(HOME, 'utils', 'pub'), join(UTIL, 'pub'), 319 copytree(join(HOME, 'utils', 'pub'), join(UTIL, 'pub'),
320 ignore=ignore_patterns('.svn', 'sdk')) 320 ignore=ignore_patterns('.svn', 'sdk'))
321 321
322 # Copy in 7zip for Windows. 322 # Copy in 7zip for Windows.
323 if utils.GuessOS() == 'win32': 323 if utils.GuessOS() == 'win32':
324 copytree(join(HOME, 'third_party', '7zip'), 324 copytree(join(HOME, 'third_party', '7zip'),
325 join(join(UTIL, 'pub'), '7zip'), 325 join(join(UTIL, 'pub'), '7zip'),
326 ignore=ignore_patterns('.svn')) 326 ignore=ignore_patterns('.svn'))
327 327
328 ReplaceInFiles([ 328 ReplaceInFiles([
329 join(UTIL, 'pub', 'io.dart'), 329 join(UTIL, 'pub', 'io.dart'),
330 ], [ 330 ], [
331 ("var pathTo7zip = '../../third_party/7zip/7za.exe';", 331 ("var pathTo7zip = '../../third_party/7zip/7za.exe';",
332 "var pathTo7zip = '7zip/7za.exe';"), 332 "var pathTo7zip = '7zip/7za.exe';"),
333 ]) 333 ])
334 334
335 version = utils.GetVersion() 335 version = utils.GetVersion()
336 336
337 # Copy dart2js. 337 # Copy dart2js.
338 CopyDart2Js(build_dir, SDK_tmp, version) 338 CopyDart2Js(build_dir, SDK_tmp, version)
339 339
340 # Write the 'version' file
341 versionFile = open(os.path.join(SDK_tmp, 'version'), 'w')
342 versionFile.write(version + '\n')
343 versionFile.close()
344
345 # Write the 'revision' file
340 revision = utils.GetSVNRevision() 346 revision = utils.GetSVNRevision()
341 347
342 # Write the 'revision' file
343 if revision is not None: 348 if revision is not None:
344 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: 349 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f:
345 f.write(revision + '\n') 350 f.write(revision + '\n')
346 f.close() 351 f.close()
347 352
348 Copy(join(HOME, 'README.dart-sdk'), join(SDK_tmp, 'README')) 353 Copy(join(HOME, 'README.dart-sdk'), join(SDK_tmp, 'README'))
349 354
350 move(SDK_tmp, SDK) 355 move(SDK_tmp, SDK)
351 356
352 if __name__ == '__main__': 357 if __name__ == '__main__':
353 sys.exit(Main(sys.argv)) 358 sys.exit(Main(sys.argv))
OLDNEW
« no previous file with comments | « README.dart-sdk ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698