| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 3 # for details. All rights reserved. Use of this source code is governed by a | 3 # for details. All rights reserved. Use of this source code is governed by a |
| 4 # BSD-style license that can be found in the LICENSE file. | 4 # BSD-style license that can be found in the LICENSE file. |
| 5 | 5 |
| 6 """ | 6 """ |
| 7 Dartium on Android buildbot steps. | 7 Dartium on Android buildbot steps. |
| 8 | 8 |
| 9 Runs steps after the buildbot builds Dartium on Android, | 9 Runs steps after the buildbot builds Dartium on Android, |
| 10 which should upload the APK to an attached device, and run | 10 which should upload the APK to an attached device, and run |
| 11 Dart and chromium tests on it. | 11 Dart and chromium tests on it. |
| 12 """ | 12 """ |
| 13 | 13 |
| 14 import optparse | 14 import optparse |
| 15 import os | 15 import os |
| 16 import string | 16 import string |
| 17 import sys | 17 import sys |
| 18 | 18 |
| 19 import bot | 19 import bot |
| 20 import bot_utils | 20 import bot_utils |
| 21 | 21 |
| 22 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) | 22 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) |
| 23 sys.path.append(os.path.join(SCRIPT_DIR, '..')) | 23 sys.path.append(os.path.join(SCRIPT_DIR, '..')) |
| 24 import utils | 24 import utils |
| 25 | 25 |
| 26 | |
| 27 APK_LOCATION = 'apks/Chrome.apk' | |
| 28 CS_LOCATION = 'apks/ContentShell.apk' | 26 CS_LOCATION = 'apks/ContentShell.apk' |
| 29 | 27 |
| 30 def GetOptionsParser(): | 28 def GetOptionsParser(): |
| 31 parser = optparse.OptionParser("usage: %prog [options]") | 29 parser = optparse.OptionParser("usage: %prog [options]") |
| 32 parser.add_option("--build-products-dir", | 30 parser.add_option("--build-products-dir", |
| 33 help="The directory containing the products of the build.") | 31 help="The directory containing the products of the build.") |
| 34 return parser | 32 return parser |
| 35 | 33 |
| 36 | 34 |
| 37 def UploadSetACL(gsutil, local, remote): | 35 def UploadSetACL(gsutil, local, remote): |
| 38 gsutil.upload(local, remote) | 36 gsutil.upload(local, remote, public=true) |
| 39 gsutil.setGroupReadACL(remote, 'google.com') | 37 |
| 40 gsutil.setContentType(remote, 'application/vnd.android.package-archive') | |
| 41 | |
| 42 | 38 |
| 43 def UploadAPKs(options): | 39 def UploadAPKs(options): |
| 44 with bot.BuildStep('Upload apk'): | 40 with bot.BuildStep('Upload apk'): |
| 45 revision = utils.GetSVNRevision() | 41 revision = utils.GetSVNRevision() |
| 46 namer = bot_utils.GCSNamer(internal=True) | 42 namer = bot_utils.GCSNamer() |
| 47 # The version of gsutil we have on the bots is not new enough to support | |
| 48 # the acl set commands. | |
| 49 bot_utils.GSUtil.USE_DART_REPO_VERSION = True | |
| 50 gsutil = bot_utils.GSUtil() | 43 gsutil = bot_utils.GSUtil() |
| 51 | 44 |
| 52 # Archive dartuim | |
| 53 local = os.path.join(options.build_products_dir, APK_LOCATION) | |
| 54 # TODO(whesse): pass in arch and mode from reciepe | |
| 55 remote = namer.dartium_android_apk_filepath(revision, | |
| 56 'dartium-android', | |
| 57 'arm', | |
| 58 'release') | |
| 59 web_link_prefix = 'https://storage.cloud.google.com/' | 45 web_link_prefix = 'https://storage.cloud.google.com/' |
| 60 dartium_link = string.replace(remote, 'gs://', web_link_prefix) | |
| 61 UploadSetACL(gsutil, local, remote) | |
| 62 print "Uploaded dartium, available from: %s" % dartium_link | |
| 63 | 46 |
| 64 # Archive content shell | 47 # Archive content shell |
| 65 local = os.path.join(options.build_products_dir, CS_LOCATION) | 48 local = os.path.join(options.build_products_dir, CS_LOCATION) |
| 66 # TODO(whesse): pass in arch and mode from reciepe | 49 # TODO(whesse): pass in arch and mode from reciepe |
| 67 remote = namer.dartium_android_apk_filepath(revision, | 50 remote = namer.dartium_android_apk_filepath(revision, |
| 68 'content_shell-android', | 51 'content_shell-android', |
| 69 'arm', | 52 'arm', |
| 70 'release') | 53 'release') |
| 71 content_shell_link = string.replace(remote, 'gs://', web_link_prefix) | 54 content_shell_link = string.replace(remote, 'gs://', web_link_prefix) |
| 72 UploadSetACL(gsutil, local, remote) | 55 UploadSetACL(gsutil, local, remote) |
| 73 print "Uploaded content shell, available from: %s" % content_shell_link | 56 print "Uploaded content shell, available from: %s" % content_shell_link |
| 74 | 57 |
| 75 def main(): | 58 def main(): |
| 76 if sys.platform != 'linux2': | 59 if sys.platform != 'linux2': |
| 77 print "This script was only tested on linux. Please run it on linux!" | 60 print "This script was only tested on linux. Please run it on linux!" |
| 78 sys.exit(1) | 61 sys.exit(1) |
| 79 | 62 |
| 80 parser = GetOptionsParser() | 63 parser = GetOptionsParser() |
| 81 (options, args) = parser.parse_args() | 64 (options, args) = parser.parse_args() |
| 82 | 65 |
| 83 if not options.build_products_dir: | 66 if not options.build_products_dir: |
| 84 print "No build products directory given." | 67 print "No build products directory given." |
| 85 sys.exit(1) | 68 sys.exit(1) |
| 86 | 69 |
| 87 UploadAPKs(options) | 70 UploadAPKs(options) |
| 88 sys.exit(0) | 71 sys.exit(0) |
| 89 | 72 |
| 90 if __name__ == '__main__': | 73 if __name__ == '__main__': |
| 91 main() | 74 main() |
| OLD | NEW |