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 import glob | 7 import glob |
8 import optparse | 8 import optparse |
9 import os | 9 import os |
10 import re | 10 import re |
11 import shutil | 11 import shutil |
12 import subprocess | 12 import subprocess |
13 import sys | 13 import sys |
14 import tempfile | 14 import tempfile |
15 import gsutil | 15 import gsutil |
16 import ziputils | 16 import ziputils |
17 import hashlib | 17 import hashlib |
18 | 18 |
19 from os.path import join | 19 from os.path import join |
20 | 20 |
21 BUILD_OS = None | 21 BUILD_OS = None |
22 DART_PATH = None | 22 DART_PATH = None |
23 TOOLS_PATH = None | 23 TOOLS_PATH = None |
| 24 |
24 GSU_PATH_REV = None | 25 GSU_PATH_REV = None |
| 26 GSU_PATH_LATEST = None |
25 GSU_API_DOCS_PATH = None | 27 GSU_API_DOCS_PATH = None |
26 GSU_API_DOCS_BUCKET = 'gs://dartlang-api-docs' | 28 GSU_API_DOCS_BUCKET = 'gs://dartlang-api-docs' |
27 GSU_PATH_LATEST = None | 29 |
28 REVISION = None | 30 REVISION = None |
| 31 TRUNK_BUILD = None |
| 32 PLUGINS_BUILD = None |
29 | 33 |
30 utils = None | 34 utils = None |
31 | 35 |
32 class AntWrapper(object): | 36 class AntWrapper(object): |
33 """A wrapper for ant build invocations""" | 37 """A wrapper for ant build invocations""" |
34 | 38 |
35 _antpath = None | 39 _antpath = None |
36 _bzippath = None | 40 _bzippath = None |
37 _propertyfile = None | 41 _propertyfile = None |
38 | 42 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 | 189 |
186 def main(): | 190 def main(): |
187 """Main entry point for the build program.""" | 191 """Main entry point for the build program.""" |
188 global BUILD_OS | 192 global BUILD_OS |
189 global DART_PATH | 193 global DART_PATH |
190 global TOOLS_PATH | 194 global TOOLS_PATH |
191 global GSU_PATH_REV | 195 global GSU_PATH_REV |
192 global GSU_API_DOCS_PATH | 196 global GSU_API_DOCS_PATH |
193 global GSU_PATH_LATEST | 197 global GSU_PATH_LATEST |
194 global REVISION | 198 global REVISION |
| 199 global TRUNK_BUILD |
| 200 global PLUGINS_BUILD |
195 global utils | 201 global utils |
196 | 202 |
197 if not sys.argv: | 203 if not sys.argv: |
198 print 'Script pathname not known, giving up.' | 204 print 'Script pathname not known, giving up.' |
199 return 1 | 205 return 1 |
200 | 206 |
201 scriptdir = os.path.abspath(os.path.dirname(sys.argv[0])) | 207 scriptdir = os.path.abspath(os.path.dirname(sys.argv[0])) |
202 editorpath = os.path.abspath(os.path.join(scriptdir, '..')) | 208 editorpath = os.path.abspath(os.path.join(scriptdir, '..')) |
203 thirdpartypath = os.path.abspath(os.path.join(scriptdir, '..', '..', | 209 thirdpartypath = os.path.abspath(os.path.join(scriptdir, '..', '..', |
204 'third_party')) | 210 'third_party')) |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 # so the environemnt variables 'USER' Linux and Mac and | 304 # so the environemnt variables 'USER' Linux and Mac and |
299 # 'USERNAME' Windows were used. | 305 # 'USERNAME' Windows were used. |
300 username = os.environ.get('USER') | 306 username = os.environ.get('USER') |
301 if username is None: | 307 if username is None: |
302 username = os.environ.get('USERNAME') | 308 username = os.environ.get('USERNAME') |
303 | 309 |
304 if username is None: | 310 if username is None: |
305 PrintError('Could not find username') | 311 PrintError('Could not find username') |
306 return 6 | 312 return 6 |
307 | 313 |
| 314 # dart-editor[-trunk], dart-editor-(win/mac/linux)[-trunk] |
| 315 builder_name = str(options.name) |
| 316 |
| 317 TRUNK_BUILD = builder_name.endswith("-trunk") |
| 318 PLUGINS_BUILD = (builder_name == 'dart-editor' or |
| 319 builder_name == 'dart-editor-trunk') |
| 320 |
308 build_skip_tests = os.environ.get('DART_SKIP_RUNNING_TESTS') | 321 build_skip_tests = os.environ.get('DART_SKIP_RUNNING_TESTS') |
309 sdk_environment = os.environ | 322 sdk_environment = os.environ |
310 if username.startswith('chrome'): | 323 if username.startswith('chrome'): |
311 to_bucket = 'gs://dart-editor-archive-continuous' | 324 if TRUNK_BUILD: |
| 325 to_bucket = 'gs://dart-editor-archive-trunk' |
| 326 else: |
| 327 to_bucket = 'gs://dart-editor-archive-continuous' |
312 running_on_buildbot = True | 328 running_on_buildbot = True |
313 else: | 329 else: |
314 to_bucket = 'gs://dart-editor-archive-testing' | 330 to_bucket = 'gs://dart-editor-archive-testing' |
315 running_on_buildbot = False | 331 running_on_buildbot = False |
316 sdk_environment['DART_LOCAL_BUILD'] = 'dart-editor-archive-testing' | 332 sdk_environment['DART_LOCAL_BUILD'] = 'dart-editor-archive-testing' |
317 | 333 |
318 REVISION = options.revision | 334 REVISION = options.revision |
319 GSU_PATH_REV = '%s/%s' % (to_bucket, options.revision) | 335 GSU_PATH_REV = '%s/%s' % (to_bucket, options.revision) |
320 GSU_PATH_LATEST = '%s/%s' % (to_bucket, 'latest') | 336 GSU_PATH_LATEST = '%s/%s' % (to_bucket, 'latest') |
321 GSU_API_DOCS_PATH = '%s/%s' % (GSU_API_DOCS_BUCKET, options.revision) | 337 GSU_API_DOCS_PATH = '%s/%s' % (GSU_API_DOCS_BUCKET, options.revision) |
322 | 338 |
323 homegsutil = join(DART_PATH, 'third_party', 'gsutil', 'gsutil') | 339 homegsutil = join(DART_PATH, 'third_party', 'gsutil', 'gsutil') |
324 gsu = gsutil.GsUtil(False, homegsutil, running_on_buildbot=running_on_buildb
ot) | 340 gsu = gsutil.GsUtil(False, homegsutil, running_on_buildbot=running_on_buildb
ot) |
325 | 341 |
326 print '@@@BUILD_STEP dart-ide dart clients: %s@@@' % options.name | 342 print '@@@BUILD_STEP dart-ide dart clients: %s@@@' % options.name |
327 if sdk_environment.has_key('JAVA_HOME'): | 343 if sdk_environment.has_key('JAVA_HOME'): |
328 print 'JAVA_HOME = {0}'.format(str(sdk_environment['JAVA_HOME'])) | 344 print 'JAVA_HOME = {0}'.format(str(sdk_environment['JAVA_HOME'])) |
329 builder_name = str(options.name) | |
330 | 345 |
331 if (builder_name != 'dart-editor'): | 346 if not PLUGINS_BUILD: |
332 PrintSeparator('running the build of the Dart SDK') | 347 PrintSeparator('running the build of the Dart SDK') |
333 | 348 |
334 EnsureDirectoryExists(buildout) | 349 EnsureDirectoryExists(buildout) |
335 sdk_zip = CreateSDK(buildout) | 350 sdk_zip = CreateSDK(buildout) |
336 | 351 |
337 if (BUILD_OS == 'linux' and builder_name != 'dart-editor'): | 352 if builder_name.startswith('dart-editor-linux'): |
338 CreateApiDocs(buildout) | 353 CreateApiDocs(buildout) |
339 | 354 |
340 if builder_name == 'dart-editor': | 355 if PLUGINS_BUILD: |
341 BuildUpdateSite(ant, revision, options.name, buildroot, buildout, | 356 BuildUpdateSite(ant, revision, options.name, buildroot, buildout, |
342 editorpath, buildos) | 357 editorpath, buildos) |
343 return 0 | 358 return 0 |
344 | 359 |
345 PrintSeparator('running the build to produce the Zipped RCP''s') | 360 PrintSeparator('running the build to produce the Zipped RCP''s') |
346 #tell the ant script where to write the sdk zip file so it can | 361 #tell the ant script where to write the sdk zip file so it can |
347 #be expanded later | 362 #be expanded later |
348 status = ant.RunAnt('.', 'build_rcp.xml', revision, options.name, | 363 status = ant.RunAnt('.', 'build_rcp.xml', revision, options.name, |
349 buildroot, buildout, editorpath, buildos, | 364 buildroot, buildout, editorpath, buildos, |
350 sdk_zip=sdk_zip, | 365 sdk_zip=sdk_zip, |
(...skipping 13 matching lines...) Expand all Loading... |
364 #For the dart-editor build, return at this point. | 379 #For the dart-editor build, return at this point. |
365 #We don't need to install the sdk+dartium, run tests, or copy to google | 380 #We don't need to install the sdk+dartium, run tests, or copy to google |
366 #storage. | 381 #storage. |
367 if not buildos: | 382 if not buildos: |
368 print 'skipping sdk and dartium steps for dart-editor build' | 383 print 'skipping sdk and dartium steps for dart-editor build' |
369 return 0 | 384 return 0 |
370 | 385 |
371 #This is an override for local testing | 386 #This is an override for local testing |
372 force_run_install = os.environ.get('FORCE_RUN_INSTALL') | 387 force_run_install = os.environ.get('FORCE_RUN_INSTALL') |
373 | 388 |
374 if (force_run_install or (builder_name != 'dart-editor')): | 389 if force_run_install or (not PLUGINS_BUILD): |
375 InstallSdk(buildroot, buildout, buildos, buildout) | 390 InstallSdk(buildroot, buildout, buildos, buildout) |
376 InstallDartium(buildroot, buildout, buildos, gsu) | 391 InstallDartium(buildroot, buildout, buildos, gsu) |
377 | 392 |
378 if status: | 393 if status: |
379 return status | 394 return status |
380 | 395 |
381 if not build_skip_tests: | 396 if not build_skip_tests: |
382 PrintSeparator('Running the tests') | 397 PrintSeparator('Running the tests') |
383 junit_status = ant.RunAnt('../com.google.dart.tools.tests.feature_releng', | 398 junit_status = ant.RunAnt('../com.google.dart.tools.tests.feature_releng', |
384 'buildTests.xml', | 399 'buildTests.xml', |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1066 """delete the given file - do not re-throw any exceptions that occur""" | 1081 """delete the given file - do not re-throw any exceptions that occur""" |
1067 if os.path.exists(f): | 1082 if os.path.exists(f): |
1068 try: | 1083 try: |
1069 os.remove(f) | 1084 os.remove(f) |
1070 except: | 1085 except: |
1071 print 'error deleting %s' % f | 1086 print 'error deleting %s' % f |
1072 | 1087 |
1073 | 1088 |
1074 if __name__ == '__main__': | 1089 if __name__ == '__main__': |
1075 sys.exit(main()) | 1090 sys.exit(main()) |
OLD | NEW |