Bug 1563711 - Remove target.maven.zip r=nalexander

Differential Revision: https://phabricator.services.mozilla.com/D38175

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Johan Lorenzo 2019-07-30 15:35:12 +00:00
Родитель 7826afea3a
Коммит 13648fa0df
11 изменённых файлов: 309 добавлений и 194 удалений

Просмотреть файл

@ -159,8 +159,13 @@ endif
ifdef MOZ_ANDROID_FAT_AAR_ARCHITECTURES
recurse_android-fat-aar-artifact:
$(call py_action,fat_aar,$(MOZ_ANDROID_FAT_AAR_ARCHITECTURES) --distdir $(abspath $(DIST)/fat-aar))
endif # MOZ_ANDROID_FAT_AAR_ARCHITECTURES
$(call py_action,fat_aar,\
$(if $(MOZ_ANDROID_FAT_AAR_ARMEABI_V7A),--armeabi-v7a $(MOZ_ANDROID_FAT_AAR_ARMEABI_V7A)) \
$(if $(MOZ_ANDROID_FAT_AAR_ARM64_V8A),--arm64-v8a $(MOZ_ANDROID_FAT_AAR_ARM64_V8A)) \
$(if $(MOZ_ANDROID_FAT_AAR_X86),--x86 $(MOZ_ANDROID_FAT_AAR_X86)) \
$(if $(MOZ_ANDROID_FAT_AAR_X86_64),--x86-64 $(MOZ_ANDROID_FAT_AAR_X86_64)) \
--distdir $(abspath $(DIST)/fat-aar))
endif
ifdef MOZ_WIDGET_TOOLKIT
ifdef ENABLE_TESTS

Просмотреть файл

