commit e212e6d6dfa330301abf7eec4ad0330397f8d288
Author: Georg Koppen <gk(a)torproject.org>
Date: Wed May 6 12:21:46 2020 +0000
Bug 33973: Create fat GeckoView .aar
Many thanks to boklm for the invaluable help with this patch.
---
projects/geckoview/config | 102 ++++++++++++++++++++++++++++++++++++++++++++++
rbm.conf | 14 +++++++
2 files changed, 116 insertions(+)
diff --git a/projects/geckoview/config b/projects/geckoview/config
index 9270c43..e82139a 100644
--- a/projects/geckoview/config
+++ b/projects/geckoview/config
@@ -28,6 +28,108 @@ var:
# this should be updated when the list of gradle dependencies is changed
gradle_dependencies_version: 1
+steps:
+ merge_aars:
+ filename: 'geckoview-[% c("version") %]-[% c("var/build_id") %].tar.gz'
+ version: '[% c("abbrev") %]'
+ merge_aars: |
+ #!/bin/bash
+ [% c("var/set_default_env") -%]
+ [% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
+ distdir=/var/tmp/dist
+ builddir=/var/tmp/build
+ mkdir -p /var/tmp/build
+ mkdir -p $distdir/[% project %]
+
+ cat > get-moz-build-date << "EOF"
+ [% INCLUDE "get-moz-build-date" %]
+ EOF
+
+ tar -C $distdir -xf [% c('input_files_by_name/node') %]
+ tar -C $distdir -xf [% c('input_files_by_name/python') %]
+ export PATH="/var/tmp/dist/fenix-node/bin:/var/tmp/dist/python/bin:$PATH"
+
+ tar -C $builddir -xf [% c('input_files_by_name/geckoview_armv7') %]
+ tar -C $builddir -xf [% c('input_files_by_name/geckoview_aarch64') %]
+ tar -C $builddir -xf [% c('input_files_by_name/geckoview_x86') %]
+ tar -C $builddir -xf [% c('input_files_by_name/geckoview_x86_64') %]
+ tar -C $builddir -xf [% project %]-[% c('version') %].tar.gz
+
+ # Specify the architectures we want to merge
+ export MOZ_ANDROID_FAT_AAR_ARCHITECTURES=armeabi-v7a,arm64-v8a,x86,x86_64
+ export MOZ_ANDROID_FAT_AAR_ARMEABI_V7A=$builddir/geckoview/*armeabi-v7a*.aar
+ export MOZ_ANDROID_FAT_AAR_ARM64_V8A=$builddir/geckoview/*arm64-v8a*.aar
+ # Specifying just "x86" is not differentiating enough
+ export MOZ_ANDROID_FAT_AAR_X86=$builddir/geckoview/*x86-*.aar
+ export MOZ_ANDROID_FAT_AAR_X86_64=$builddir/geckoview/*x86_64*.aar
+
+ cd $builddir/[% project %]-[% c("version") %]
+ mv -f $rootdir/[% c('input_files_by_name/mozconfig') %] .mozconfig
+
+ eval $(perl $rootdir/get-moz-build-date [% c("var/copyright_year") %] [% c("var/torbrowser_version") %])
+ if [ -z $MOZ_BUILD_DATE ]
+ then
+ echo "MOZ_BUILD_DATE is not set"
+ exit 1
+ fi
+
+ gradle_repo=/var/tmp/dist/gradle-dependencies
+ export GRADLE_MAVEN_REPOSITORIES="file://$gradle_repo"
+ export GRADLE_FLAGS="--no-daemon --offline"
+ mv $rootdir/[% c('input_files_by_name/gradle-dependencies') %] $gradle_repo
+ cp -r $gradle_repo/m2/* $gradle_repo
+
+ # We still need to specify --tor-browser-version due to bug 34005.
+ ./mach configure --with-tor-browser-version=[% c("var/torbrowser_version") %]
+ ./mach build --verbose
+ find obj-* -regex '.*geckoview.*[0-9].\(aar\|pom\)' -exec cp {} $distdir/[% project %] \;
+
+ cd $distdir/
+ [% c('tar', {
+ tar_src => [ project ],
+ tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
+ }) %]
+
+
+ input_files:
+ - project: container-image
+ pkg_type: build
+ - name: '[% c("var/compiler") %]'
+ project: '[% c("var/compiler") %]'
+ pkg_type: build
+ - project: fenix-node
+ name: node
+ pkg_type: build
+ - project: python
+ name: python
+ pkg_type: build
+ - filename: mozconfig-android-all
+ name: mozconfig
+ - filename: 'gradle-dependencies-[% c("var/gradle_dependencies_version") %]'
+ name: gradle-dependencies
+ exec: '[% INCLUDE "fetch-gradle-dependencies" %]'
+ - name: geckoview_armv7
+ project: geckoview
+ pkg_type: build
+ target_prepend:
+ - torbrowser-android-fenix-armv7
+ - name: geckoview_aarch64
+ project: geckoview
+ pkg_type: build
+ target_prepend:
+ - torbrowser-android-fenix-aarch64
+ - name: geckoview_x86
+ project: geckoview
+ pkg_type: build
+ target_prepend:
+ - torbrowser-android-fenix-x86
+ - name: geckoview_x86_64
+ project: geckoview
+ pkg_type: build
+ target_prepend:
+ - torbrowser-android-fenix-x86_64
+
+
targets:
nightly:
git_hash: 'tor-browser-[% c("var/geckoview_version") %]-[% c("var/torbrowser_branch") %]-1'
diff --git a/rbm.conf b/rbm.conf
index 9d74a37..e1376ac 100644
--- a/rbm.conf
+++ b/rbm.conf
@@ -196,6 +196,17 @@ targets:
- zip
- unzip
+ torbrowser-android-all:
+ - android-all
+ # For now we still need both android-fenix and android. We don't need the
+ # prefix for the other -all pieces as they are only used for Fenix anyway.
+ - android-fenix
+ - android
+ android-all:
+ arch: all
+ var:
+ android-all: 1
+ osname: android-all
torbrowser-android-fenix-armv7:
- android-fenix-armv7
- android-armv7
@@ -298,6 +309,9 @@ targets:
container:
suite: buster
arch: amd64
+ disable_network:
+ # Disable network in the script for merging GeckoView .aar files
+ merge_aars: 1
deps:
- build-essential
- python