Unverified Commit 2d6b8302 authored by Georg Koppen's avatar Georg Koppen
Browse files

Bug 34101: Add application-services

parent 933d4b89
This diff is collapsed.
#!/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/[% project %]
builddir=/var/tmp/build/[% project %]
mkdir $distdir
mkdir /var/tmp/build
cd /var/tmp/dist
[% FOREACH arch = ['armv7', 'aarch64', 'x86', 'x86_64'] -%]
# The host (i.e. Linux) bits should be the same for all four targets. Thus,
# extracting all input files into the same place should give us a working host
# part with all the needed target architectures.
tar -xf $rootdir/[% c('input_files_by_name/rust-' _ arch) %]
tar -xf $rootdir/[% c('input_files_by_name/nss-' _ arch) %]
mv nss nss-[% arch %]
tar -xf $rootdir/[% c('input_files_by_name/sqlcipher-' _ arch) %]
mv sqlcipher sqlcipher-[% arch %]
[% END -%]
export PATH=/var/tmp/dist/fenix-rust/bin:$PATH
cd $rootdir
# application-services uses a newer NDK, 21, than everything else...
export ANDROID_NDK_HOME=/var/tmp/dist/[% c('var/compiler') %]/android-ndk/android-ndk-r[% pc('fenix-android-toolchain', 'var/android_ndk_version') %][% pc('fenix-android-toolchain', 'var/android_ndk_revision') %]
# We need to add the new path to our build tools to PATH.
export PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
export ANDROID_NDK_ROOT=$ANDROID_NDK_HOME
export ANDROID_NDK_API_VERSION=[% pc("fenix-android-toolchain", "var/android_ndk_version") %][% pc('fenix-android-toolchain', 'var/android_ndk_revision') %]
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64
[% IF !c('var/fetch_gradle_dependencies') %]
gradle_repo=$rootdir/[% c('input_files_by_name/gradle-dependencies') %]
cp -r $gradle_repo/dl/android/maven2/* $gradle_repo
cp -r $gradle_repo/m2/* $gradle_repo
cp -r $gradle_repo/maven2/* $gradle_repo
[% END %]
tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz
# Prepare the offline build.
# Move the directory for hardcoding the path in .cargo/config.
mv /var/tmp/build/[% project %]-[% c('version') %] $builddir
tar -C $builddir -xjf application-services-vendor-[% c('var/rust_vendor_version') %].tar.bz2
cd $builddir
# Make sure our vendored crates are used for offline builds.
cat >> .cargo/config << 'EOF'
[source.crates-io]
replace-with = "vendored-sources"
[source.vendored-sources]
directory = "/var/tmp/build/application-services/vendor"
[net]
offline=true
EOF
# Move NSS and SQLCipher to the right place
# XXX: Maybe merge with the loop above.
archs="armv7 aarch64 x86 x86_64"
for a in $archs
do
if [ "$a" == "armv7" ]
then
mkdir -p libs/android/armeabi-v7a
mv /var/tmp/dist/nss-$a libs/android/armeabi-v7a/nss
mv /var/tmp/dist/sqlcipher-$a libs/android/armeabi-v7a/sqlcipher
elif [ "$a" == "aarch64" ]
then
mkdir -p libs/android/arm64-v8a
mv /var/tmp/dist/nss-$a libs/android/arm64-v8a/nss
mv /var/tmp/dist/sqlcipher-$a libs/android/arm64-v8a/sqlcipher
else
mkdir -p libs/android/$a
mv /var/tmp/dist/nss-$a libs/android/$a/nss
mv /var/tmp/dist/sqlcipher-$a libs/android/$a/sqlcipher
fi
done
patch -p1 < $rootdir/no-git.patch
# XXX: We don't build the code for Linux for now as this involves additional
# complexity. That's needed for running unit tests later on, though.
patch -p1 < $rootdir/target.patch
patch -p1 < $rootdir/1651660.patch
[% IF c('var/fetch_gradle_dependencies') %]
# XXX: `assemble` is still not enough to see all fetched dependencies via
# Gradle's --debug. See: tor-browser-build#40056.
$GRADLE_HOME/gradle-6.3/bin/gradle --debug --no-daemon assemble
[% ELSE %]
patch -p1 < $rootdir/mavenLocal.patch
gradle_flags="--offline --no-daemon -Dmaven.repo.local=$gradle_repo"
$GRADLE_HOME/gradle-6.3/bin/gradle $gradle_flags assembleRelease
$GRADLE_HOME/gradle-6.3/bin/gradle $gradle_flags publish
cd build
find maven -regex '.*[0-9].\(aar\|pom\)' -exec cp --parents {} $distdir \;
cd /var/tmp/dist
[% c('tar', {
tar_src => [ project ],
tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
}) %]
[% END %]
# vim: filetype=yaml sw=2
filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %].tar.gz'
version: 61.0.10
git_hash: 2478bcf2b48d1867b01e8b7df4f86a69d564d49a # v61.0.10
git_url: https://github.com/mozilla/application-services
var:
container:
use_container: 1
# This should be updated when the list of gradle dependencies is changed.
gradle_dependencies_version: 1
# This should be updated when the list of rust dependencies is changed.
rust_vendor_version: 1
# For armv7 we need a different target than the default one we use for
# GeckoView. We set this variable so the Rust project in the `input_files`
# below can set the correct target when built for use in this project,
# querying `origin_project`.
application_services: 1
# Switch to make it easier to grab all dependencies during a dry-run.
fetch_gradle_dependencies: 0
input_files:
- project: container-image
- project: '[% c("var/compiler") %]'
name: '[% c("var/compiler") %]'
- project: fenix-rust
name: rust-armv7
target_prepend:
- torbrowser-android-fenix-armv7
- project: fenix-rust
name: rust-aarch64
target_prepend:
- torbrowser-android-fenix-aarch64
- project: fenix-rust
name: rust-x86
target_prepend:
- torbrowser-android-fenix-x86
- project: fenix-rust
name: rust-x86_64
target_prepend:
- torbrowser-android-fenix-x86_64
- project: nss
name: nss-armv7
target_prepend:
- torbrowser-android-fenix-armv7
- project: nss
name: nss-aarch64
target_prepend:
- torbrowser-android-fenix-aarch64
- project: nss
name: nss-x86
target_prepend:
- torbrowser-android-fenix-x86
- project: nss
name: nss-x86_64
target_prepend:
- torbrowser-android-fenix-x86_64
- project: sqlcipher
name: sqlcipher-armv7
target_prepend:
- torbrowser-android-fenix-armv7
- project: sqlcipher
name: sqlcipher-aarch64
target_prepend:
- torbrowser-android-fenix-aarch64
- project: sqlcipher
name: sqlcipher-x86
target_prepend:
- torbrowser-android-fenix-x86
- project: sqlcipher
name: sqlcipher-x86_64
target_prepend:
- torbrowser-android-fenix-x86_64
- filename: 'gradle-dependencies-[% c("var/gradle_dependencies_version") %]'
name: gradle-dependencies
exec: '[% INCLUDE "fetch-gradle-dependencies" %]'
enable: '[% !c("var/fetch_gradle_dependencies") %]'
# `cargo vendor vendor` in the `application-services` directory has vendored
# the sources.
- URL: https://people.torproject.org/~gk/mirrors/sources/application-services-vendor-[% c('var/rust_vendor_version') %].tar.bz2
sha256sum: fd90572db453b5d83bc7dbb50b09d75c5019f09ee747054fdc12f42605d9da69
- filename: no-git.patch
- filename: mavenLocal.patch
enable: '[% !c("var/fetch_gradle_dependencies") %]'
- filename: target.patch
- filename: 1651660.patch
This diff is collapsed.
From 1eed35b66ea9d943d6ea648649b0012e132f3602 Mon Sep 17 00:00:00 2001
From: Georg Koppen <gk@torproject.org>
Date: Thu, 2 Jul 2020 20:34:23 +0000
Subject: [PATCH] Use local maven repository for gradle dependencies
diff --git a/build.gradle b/build.gradle
index 4715a7cd..1e71ca04 100644
--- a/build.gradle
+++ b/build.gradle
@@ -17,6 +17,7 @@ buildscript {
]
repositories {
+ mavenLocal()
google()
jcenter()
maven {
@@ -57,6 +58,7 @@ apply plugin: 'de.undercouch.download'
allprojects {
repositories {
+ mavenLocal()
google()
jcenter()
maven {
diff --git a/settings.gradle b/settings.gradle
index 2349f829..f0ad1ef9 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,6 +1,11 @@
/* 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/. */
+pluginManagement {
+ repositories {
+ mavenLocal()
+ }
+}
import org.yaml.snakeyaml.Yaml
buildscript {
@@ -8,6 +13,7 @@ buildscript {
classpath 'org.yaml:snakeyaml:1.23'
}
repositories {
+ mavenLocal()
jcenter()
}
}
--
2.27.0
From 88fdf4a5e0510fe430e81b652621705d3de47746 Mon Sep 17 00:00:00 2001
From: Georg Koppen <gk@torproject.org>
Date: Mon, 6 Jul 2020 17:04:47 +0000
Subject: [PATCH] no git
diff --git a/build.gradle b/build.gradle
index 6b16a91d..af8a3b6e 100644
--- a/build.gradle
+++ b/build.gradle
@@ -79,8 +79,7 @@ import com.sun.jna.Platform as DefaultPlatform
//
// Note we pass the path to the git-dir so that this still works when
// used as a dependency substitution from e.g. android-components.
-ext.libsGitSha = "git --git-dir=${rootProject.rootDir}/.git diff --name-only main -- :/libs".execute().text.allWhitespace ?
- "git --git-dir=${rootProject.rootDir}/.git rev-parse HEAD:libs".execute().text.trim() : null
+ext.libsGitSha = null
// Use in-tree libs from the source directory in CI or if the git SHA is unset; otherwise use
// downloaded libs.
--
2.27.0
From 9593dc8d9589f0ed94c07d77eab6845b02b484de Mon Sep 17 00:00:00 2001
From: Georg Koppen <gk@torproject.org>
Date: Fri, 7 Aug 2020 20:54:31 +0000
Subject: [PATCH] No unit test running currently
diff --git a/build.gradle b/build.gradle
index 58a4ddae..95bc8445 100644
--- a/build.gradle
+++ b/build.gradle
@@ -198,7 +198,6 @@ switch (DefaultPlatform.RESOURCE_PREFIX) {
ext.rustTargets += 'darwin'
break
case 'linux-x86-64':
- ext.rustTargets += 'linux-x86-64'
break
case 'win32-x86-64':
ext.rustTargets += 'win32-x86-64-gnu'
--
2.28.0.rc1
......@@ -24,7 +24,7 @@ targets:
android-armv7:
var:
configure_opt: --enable-local-rust --enable-vendor --enable-extended --release-channel=stable --sysconfdir=etc --target=thumbv7neon-linux-androideabi --set=target.thumbv7neon-linux-androideabi.cc=[% c("var/CC") %] --set=target.thumbv7neon-linux-androideabi.ar=[% c("var/cross_prefix") %]-ar
configure_opt: --enable-local-rust --enable-vendor --enable-extended --release-channel=stable --sysconfdir=etc --target=[% IF pc(c("origin_project"), "var/application_services") %]armv7-linux-androideabi[% ELSE %]thumbv7neon-linux-androideabi[% END %] --set=target.[% IF pc(c("origin_project"), "var/application_services") %]armv7-linux-androideabi[% ELSE %]thumbv7neon-linux-androideabi[% END %].cc=[% c("var/CC") %] --set=target.[% IF pc(c("origin_project"), "var/application_services") %]armv7-linux-androideabi[% ELSE %]thumbv7neon-linux-androideabi[% END %].ar=[% c("var/cross_prefix") %]-ar
linux:
var:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment