1# This Source Code Form is subject to the terms of the Mozilla Public 2# License, v. 2.0. If a copy of the MPL was not distributed with this 3# file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 5from __future__ import absolute_import, unicode_literals 6 7import re 8 9from taskgraph.util.scriptworker import generate_beetmover_upstream_artifacts 10 11 12_ARTIFACT_ID_PER_PLATFORM = { 13 'android-aarch64-opt': 'geckoview-default-arm64-v8a', 14 'android-api-16-opt': 'geckoview-default-armeabi-v7a', 15 'android-x86-opt': 'geckoview-default-x86', 16 'android-x86_64-opt': 'geckoview-default-x86_64', 17 'android-geckoview-fat-aar-opt': 'geckoview-default', 18 19 'android-aarch64-shippable': 'geckoview{update_channel}-arm64-v8a', 20 'android-api-16-shippable': 'geckoview{update_channel}-armeabi-v7a', 21 'android-x86-shippable': 'geckoview{update_channel}-x86', 22 'android-x86_64-shippable': 'geckoview{update_channel}-x86_64', 23 'android-geckoview-fat-aar-shippable': 'geckoview{update_channel}', 24} 25 26 27def get_geckoview_upstream_artifacts(config, job, platform=''): 28 if not platform: 29 platform = job['attributes']['build_platform'] 30 upstream_artifacts = generate_beetmover_upstream_artifacts( 31 config, job, platform='', 32 **get_geckoview_template_vars(config, platform, job['attributes'].get('update-channel')) 33 ) 34 return [{ 35 key: value for key, value in upstream_artifact.items() 36 if key != 'locale' 37 } for upstream_artifact in upstream_artifacts] 38 39 40def get_geckoview_template_vars(config, platform, update_channel): 41 version_groups = re.match(r'(\d+).(\d+).*', config.params['version']) 42 if version_groups: 43 major_version, minor_version = version_groups.groups() 44 45 return { 46 'artifact_id': get_geckoview_artifact_id( 47 config, platform, update_channel, 48 ), 49 'build_date': config.params['moz_build_date'], 50 'major_version': major_version, 51 'minor_version': minor_version, 52 } 53 54 55def get_geckoview_artifact_id(config, platform, update_channel=None): 56 if update_channel == 'release': 57 update_channel = '' 58 elif update_channel is not None: 59 update_channel = '-{}'.format(update_channel) 60 else: 61 # For shippable builds, mozharness defaults to using 62 # "nightly-{project}" for the update channel. For other builds, the 63 # update channel is not set, but the value is not substituted. 64 update_channel = '-nightly-{}'.format(config.params['project']) 65 return _ARTIFACT_ID_PER_PLATFORM[platform].format(update_channel=update_channel) 66