@ -9,8 +9,6 @@ import logging
import os
import json
from zipfile import ZipFile
import mozpack.path as mozpath
from mozbuild.base import (
@ -401,14 +399,7 @@ class MachCommands(MachCommandBase):
self.substs['GRADLE_ANDROID_ARCHIVE_GECKOVIEW_TASKS'] + args,
verbose=True)
if ret != 0:
return ret
# TODO Bug 1563711 - Remove target.maven.zip
# The zip archive is passed along in CI to ship geckoview onto a maven repo
_craft_maven_zip_archive(self.topobjdir)
return 0
return ret
@SubCommand('android', 'build-geckoview_example',
"""Build geckoview_example """)
@ -706,26 +697,6 @@ class MachCommands(MachCommandBase):
return 0
def _get_maven_archive_abs_and_relative_paths(maven_folder):
for subdir, _, files in os.walk(maven_folder):
for file in files:
full_path = os.path.join(subdir, file)
relative_path = os.path.relpath(full_path, maven_folder)
# maven-metadata is intended to be generated on the real maven server
if 'maven-metadata.xml' not in relative_path:
yield full_path, relative_path
def _craft_maven_zip_archive(topobjdir):
geckoview_folder = os.path.join(topobjdir, 'gradle/build/mobile/android/geckoview')
maven_folder = os.path.join(geckoview_folder, 'maven')
with ZipFile(os.path.join(geckoview_folder, 'target.maven.zip'), 'w') as target_zip:
for abs, rel in _get_maven_archive_abs_and_relative_paths(maven_folder):
target_zip.write(abs, arcname=rel)
@CommandProvider
class AndroidEmulatorCommands(MachCommandBase):
"""

Просмотреть файл

@ -10,8 +10,6 @@ compatibility, and ready inputs to an Android multi-architecture fat AAR build.
from __future__ import absolute_import, unicode_literals, print_function
import argparse
import buildconfig
import subprocess
import sys
from collections import (
@ -29,38 +27,9 @@ from mozpack.packager.unpack import UnpackFinder
import mozpack.path as mozpath
def _download_zips(distdir, architectures):
# The mapping from Android CPU architecture to TC job is defined here, and the TC index
# lookup is mediated by python/mozbuild/mozbuild/artifacts.py and
# python/mozbuild/mozbuild/artifact_builds.py.
jobs = {
'arm64-v8a': 'android-aarch64-opt',
'armeabi-v7a': 'android-api-16-opt',
'x86': 'android-x86-opt',
'x86_64': 'android-x86_64-opt',
}
for arch in architectures:
# It's unfortunate that we must couple tightly, but that's the current API for
# dispatching. In automation, MOZ_ARTIFACT_TASK* environment variables will ensure
# that the correct tasks are chosen as install sources.
subprocess.check_call([sys.executable, mozpath.join(buildconfig.topsrcdir, 'mach'),
'artifact', 'install',
'--job', jobs[arch],
'--distdir', mozpath.join(distdir, 'input', arch),
'--no-tests', '--no-process', '--maven-zip'])
def fat_aar(distdir, architectures=[],
no_download=False, no_process=False, no_compatibility_check=False,
rewrite_old_archives=False):
if not no_download:
_download_zips(distdir, architectures)
else:
print('Not downloading architecture-specific artifact Maven zips.')
def fat_aar(distdir, aars_paths, no_process=False, no_compatibility_check=False):
if no_process:
print('Not processing architecture-specific artifact Maven zips.')
print('Not processing architecture-specific artifact Maven AARs.')
return 0
# Map {filename: {fingerprint: [arch1, arch2, ...]}}.
@ -69,7 +38,7 @@ def fat_aar(distdir, architectures=[],
# Collect multi-architecture inputs to the fat AAR.
copier = FileCopier()
for arch in architectures:
for arch, aar_path in aars_paths.items():
# Map old non-architecture-specific path to new architecture-specific path.
old_rewrite_map = {
'greprefs.js': '{}/greprefs.js'.format(arch),
@ -80,16 +49,7 @@ def fat_aar(distdir, architectures=[],
arch_prefs = set(old_rewrite_map.values())
missing_arch_prefs |= set(arch_prefs)
path = mozpath.join(distdir, 'input', arch, 'target.maven.zip')
aars = list(JarFinder(path, JarReader(path)).find('**/geckoview-*.aar'))
if len(aars) != 1:
raise ValueError('Maven zip "{path}" with more than one candidate AAR found: {aars}'
.format(path=path, aars=tuple(sorted(p for p, _ in aars))))
[aar_path, aar_file] = aars[0]
jar_finder = JarFinder(aar_file.file.filename, JarReader(fileobj=aar_file.open()))
jar_finder = JarFinder(aar_path, JarReader(aar_path))
for path, fileobj in UnpackFinder(jar_finder):
# Native libraries go straight through.
if mozpath.match(path, 'jni/**'):
@ -98,14 +58,6 @@ def fat_aar(distdir, architectures=[],
elif path in arch_prefs:
copier.add(path, fileobj)
elif rewrite_old_archives and path in old_rewrite_map:
# Ease testing during transition by allowing old omnijars that don't have
# architecture-specific files yet.
new_path = old_rewrite_map[path]
print('Rewrote old path "{path}" to new path "{new_path}"'.format(
path=path, new_path=new_path))
copier.add(new_path, fileobj)
elif path in ('classes.jar', 'annotations.zip'):
# annotations.zip differs due to timestamps, but the contents should not.
@ -172,36 +124,49 @@ def fat_aar(distdir, architectures=[],
if not no_compatibility_check and (missing_arch_prefs or not_allowed):
return 1
copier.copy(mozpath.join(distdir, 'output'))
output_dir = mozpath.join(distdir, 'output')
copier.copy(output_dir)
return 0
_ALL_ARCHS = ('armeabi-v7a', 'arm64-v8a', 'x86_64', 'x86')
def main(argv):
description = '''Fetch and unpack architecture-specific Maven zips, verify cross-architecture
description = '''Unpack architecture-specific Maven AARs, verify cross-architecture
compatibility, and ready inputs to an Android multi-architecture fat AAR build.'''
parser = argparse.ArgumentParser(description=description)
parser.add_argument('--no-download', action='store_true',
help='Do not fetch Maven zips.')
parser.add_argument('--no-process', action='store_true',
help='Do not process Maven zips.')
help='Do not process Maven AARs.')
parser.add_argument('--no-compatibility-check', action='store_true',
help='Do not fail if Maven zips are not compatible.')
parser.add_argument('--rewrite-old-archives', action='store_true',
help='Rewrite Maven zips containing omnijars that do not contain '
'architecture-specific preference files.')
help='Do not fail if Maven AARs are not compatible.')
parser.add_argument('--distdir', required=True)
parser.add_argument('architectures', nargs='+',
choices=('armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'))
for arch in _ALL_ARCHS:
command_line_flag = arch.replace('_', '-')
parser.add_argument('--{}'.format(command_line_flag), dest=arch)
args = parser.parse_args(argv)
args_dict = vars(args)
aars_paths = {
arch: args_dict.get(arch)
for arch in _ALL_ARCHS
if args_dict.get(arch)
}
if not aars_paths:
raise ValueError('You must provide at least one AAR file!')
return fat_aar(
args.distdir, architectures=args.architectures,
no_download=args.no_download, no_process=args.no_process,
no_compatibility_check=args.no_compatibility_check,
rewrite_old_archives=args.rewrite_old_archives)
args.distdir,
aars_paths,
no_process=args.no_process,
no_compatibility_check=args.no_compatibility_check
)
if __name__ == '__main__':

Просмотреть файл

@ -0,0 +1,122 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
---
loader: taskgraph.loader.transform:loader
kind-dependencies:
- build
- toolchain
transforms:
- taskgraph.transforms.build:transforms
- taskgraph.transforms.build_attrs:transforms
- taskgraph.transforms.build_lints:transforms
- taskgraph.transforms.build_fat_aar:transforms
- taskgraph.transforms.use_toolchains:transforms
- taskgraph.transforms.job:transforms
- taskgraph.transforms.task:transforms
job-defaults:
attributes:
artifact_map: taskcluster/taskgraph/manifests/fennec_geckoview.yml
index:
product: mobile
fetches: {} # See build_fat_aar transform
worker-type: b-linux
worker:
docker-image: {in-tree: android-build}
max-run-time: 7200
env:
# Online in order to download the per-architecture AARs.
GRADLE_USER_HOME: "/builds/worker/workspace/build/src/mobile/android/gradle/dotgradle-online"
TOOLTOOL_MANIFEST: "mobile/android/config/tooltool-manifests/android/releng.manifest"
MOZ_ANDROID_FAT_AAR_ARCHITECTURES: "armeabi-v7a,arm64-v8a,x86,x86_64"
artifacts:
- name: public/build/maven
path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/geckoview/maven/
type: directory
- name: public/build
path: /builds/worker/artifacts/
type: directory
run:
using: mozharness
script: "mozharness/scripts/fx_desktop_build.py"
secrets: true
mozconfig-variant: null
tooltool-downloads: internal
custom-build-variant-cfg: api-16
# Note: These settings are only honored by nightly (i.e. shipping) builds
update-channel:
by-release-type:
nightly: nightly
nightly-oak: nightly-oak
beta:
by-shipping-product:
devedition: aurora
default: beta
release.*: release
esr.*: esr
default: null
toolchains:
- android-gradle-dependencies
- android-ndk-linux
- android-sdk-linux
- linux64-clang
- linux64-rust-android
- linux64-rust-size
- linux64-cbindgen
- linux64-nasm
- linux64-node
jobs:
android-geckoview-fat-aar/opt:
description: "Android GeckoView multi-architecture fat AAR Opt"
index:
job-name: android-geckoview-fat-aar-opt
treeherder:
platform: android-4-0-geckoview-fat-aar/opt
symbol: Bgv
dependencies:
android-x86-opt: build-android-x86/opt
android-x86_64-opt: build-android-x86_64/opt
android-api-16-opt: build-android-api-16/opt
android-aarch64-opt: build-android-aarch64/opt
worker:
env:
PERFHERDER_EXTRA_OPTIONS: android-geckoview-fat-aar-opt
USE_ARTIFACT: '1'
MOZ_ARTIFACT_TASK: {task-reference: '<android-api-16-opt>'}
run:
actions: [get-secrets, build]
config: ["builds/releng_base_android_64_builds.py"]
toolchains:
- linux64-sccache
android-geckoview-fat-aar-nightly/opt:
description: "Android GeckoView multi-architecture fat AAR Nightly"
attributes:
nightly: true
enable-full-crashsymbols: true
disable-push-apk: true
shipping-phase: build
shipping-product: fennec
index:
job-name: android-geckoview-fat-aar-nightly
type: nightly-with-multi-l10n
treeherder:
platform: android-4-0-geckoview-fat-aar/opt
symbol: Ngv
dependencies:
android-x86-nightly: build-android-x86-nightly/opt
android-x86_64-nightly: build-android-x86_64-nightly/opt
android-api-16-nightly: build-android-api-16-nightly/opt
android-aarch64-nightly: build-android-aarch64-nightly/opt
worker:
env:
PERFHERDER_EXTRA_OPTIONS: android-geckoview-fat-aar-nightly
run:
actions: [get-secrets, build, multi-l10n]
config:
- builds/releng_base_android_64_builds.py
- taskcluster_nightly.py

Просмотреть файл

@ -12,3 +12,4 @@ transforms:
kind-dependencies:
- build
- build-fat-aar

Просмотреть файл

@ -13,10 +13,6 @@ job-defaults:
env:
GRADLE_USER_HOME: "/builds/worker/workspace/build/src/mobile/android/gradle/dotgradle-offline"
artifacts:
# TODO Bug 1563711 - Remove target.maven.zip
- name: public/build/target.maven.zip
path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/geckoview/target.maven.zip
type: file
- name: public/build/maven
path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/geckoview/maven/
type: directory
@ -515,74 +511,3 @@ android-x86_64-gcp/debug:
custom-build-variant-cfg: x86_64-debug
toolchains:
- linux64-sccache
android-geckoview-fat-aar/opt:
description: "Android GeckoView multi-architecture fat AAR Opt"
index:
job-name: android-geckoview-fat-aar-opt
treeherder:
platform: android-4-0-geckoview-fat-aar/opt
symbol: Bgv
worker-type: b-linux
dependencies:
android-x86-opt: build-android-x86/opt
android-x86_64-opt: build-android-x86_64/opt
android-api-16-opt: build-android-api-16/opt
android-aarch64-opt: build-android-aarch64/opt
worker:
env:
# Online in order to download the per-architecture AARs.
GRADLE_USER_HOME: "/builds/worker/workspace/build/src/mobile/android/gradle/dotgradle-online"
TOOLTOOL_MANIFEST: "mobile/android/config/tooltool-manifests/android/releng.manifest"
PERFHERDER_EXTRA_OPTIONS: android-geckoview-fat-aar-opt
MOZ_ANDROID_FAT_AAR_ARCHITECTURES: 'armeabi-v7a,arm64-v8a,x86,x86_64'
USE_ARTIFACT: '1'
MOZ_ARTIFACT_TASK: {task-reference: '<android-api-16-opt>'}
MOZ_ARTIFACT_TASK_ANDROID_API_16_OPT: {task-reference: '<android-api-16-opt>'}
MOZ_ARTIFACT_TASK_ANDROID_AARCH64_OPT: {task-reference: '<android-aarch64-opt>'}
MOZ_ARTIFACT_TASK_ANDROID_X86_OPT: {task-reference: '<android-x86-opt>'}
MOZ_ARTIFACT_TASK_ANDROID_X86_64_OPT: {task-reference: '<android-x86_64-opt>'}
run:
actions: [get-secrets, build]
config: ["builds/releng_base_android_64_builds.py"]
custom-build-variant-cfg: api-16
toolchains:
- linux64-sccache
android-geckoview-fat-aar-nightly/opt:
description: "Android GeckoView multi-architecture fat AAR Nightly"
attributes:
nightly: true
enable-full-crashsymbols: true
disable-push-apk: true
shipping-phase: build
shipping-product: fennec
index:
job-name: android-geckoview-fat-aar-nightly
type: nightly-with-multi-l10n
treeherder:
platform: android-4-0-geckoview-fat-aar/opt
symbol: Ngv
worker-type: b-linux
dependencies:
android-x86-opt: build-android-x86-nightly/opt
android-x86_64-opt: build-android-x86_64-nightly/opt
android-api-16-opt: build-android-api-16-nightly/opt
android-aarch64-opt: build-android-aarch64-nightly/opt
worker:
env:
# Online in order to download the per-architecture AARs.
GRADLE_USER_HOME: "/builds/worker/workspace/build/src/mobile/android/gradle/dotgradle-online"
TOOLTOOL_MANIFEST: "mobile/android/config/tooltool-manifests/android/releng.manifest"
PERFHERDER_EXTRA_OPTIONS: android-geckoview-fat-aar-nightly
MOZ_ANDROID_FAT_AAR_ARCHITECTURES: 'armeabi-v7a,arm64-v8a,x86,x86_64'
MOZ_ARTIFACT_TASK_ANDROID_API_16_OPT: {task-reference: '<android-api-16-opt>'}
MOZ_ARTIFACT_TASK_ANDROID_AARCH64_OPT: {task-reference: '<android-aarch64-opt>'}
MOZ_ARTIFACT_TASK_ANDROID_X86_OPT: {task-reference: '<android-x86-opt>'}
MOZ_ARTIFACT_TASK_ANDROID_X86_64_OPT: {task-reference: '<android-x86_64-opt>'}
run:
actions: [get-secrets, build, multi-l10n]
config:
- builds/releng_base_android_64_builds.py
- taskcluster_nightly.py
custom-build-variant-cfg: api-16

Просмотреть файл

@ -11,6 +11,22 @@ users or automated tests. This is more restrictive than most definitions of
"build" in a Mozilla context: it does not include tasks that run build-like
actions for static analysis or to produce instrumented artifacts.
build-fat-aar
-------------
Build architecture-independent GeckoView AAR (Android ARchive) files. This build-like tasks is an
artifact build (ARMv7, but this is arbitrary) that itself depends on arch-specific Android build
jobs. It fetches arch-specific AAR files, extracts arch-specific libraries and preference files,
and then assembles a multi-architecture "fat AAR". Downstream consumers are expected to use
per-ABI feature splits to produce arch-specific APKs.
If you want to run this task locally, you need to specify these environment variable:
- MOZ_ANDROID_FAT_AAR_ARCHITECTURES: must be a comma-separated list of architecture.
Eg: "armeabi-v7a,arm64-v8a,x86,x86_64".
- each of MOZ_ANDROID_FAT_AAR_ARM64_V8A, MOZ_ANDROID_FAT_AAR_ARMEABI_V7A,
MOZ_ANDROID_FAT_AAR_X86, MOZ_ANDROID_FAT_AAR_X86_64 must be an absolute path to the
architecture-specific AAR.
build-signing
-------------

Просмотреть файл

@ -23,7 +23,9 @@ default: &default
mapping:
${artifact_id}-${major_version}.${minor_version}.${build_date}.aar:
<<: *default
from: ['build']
from:
- build
- build-fat-aar
pretty_name: ${artifact_id}-${major_version}.${minor_version}.${build_date}.aar
checksums_path: ${artifact_id}-${major_version}.${minor_version}.${build_date}.aar
${artifact_id}-${major_version}.${minor_version}.${build_date}.aar.asc:
@ -33,17 +35,23 @@ mapping:
checksums_path: ${artifact_id}-${major_version}.${minor_version}.${build_date}.aar.asc
${artifact_id}-${major_version}.${minor_version}.${build_date}.aar.md5:
<<: *default
from: ['build']
from:
- build
- build-fat-aar
pretty_name: ${artifact_id}-${major_version}.${minor_version}.${build_date}.aar.md5
checksums_path: ${artifact_id}-${major_version}.${minor_version}.${build_date}.aar.md5
${artifact_id}-${major_version}.${minor_version}.${build_date}.aar.sha1:
<<: *default
from: ['build']
from:
- build
- build-fat-aar
pretty_name: ${artifact_id}-${major_version}.${minor_version}.${build_date}.aar.sha1
checksums_path: ${artifact_id}-${major_version}.${minor_version}.${build_date}.aar.sha1
${artifact_id}-${major_version}.${minor_version}.${build_date}.pom:
<<: *default
from: ['build']
from:
- build
- build-fat-aar
pretty_name: ${artifact_id}-${major_version}.${minor_version}.${build_date}.pom
checksums_path: ${artifact_id}-${major_version}.${minor_version}.${build_date}.pom
${artifact_id}-${major_version}.${minor_version}.${build_date}.pom.asc:
@ -53,17 +61,23 @@ mapping:
checksums_path: ${artifact_id}-${major_version}.${minor_version}.${build_date}.pom.asc
${artifact_id}-${major_version}.${minor_version}.${build_date}.pom.md5:
<<: *default
from: ['build']
from:
- build
- build-fat-aar
pretty_name: ${artifact_id}-${major_version}.${minor_version}.${build_date}.pom.md5
checksums_path: ${artifact_id}-${major_version}.${minor_version}.${build_date}.pom.md5
${artifact_id}-${major_version}.${minor_version}.${build_date}.pom.sha1:
<<: *default
from: ['build']
from:
- build
- build-fat-aar
pretty_name: ${artifact_id}-${major_version}.${minor_version}.${build_date}.pom.sha1
checksums_path: ${artifact_id}-${major_version}.${minor_version}.${build_date}.pom.sha1
${artifact_id}-${major_version}.${minor_version}.${build_date}-javadoc.jar:
<<: *default
from: ['build']
from:
- build
- build-fat-aar
pretty_name: ${artifact_id}-${major_version}.${minor_version}.${build_date}-javadoc.jar
checksums_path: ${artifact_id}-${major_version}.${minor_version}.${build_date}-javadoc.jar
${artifact_id}-${major_version}.${minor_version}.${build_date}-javadoc.jar.asc:
@ -73,17 +87,23 @@ mapping:
checksums_path: ${artifact_id}-${major_version}.${minor_version}.${build_date}-javadoc.jar.asc
${artifact_id}-${major_version}.${minor_version}.${build_date}-javadoc.jar.md5:
<<: *default
from: ['build']
from:
- build
- build-fat-aar
pretty_name: ${artifact_id}-${major_version}.${minor_version}.${build_date}-javadoc.jar.md5
checksums_path: ${artifact_id}-${major_version}.${minor_version}.${build_date}-javadoc.jar.md5
${artifact_id}-${major_version}.${minor_version}.${build_date}-javadoc.jar.sha1:
<<: *default
from: ['build']
from:
- build
- build-fat-aar
pretty_name: ${artifact_id}-${major_version}.${minor_version}.${build_date}-javadoc.jar.sha1
checksums_path: ${artifact_id}-${major_version}.${minor_version}.${build_date}-javadoc.jar.sha1
${artifact_id}-${major_version}.${minor_version}.${build_date}-sources.jar:
<<: *default
from: ['build']
from:
- build
- build-fat-aar
pretty_name: ${artifact_id}-${major_version}.${minor_version}.${build_date}-sources.jar
checksums_path: ${artifact_id}-${major_version}.${minor_version}.${build_date}-sources.jar
${artifact_id}-${major_version}.${minor_version}.${build_date}-sources.jar.asc:
@ -93,11 +113,15 @@ mapping:
checksums_path: ${artifact_id}-${major_version}.${minor_version}.${build_date}-sources.jar.asc
${artifact_id}-${major_version}.${minor_version}.${build_date}-sources.jar.md5:
<<: *default
from: ['build']
from:
- build
- build-fat-aar
pretty_name: ${artifact_id}-${major_version}.${minor_version}.${build_date}-sources.jar.md5
checksums_path: ${artifact_id}-${major_version}.${minor_version}.${build_date}-sources.jar.md5
${artifact_id}-${major_version}.${minor_version}.${build_date}-sources.jar.sha1:
<<: *default
from: ['build']
from:
- build
- build-fat-aar
pretty_name: ${artifact_id}-${major_version}.${minor_version}.${build_date}-sources.jar.sha1
checksums_path: ${artifact_id}-${major_version}.${minor_version}.${build_date}-sources.jar.sha1

Просмотреть файл

@ -0,0 +1,73 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import, print_function, unicode_literals
import copy
import os
from taskgraph.transforms.base import TransformSequence
from taskgraph.transforms.job import get_default_moz_fetches_dir
from taskgraph.util.declarative_artifacts import get_geckoview_upstream_artifacts
from taskgraph.util.taskcluster import get_artifact_prefix
transforms = TransformSequence()
MOZ_ANDROID_FAT_AAR_ENV_MAP = {
'android-api-16-nightly': 'MOZ_ANDROID_FAT_AAR_ARMEABI_V7A',
'android-aarch64-nightly': 'MOZ_ANDROID_FAT_AAR_ARM64_V8A',
'android-x86-nightly': 'MOZ_ANDROID_FAT_AAR_X86',
'android-x86_64-nightly': 'MOZ_ANDROID_FAT_AAR_X86_64',
'android-api-16-opt': 'MOZ_ANDROID_FAT_AAR_ARMEABI_V7A',
'android-aarch64-opt': 'MOZ_ANDROID_FAT_AAR_ARM64_V8A',
'android-x86-opt': 'MOZ_ANDROID_FAT_AAR_X86',
'android-x86_64-opt': 'MOZ_ANDROID_FAT_AAR_X86_64',
}
@transforms.add
def set_fetches_and_locations(config, jobs):
"""Set defaults, including those that differ per worker implementation"""
for job in jobs:
dependencies = copy.deepcopy(job['dependencies'])
for platform, label in dependencies.items():
job['dependencies'] = {'build': label}
aar_location = _get_aar_location(config, job, platform)
prefix = get_artifact_prefix(job)
if not prefix.endswith('/'):
prefix = prefix + '/'
if aar_location.startswith(prefix):
aar_location = aar_location[len(prefix):]
job['fetches'][platform] = [{
'artifact': aar_location,
'extract': False,
}]
aar_file_name = aar_location.split('/')[-1]
env_var = MOZ_ANDROID_FAT_AAR_ENV_MAP[platform]
job['worker']['env'][env_var] = os.path.join(
get_default_moz_fetches_dir(job), aar_file_name
)
job['dependencies'] = dependencies
yield job
def _get_aar_location(config, job, platform):
artifacts_locations = get_geckoview_upstream_artifacts(config, job, platform=platform)
aar_locations = [
path for path in artifacts_locations[0]['paths']
if path.endswith('.aar')
]
if len(aar_locations) != 1:
raise ValueError('Only a single AAR must be given. Got: {}'.format(aar_locations))
return aar_locations[0]

Просмотреть файл

@ -228,12 +228,21 @@ def use_fetches(config, jobs):
env = worker.setdefault('env', {})
env['MOZ_FETCHES'] = {'task-reference': json.dumps(job_fetches, sort_keys=True)}
env.setdefault('MOZ_FETCHES_DIR', 'fetches')
env.setdefault('MOZ_FETCHES_DIR', get_default_moz_fetches_dir(job))
yield job
def get_default_moz_fetches_dir(job):
if job.get('worker', {}).get('os') in ('windows', 'macosx'):
moz_fetches_dir = 'fetches'
else:
workdir = job['run'].get('workdir', '/builds/worker')
moz_fetches_dir = '{}/fetches'.format(workdir)
return moz_fetches_dir
@transforms.add
def make_task_description(config, jobs):
"""Given a build description, create a task description"""

Просмотреть файл

@ -6,6 +6,12 @@ from taskgraph.util.scriptworker import generate_beetmover_upstream_artifacts
_ARTIFACT_ID_PER_PLATFORM = {
'android-aarch64-opt': 'geckoview-default-arm64-v8a',
'android-api-16-opt': 'geckoview-default-armeabi-v7a',
'android-x86-opt': 'geckoview-default-x86',
'android-x86_64-opt': 'geckoview-default-x86_64',
'android-geckoview-fat-aar-opt': 'geckoview-default',
'android-aarch64-nightly': 'geckoview{update_channel}-arm64-v8a',
'android-api-16-nightly': 'geckoview{update_channel}-armeabi-v7a',
'android-x86-nightly': 'geckoview{update_channel}-x86',
@ -14,14 +20,12 @@ _ARTIFACT_ID_PER_PLATFORM = {
}
def get_geckoview_upstream_artifacts(config, job):
def get_geckoview_upstream_artifacts(config, job, platform=''):
if not platform:
platform = job['attributes']['build_platform']
upstream_artifacts = generate_beetmover_upstream_artifacts(
config, job, platform='',
**get_geckoview_template_vars(
config,
job['attributes']['build_platform'],
job['attributes'].get('update-channel'),
)
**get_geckoview_template_vars(config, platform, job['attributes'].get('update-channel'))
)
return [{
key: value for key, value in upstream_artifact.items()