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

Side by Side Diff: tools/create_sdk.py

Issue 11527010: Add the dart_analyzer tool to the sdk for Windows. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 77
78 dest = open(path, 'w') 78 dest = open(path, 'w')
79 dest.write(contents) 79 dest.write(contents)
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
88 # have all prerequisite software installed. Also update dart.gyp.
89 def ShouldCopyAnalyzer():
90 return HOST_OS == 'linux' or HOST_OS == 'macos'
91
92 87
93 def CopyShellScript(src_file, dest_dir): 88 def CopyShellScript(src_file, dest_dir):
94 '''Copies a shell/batch script to the given destination directory. Handles 89 '''Copies a shell/batch script to the given destination directory. Handles
95 using the appropriate platform-specific file extension.''' 90 using the appropriate platform-specific file extension.'''
96 file_extension = '' 91 file_extension = ''
97 if HOST_OS == 'win32': 92 if HOST_OS == 'win32':
98 file_extension = '.bat' 93 file_extension = '.bat'
99 94
100 src = src_file + file_extension 95 src = src_file + file_extension
101 dest = join(dest_dir, basename(src_file) + file_extension) 96 dest = join(dest_dir, basename(src_file) + file_extension)
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 140
146 # Copy the Dart VM binary and the Windows Dart VM link library 141 # Copy the Dart VM binary and the Windows Dart VM link library
147 # into sdk/bin. 142 # into sdk/bin.
148 # 143 #
149 # TODO(dgrove) - deal with architectures that are not ia32. 144 # TODO(dgrove) - deal with architectures that are not ia32.
150 build_dir = os.path.dirname(argv[1]) 145 build_dir = os.path.dirname(argv[1])
151 dart_file_extension = '' 146 dart_file_extension = ''
152 analyzer_file_extension = '' 147 analyzer_file_extension = ''
153 if HOST_OS == 'win32': 148 if HOST_OS == 'win32':
154 dart_file_extension = '.exe' 149 dart_file_extension = '.exe'
155 analyzer_file_extension = '.bat' # TODO(zundel): test on Windows 150 analyzer_file_extension = '.bat'
156 dart_import_lib_src = join(HOME, build_dir, 'dart.lib') 151 dart_import_lib_src = join(HOME, build_dir, 'dart.lib')
157 dart_import_lib_dest = join(BIN, 'dart.lib') 152 dart_import_lib_dest = join(BIN, 'dart.lib')
158 copyfile(dart_import_lib_src, dart_import_lib_dest) 153 copyfile(dart_import_lib_src, dart_import_lib_dest)
159 dart_src_binary = join(HOME, build_dir, 'dart' + dart_file_extension) 154 dart_src_binary = join(HOME, build_dir, 'dart' + dart_file_extension)
160 dart_dest_binary = join(BIN, 'dart' + dart_file_extension) 155 dart_dest_binary = join(BIN, 'dart' + dart_file_extension)
161 copyfile(dart_src_binary, dart_dest_binary) 156 copyfile(dart_src_binary, dart_dest_binary)
162 copymode(dart_src_binary, dart_dest_binary) 157 copymode(dart_src_binary, dart_dest_binary)
163 # Strip the binaries on platforms where that is supported. 158 # Strip the binaries on platforms where that is supported.
164 if HOST_OS == 'linux': 159 if HOST_OS == 'linux':
165 subprocess.call(['strip', dart_dest_binary]) 160 subprocess.call(['strip', dart_dest_binary])
166 elif HOST_OS == 'macos': 161 elif HOST_OS == 'macos':
167 subprocess.call(['strip', '-x', dart_dest_binary]) 162 subprocess.call(['strip', '-x', dart_dest_binary])
168 163
169 if ShouldCopyAnalyzer(): 164 # Copy analyzer into sdk/bin
170 # Copy analyzer into sdk/bin 165 ANALYZER_HOME = join(HOME, build_dir, 'analyzer')
171 ANALYZER_HOME = join(HOME, build_dir, 'analyzer') 166 dart_analyzer_src_binary = join(ANALYZER_HOME, 'bin',
172 dart_analyzer_src_binary = join(ANALYZER_HOME, 'bin', 'dart_analyzer') 167 'dart_analyzer' + analyzer_file_extension)
173 dart_analyzer_dest_binary = join(BIN, 168 dart_analyzer_dest_binary = join(BIN,
174 'dart_analyzer' + analyzer_file_extension) 169 'dart_analyzer' + analyzer_file_extension)
175 copyfile(dart_analyzer_src_binary, dart_analyzer_dest_binary) 170 copyfile(dart_analyzer_src_binary, dart_analyzer_dest_binary)
176 copymode(dart_analyzer_src_binary, dart_analyzer_dest_binary) 171 copymode(dart_analyzer_src_binary, dart_analyzer_dest_binary)
177 172
178 # Create pub shell script. 173 # Create pub shell script.
179 # TODO(dgrove) - delete this once issue 6619 is fixed 174 # TODO(dgrove) - delete this once issue 6619 is fixed
180 pub_src_script = join(HOME, 'utils', 'pub', 'sdk', 'pub') 175 pub_src_script = join(HOME, 'utils', 'pub', 'sdk', 'pub')
181 CopyShellScript(pub_src_script, BIN) 176 CopyShellScript(pub_src_script, BIN)
182 177
183 # 178 #
184 # Create and populate sdk/include. 179 # Create and populate sdk/include.
185 # 180 #
186 INCLUDE = join(SDK_tmp, 'include') 181 INCLUDE = join(SDK_tmp, 'include')
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 'meta', 'oauth2', 'serialization', 'unittest']: 220 'meta', 'oauth2', 'serialization', 'unittest']:
226 221
227 copytree(join(HOME, 'pkg', library), join(PKG, library), 222 copytree(join(HOME, 'pkg', library), join(PKG, library),
228 ignore=ignore_patterns('*.svn', 'doc', 'docs', 223 ignore=ignore_patterns('*.svn', 'doc', 'docs',
229 '*.py', '*.gypi', '*.sh', 'packages')) 224 '*.py', '*.gypi', '*.sh', 'packages'))
230 225
231 # Create and copy tools. 226 # Create and copy tools.
232 UTIL = join(SDK_tmp, 'util') 227 UTIL = join(SDK_tmp, 'util')
233 os.makedirs(UTIL) 228 os.makedirs(UTIL)
234 229
235 if ShouldCopyAnalyzer(): 230 # Create and copy Analyzer library into 'util'
236 # Create and copy Analyzer library into 'util' 231 ANALYZER_DEST = join(UTIL, 'analyzer')
237 ANALYZER_DEST = join(UTIL, 'analyzer') 232 os.makedirs(ANALYZER_DEST)
238 os.makedirs(ANALYZER_DEST)
239 233
240 analyzer_src_jar = join(ANALYZER_HOME, 'util', 'analyzer', 234 analyzer_src_jar = join(ANALYZER_HOME, 'util', 'analyzer',
241 'dart_analyzer.jar') 235 'dart_analyzer.jar')
242 analyzer_dest_jar = join(ANALYZER_DEST, 'dart_analyzer.jar') 236 analyzer_dest_jar = join(ANALYZER_DEST, 'dart_analyzer.jar')
243 copyfile(analyzer_src_jar, analyzer_dest_jar) 237 copyfile(analyzer_src_jar, analyzer_dest_jar)
244 238
245 jarsToCopy = [ join("args4j", "2.0.12", "args4j-2.0.12.jar"), 239 jarsToCopy = [ join("args4j", "2.0.12", "args4j-2.0.12.jar"),
246 join("guava", "r09", "guava-r09.jar"), 240 join("guava", "r09", "guava-r09.jar"),
247 join("json", "r2_20080312", "json.jar") ] 241 join("json", "r2_20080312", "json.jar") ]
248 for jarToCopy in jarsToCopy: 242 for jarToCopy in jarsToCopy:
249 dest_dir = join (ANALYZER_DEST, os.path.dirname(jarToCopy)) 243 dest_dir = join (ANALYZER_DEST, os.path.dirname(jarToCopy))
250 os.makedirs(dest_dir) 244 os.makedirs(dest_dir)
251 dest_file = join (ANALYZER_DEST, jarToCopy) 245 dest_file = join (ANALYZER_DEST, jarToCopy)
252 src_file = join(ANALYZER_HOME, 'util', 'analyzer', jarToCopy) 246 src_file = join(ANALYZER_HOME, 'util', 'analyzer', jarToCopy)
253 copyfile(src_file, dest_file) 247 copyfile(src_file, dest_file)
254 248
255 # Create and populate util/pub. 249 # Create and populate util/pub.
256 copytree(join(HOME, 'utils', 'pub'), join(UTIL, 'pub'), 250 copytree(join(HOME, 'utils', 'pub'), join(UTIL, 'pub'),
257 ignore=ignore_patterns('.svn', 'sdk')) 251 ignore=ignore_patterns('.svn', 'sdk'))
258 252
259 # Copy in 7zip for Windows. 253 # Copy in 7zip for Windows.
260 if HOST_OS == 'win32': 254 if HOST_OS == 'win32':
261 copytree(join(HOME, 'third_party', '7zip'), 255 copytree(join(HOME, 'third_party', '7zip'),
262 join(join(UTIL, 'pub'), '7zip'), 256 join(join(UTIL, 'pub'), '7zip'),
263 ignore=ignore_patterns('.svn')) 257 ignore=ignore_patterns('.svn'))
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: 304 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f:
311 f.write(revision + '\n') 305 f.write(revision + '\n')
312 f.close() 306 f.close()
313 307
314 Copy(join(HOME, 'README.dart-sdk'), join(SDK_tmp, 'README')) 308 Copy(join(HOME, 'README.dart-sdk'), join(SDK_tmp, 'README'))
315 309
316 move(SDK_tmp, SDK) 310 move(SDK_tmp, SDK)
317 311
318 if __name__ == '__main__': 312 if __name__ == '__main__':
319 sys.exit(Main(sys.argv)) 313 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