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

Side by Side Diff: tools/create_sdk.py

Issue 11377106: Continued cleanup of create_sdk.py now that we have sdk/bin in the (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 | « 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) 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 using the appropriate platform-specific file extension.''' 95 using the appropriate platform-specific file extension.'''
96 file_extension = '' 96 file_extension = ''
97 if utils.GuessOS() == 'win32': 97 if utils.GuessOS() == 'win32':
98 file_extension = '.bat' 98 file_extension = '.bat'
99 99
100 src = src_file + file_extension 100 src = src_file + file_extension
101 dest = join(dest_dir, basename(src_file) + file_extension) 101 dest = join(dest_dir, basename(src_file) + file_extension)
102 Copy(src, dest) 102 Copy(src, dest)
103 103
104 104
105 def CopyDart2Js(build_dir, sdk_root, version): 105 def CopyDartScripts(home, build_dir, sdk_root, version):
106 if version: 106 if version:
107 ReplaceInFiles([os.path.join(sdk_root, 'lib', '_internal', 'compiler', 107 ReplaceInFiles([os.path.join(sdk_root, 'lib', '_internal', 'compiler',
108 'implementation', 'compiler.dart')], 108 'implementation', 'compiler.dart')],
109 [(r"BUILD_ID = 'build number could not be determined'", 109 [(r"BUILD_ID = 'build number could not be determined'",
110 r"BUILD_ID = '%s'" % version)]) 110 r"BUILD_ID = '%s'" % version)])
111 if utils.GuessOS() == 'win32': 111 # TODO(dgrove) - add pub once issue 6619 is fixed
112 dart2js = os.path.join(sdk_root, 'bin', 'dart2js.bat') 112 for executable in ['dart2js', 'dartdoc']:
113 Copy(os.path.join(build_dir, 'dart2js.bat'), dart2js) 113 CopyShellScript(os.path.join(home, 'sdk', 'bin', executable),
114 dartdoc = os.path.join(sdk_root, 'bin', 'dartdoc.bat') 114 os.path.join(sdk_root, 'bin'))
115 Copy(os.path.join(build_dir, 'dartdoc.bat'), dartdoc)
116 else:
117 dart2js = os.path.join(sdk_root, 'bin', 'dart2js')
118 Copy(os.path.join(build_dir, 'dart2js'), dart2js)
119 dartdoc = os.path.join(sdk_root, 'bin', 'dartdoc')
120 Copy(os.path.join(build_dir, 'dartdoc'), dartdoc)
121 115
116 if utils.GuessOS() != 'win32':
122 # TODO(ahe): Enable for Windows as well. 117 # TODO(ahe): Enable for Windows as well.
123 subprocess.call([os.path.join(build_dir, 'gen_snapshot'), 118 subprocess.call([os.path.join(build_dir, 'gen_snapshot'),
124 '--script_snapshot=%s' % 119 '--script_snapshot=%s' %
125 os.path.join(sdk_root, 'lib', '_internal', 'compiler', 120 os.path.join(sdk_root, 'lib', '_internal', 'compiler',
126 'implementation', 'dart2js.dart.snapshot'), 121 'implementation', 'dart2js.dart.snapshot'),
127 os.path.join(sdk_root, 'lib', '_internal', 'compiler', 122 os.path.join(sdk_root, 'lib', '_internal', 'compiler',
128 'implementation', 'dart2js.dart')]) 123 'implementation', 'dart2js.dart')])
129 124
130 125
131 126
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 if ShouldCopyAnalyzer(): 168 if ShouldCopyAnalyzer():
174 # Copy analyzer into sdk/bin 169 # Copy analyzer into sdk/bin
175 ANALYZER_HOME = join(HOME, build_dir, 'analyzer') 170 ANALYZER_HOME = join(HOME, build_dir, 'analyzer')
176 dart_analyzer_src_binary = join(ANALYZER_HOME, 'bin', 'dart_analyzer') 171 dart_analyzer_src_binary = join(ANALYZER_HOME, 'bin', 'dart_analyzer')
177 dart_analyzer_dest_binary = join(BIN, 172 dart_analyzer_dest_binary = join(BIN,
178 'dart_analyzer' + analyzer_file_extension) 173 'dart_analyzer' + analyzer_file_extension)
179 copyfile(dart_analyzer_src_binary, dart_analyzer_dest_binary) 174 copyfile(dart_analyzer_src_binary, dart_analyzer_dest_binary)
180 copymode(dart_analyzer_src_binary, dart_analyzer_dest_binary) 175 copymode(dart_analyzer_src_binary, dart_analyzer_dest_binary)
181 176
182 # Create pub shell script. 177 # Create pub shell script.
178 # TODO(dgrove) - delete this once issue 6619 is fixed
183 pub_src_script = join(HOME, 'utils', 'pub', 'sdk', 'pub') 179 pub_src_script = join(HOME, 'utils', 'pub', 'sdk', 'pub')
184 CopyShellScript(pub_src_script, BIN) 180 CopyShellScript(pub_src_script, BIN)
185 181
186 # 182 #
187 # Create and populate sdk/include. 183 # Create and populate sdk/include.
188 # 184 #
189 INCLUDE = join(SDK_tmp, 'include') 185 INCLUDE = join(SDK_tmp, 'include')
190 os.makedirs(INCLUDE) 186 os.makedirs(INCLUDE)
191 copyfile(join(HOME, 'runtime', 'include', 'dart_api.h'), 187 copyfile(join(HOME, 'runtime', 'include', 'dart_api.h'),
192 join(INCLUDE, 'dart_api.h')) 188 join(INCLUDE, 'dart_api.h'))
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 258
263 ReplaceInFiles([ 259 ReplaceInFiles([
264 join(UTIL, 'pub', 'io.dart'), 260 join(UTIL, 'pub', 'io.dart'),
265 ], [ 261 ], [
266 ("var pathTo7zip = '../../third_party/7zip/7za.exe';", 262 ("var pathTo7zip = '../../third_party/7zip/7za.exe';",
267 "var pathTo7zip = '7zip/7za.exe';"), 263 "var pathTo7zip = '7zip/7za.exe';"),
268 ]) 264 ])
269 265
270 version = utils.GetVersion() 266 version = utils.GetVersion()
271 267
272 # Copy dart2js. 268 # Copy dart2js/dartdoc/pub.
273 CopyDart2Js(build_dir, SDK_tmp, version) 269 CopyDartScripts(HOME, build_dir, SDK_tmp, version)
274
275 # TODO(dgrove) remove this once we get sdk/bin created
276 if (utils.GuessOS() == 'win32'):
277 ReplaceInFiles([join(SDK_tmp, 'bin', 'dart2js.bat'),
278 join(SDK_tmp, 'bin', 'dartdoc.bat'),
279 join(SDK_tmp, 'bin', 'pub.bat')],
280 [(r'..\\..\\sdk\\lib', r'..\lib')])
281 else:
282 ReplaceInFiles([join(SDK_tmp, 'bin', 'dart2js'),
283 join(SDK_tmp, 'bin', 'dartdoc'),
284 join(SDK_tmp, 'bin', 'pub')],
285 [('../../sdk/lib', '../lib')])
286 270
287 # Fix up dartdoc. 271 # Fix up dartdoc.
288 # TODO(dgrove): Remove this once sdk and dart-sdk match. 272 # TODO(dgrove): Remove this once issue 6619 is fixed.
289 ReplaceInFiles([join(SDK_tmp, 'lib', '_internal', 'dartdoc', 273 ReplaceInFiles([join(SDK_tmp, 'lib', '_internal', 'dartdoc',
290 'bin', 'dartdoc.dart')], 274 'bin', 'dartdoc.dart')],
291 [("../../../../../pkg/args/lib/args.dart", 275 [("../../../../../pkg/args/lib/args.dart",
292 "../../../../pkg/args/lib/args.dart")]) 276 "../../../../pkg/args/lib/args.dart")])
293 277
294 # Write the 'version' file 278 # Write the 'version' file
295 versionFile = open(os.path.join(SDK_tmp, 'version'), 'w') 279 versionFile = open(os.path.join(SDK_tmp, 'version'), 'w')
296 versionFile.write(version + '\n') 280 versionFile.write(version + '\n')
297 versionFile.close() 281 versionFile.close()
298 282
299 # Write the 'revision' file 283 # Write the 'revision' file
300 revision = utils.GetSVNRevision() 284 revision = utils.GetSVNRevision()
301 285
302 if revision is not None: 286 if revision is not None:
303 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: 287 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f:
304 f.write(revision + '\n') 288 f.write(revision + '\n')
305 f.close() 289 f.close()
306 290
307 Copy(join(HOME, 'README.dart-sdk'), join(SDK_tmp, 'README')) 291 Copy(join(HOME, 'README.dart-sdk'), join(SDK_tmp, 'README'))
308 292
309 move(SDK_tmp, SDK) 293 move(SDK_tmp, SDK)
310 294
311 if __name__ == '__main__': 295 if __name__ == '__main__':
312 sys.exit(Main(sys.argv)) 296 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