Unverified Commit e913b103 authored by Georg Koppen's avatar Georg Koppen
Browse files

Bug 40029: Clean-up for mobile

We remove the Fenix targets that were due to Fennec-based builds still
being around. Additionally, we move the *fenix* projects to their
non-Fenix counterparts in case they only existed due to Fennec-based
builds. Thirdly, we do a firefox project clean-up as all the mobile bits
moved to the geckoview project.
parent 1f4a684f
......@@ -4,41 +4,64 @@ export PROJECT_PATH=/var/tmp/dist/[% project %]
export SDK_HOME=$PROJECT_PATH/android-sdk-linux
export NDK_HOME=$PROJECT_PATH/android-ndk
export GRADLE_HOME=$PROJECT_PATH/gradle
android_release_dir=android-10
android_release_dir_old=android-9
#Make directories
# Make directories
mkdir -p $NDK_HOME $SDK_HOME $GRADLE_HOME
# Compiler Archives
unzip -qq [% c("input_files_by_name/android_sdk_tools") %] -d $SDK_HOME
unzip -qq [% c("input_files_by_name/android_ndk_compiler")%] -d $NDK_HOME
# GeckoView is still using an older Android NDK, bundle it, too.
unzip -qq [% c("input_files_by_name/android_ndk_compiler_old")%] -d $NDK_HOME
unzip -qq [% c("input_files_by_name/gradle_bin") %] -d $GRADLE_HOME
# GeckoView is still using an older Gradle, bundle it, too.
unzip -qq [% c("input_files_by_name/gradle_bin_old") %] -d $GRADLE_HOME
# application-services is using a comparatively new Gradle, bundle it, too.
unzip -qq [% c("input_files_by_name/gradle_bin_new") %] -d $GRADLE_HOME
# NDK Archive
cd $NDK_HOME
mv android-ndk-r17b/* .
rm -fR android-ndk-r17b
# The architectures we support
./build/tools/make_standalone_toolchain.py --api [% c("var/android_min_api_armv7") %] --arch arm --install-dir=./arm
./build/tools/make_standalone_toolchain.py --api [% c("var/android_min_api_aarch64") %] --arch arm64 --install-dir=./arm64
./build/tools/make_standalone_toolchain.py --api [% c("var/android_min_api_x86") %] --arch x86 --install-dir=./x86
./build/tools/make_standalone_toolchain.py --api [% c("var/android_min_api_x86_64") %] --arch x86_64 --install-dir=./x86_64
for version in [% c("var/android_ndk_version") %][% c("var/android_ndk_revision") %] [% c("var/android_ndk_version_old") %]; do
# Adjust cross compilation prefix for armv7a. Unfortunately, the compiler cross
# compilation prefix and the one for all the other tools differ. Let's fix that
# so we only have to take care of one. See: #33557 (comment 2674649).
cd $NDK_HOME/android-ndk-r$version/toolchains/llvm/prebuilt/linux-x86_64/bin
for f in `ls arm-linux-androideabi-*`; do
ln -s $f ${f//arm-linux-androideabi/armv7a-linux-androideabi}
done
done
# Tool Archives
cd $SDK_HOME
unzip -qq $HOME/[% c("input_files_by_name/build_tools") %] -d $SDK_HOME
mkdir -p build-tools/27.0.3
mv android-8.1.0/* build-tools/27.0.3
mkdir -p build-tools/[% c("version") %]
mv $android_release_dir/* build-tools/[% c("version") %]
# Fenix has not updated to build-tools 29 yet, bundle therefore build-tools 28,
# too.
unzip -qq $HOME/[% c("input_files_by_name/build_tools_old") %] -d $SDK_HOME
mkdir -p build-tools/[% c("version_old") %]
mv $android_release_dir_old/* build-tools/[% c("version_old") %]
unzip -qq $HOME/[% c("input_files_by_name/platform") %] -d $SDK_HOME
mkdir -p platforms/android-28
mv android-9/* platforms/android-28
mkdir -p platforms/android-[% c("var/android_api_level") %]
mv $android_release_dir/* platforms/android-[% c("var/android_api_level") %]
# Fenix has not updated to Android 29 yet, bundle therefore Android 28, too.
unzip -qq $HOME/[% c("input_files_by_name/platform_old") %] -d $SDK_HOME
mkdir -p platforms/android-[% c("var/android_api_level_old") %]
mv $android_release_dir_old/* platforms/android-[% c("var/android_api_level_old") %]
unzip -qq $HOME/[% c("input_files_by_name/platform_tools") %] -d $SDK_HOME
# That's a quirk required by GeckoView but let's have it here instead of in the
# project's build script
mkdir emulator
cp tools/emulator emulator/
# Cleanup
rm -fR android-8.1.0
rm -fR android-9
rm -fR $android_release_dir $android_release_dir_old
# Archive dist directory
cd /var/tmp/dist
......
# vim: filetype=yaml sw=2
filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %].tar.gz'
version: 27.0.3
filename: '[% project %]-[% c("version") %]-[% c("version_old") %]-[% c("var/build_id") %].tar.gz'
version: 29.0.3
version_old: 28.0.3
var:
container:
use_container: 1
......@@ -11,29 +12,59 @@ var:
mkdir -p /var/tmp/dist
tar -C /var/tmp/dist -xf $rootdir/[% c("compiler_tarfile") %]
export ANDROID_SDK_HOME=/var/tmp/dist/[% project %]/android-sdk-linux
export ANDROID_NDK_HOME=/var/tmp/dist/[% project %]/android-ndk
# By default we use the old NDK which is the one GeckoView is using.
# However, we can overwrite that per project if needed (e.g.
# application-services is currently on a newer NDK).
export ANDROID_NDK_HOME=/var/tmp/dist/[% project %]/android-ndk/android-ndk-r[% c("var/android_ndk_version_old") %]
export GRADLE_HOME=/var/tmp/dist/[% project %]/gradle
export ANDROID_HOME=$ANDROID_SDK_HOME
export GRADLE_USER_HOME=$GRADLE_HOME
export PATH=$PATH:$ANDROID_NDK_HOME/[% c("var/toolchain_arch") %]/bin
export PATH=$PATH:$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$GRADLE_HOME/gradle-[% c("var/gradle_version") %]/bin
google_repo: https://dl.google.com/android/repository
android_api_level: 29
android_api_level_old: 28
android_platform_revision: 04
android_ndk_version: 21
android_ndk_version_old: 20
android_ndk_revision: d
gradle_version_new: 6.3
gradle_version: 5.6.4
gradle_version_old: 5.1.1
input_files:
- project: container-image
- URL: '[% c("var/google_repo") %]/build-tools_r27.0.3-linux.zip'
- URL: '[% c("var/google_repo") %]/build-tools_r[% c("version") %]-linux.zip'
name: build_tools
sha256sum: 5e1f4fc5203f13de120c56f9cc103bb2e57d940959547506196ab10ddc9e6b97
- URL: '[% c("var/google_repo") %]/platform-28_r04.zip'
sha256sum: 5652d8cd5eaaade0b853bfe0ae6cbfa0706a6f70a0ebb25ca24a6f484ec3d855
- URL: '[% c("var/google_repo") %]/build-tools_r[% c("version_old") %]-linux.zip'
name: build_tools_old
sha256sum: 7954956a40633c88f693d638cbc23f68e9e2499dc7a4b7dfdaf6a3e91387749a
- URL: '[% c("var/google_repo") %]/platform-[% c("var/android_api_level") %]_r[% c("var/android_platform_revision") %].zip'
name: platform
sha256sum: c9eaf2ce4e8fa6f5a8036bd3c95363d003733bf0a1bd349718cadf802db44c69
- URL: '[% c("var/google_repo") %]/platform-[% c("var/android_api_level_old") %]_r[% c("var/android_platform_revision") %].zip'
name: platform_old
sha256sum: 967f8ca99b71d337aa9c7781f9d65dd8110bf5c4746f44304047bf71b20d0ded
- URL: '[% c("var/google_repo") %]/platform-tools_r28.0.3-linux.zip'
# ./mach bootstrap is fetching the latest version, so it does not seem to
# matter which particular version we are using. Pin to the one fitting best to
# SDK version/build-tools version.
- URL: '[% c("var/google_repo") %]/platform-tools_r[% c("version") %]-linux.zip'
name: platform_tools
sha256sum: 38fccfe8d2646dd12bdd7cad22fedba0493425b98ebd6d620e4c670b9af4c53f
sha256sum: 49e676ec90bff1f7d7dfe4fb7d0ab78e14fa8fb06a8dccca2ef57a1bc29497a0
- URL: '[% c("var/google_repo") %]/sdk-tools-linux-4333796.zip'
name: android_sdk_tools
sha256sum: 92ffee5a1d98d856634e8b71132e8a95d96c83a63fde1099be3d86df3106def9
- URL: '[% c("var/google_repo") %]/android-ndk-r17b-linux-x86_64.zip'
- URL: '[% c("var/google_repo") %]/android-ndk-r[% c("var/android_ndk_version") %][% c("var/android_ndk_revision") %]-linux-x86_64.zip'
name: android_ndk_compiler
sha256sum: 5dfbbdc2d3ba859fed90d0e978af87c71a91a5be1f6e1c40ba697503d48ccecd
- URL: https://services.gradle.org/distributions/gradle-4.10.2-bin.zip
sha256sum: dd6dc090b6e2580206c64bcee499bc16509a5d017c6952dcd2bed9072af67cbd
- URL: '[% c("var/google_repo") %]/android-ndk-r[% c("var/android_ndk_version_old") %]-linux-x86_64.zip'
name: android_ndk_compiler_old
sha256sum: 57435158f109162f41f2f43d5563d2164e4d5d0364783a9a6fab3ef12cb06ce0
- URL: https://services.gradle.org/distributions/gradle-[% c("var/gradle_version_new") %]-bin.zip
name: gradle_bin_new
sha256sum: 038794feef1f4745c6347107b6726279d1c824f3fc634b60f86ace1e9fbd1768
- URL: https://services.gradle.org/distributions/gradle-[% c("var/gradle_version") %]-bin.zip
name: gradle_bin
sha256sum: b49c6da1b2cb67a0caf6c7480630b51c70a11ca2016ff2f555eaeda863143a29
sha256sum: 1f3067073041bc44554d0efe5d402a33bc3d3c93cc39ab684f308586d732a80d
- URL: https://services.gradle.org/distributions/gradle-[% c("var/gradle_version_old") %]-bin.zip
name: gradle_bin_old
sha256sum: 4953323605c5d7b89e97d0dc7779e275bccedefcdac090aec123375eae0cc798
......@@ -21,11 +21,11 @@ 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') %]
export ANDROID_NDK_HOME=/var/tmp/dist/[% c('var/compiler') %]/android-ndk/android-ndk-r[% pc('android-toolchain', 'var/android_ndk_version') %][% pc('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 ANDROID_NDK_API_VERSION=[% pc("android-toolchain", "var/android_ndk_version") %][% pc('android-toolchain', 'var/android_ndk_revision') %]
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64
[% IF !c('var/fetch_gradle_dependencies') %]
......
......@@ -26,51 +26,51 @@ input_files:
- project: fenix-rust
name: rust-armv7
target_prepend:
- torbrowser-android-fenix-armv7
- torbrowser-android-armv7
- project: fenix-rust
name: rust-aarch64
target_prepend:
- torbrowser-android-fenix-aarch64
- torbrowser-android-aarch64
- project: fenix-rust
name: rust-x86
target_prepend:
- torbrowser-android-fenix-x86
- torbrowser-android-x86
- project: fenix-rust
name: rust-x86_64
target_prepend:
- torbrowser-android-fenix-x86_64
- torbrowser-android-x86_64
- project: nss
name: nss-armv7
target_prepend:
- torbrowser-android-fenix-armv7
- torbrowser-android-armv7
- project: nss
name: nss-aarch64
target_prepend:
- torbrowser-android-fenix-aarch64
- torbrowser-android-aarch64
- project: nss
name: nss-x86
target_prepend:
- torbrowser-android-fenix-x86
- torbrowser-android-x86
- project: nss
name: nss-x86_64
target_prepend:
- torbrowser-android-fenix-x86_64
- torbrowser-android-x86_64
- project: sqlcipher
name: sqlcipher-armv7
target_prepend:
- torbrowser-android-fenix-armv7
- torbrowser-android-armv7
- project: sqlcipher
name: sqlcipher-aarch64
target_prepend:
- torbrowser-android-fenix-aarch64
- torbrowser-android-aarch64
- project: sqlcipher
name: sqlcipher-x86
target_prepend:
- torbrowser-android-fenix-x86
- torbrowser-android-x86
- project: sqlcipher
name: sqlcipher-x86_64
target_prepend:
- torbrowser-android-fenix-x86_64
- torbrowser-android-x86_64
- filename: 'gradle-dependencies-[% c("var/gradle_dependencies_version") %]'
name: gradle-dependencies
exec: '[% INCLUDE "fetch-gradle-dependencies" %]'
......
#!/bin/bash
[% c("var/set_default_env") -%]
export PROJECT_PATH=/var/tmp/dist/[% project %]
export SDK_HOME=$PROJECT_PATH/android-sdk-linux
export NDK_HOME=$PROJECT_PATH/android-ndk
export GRADLE_HOME=$PROJECT_PATH/gradle
android_release_dir=android-10
android_release_dir_old=android-9
# Make directories
mkdir -p $NDK_HOME $SDK_HOME $GRADLE_HOME
# Compiler Archives
unzip -qq [% c("input_files_by_name/android_sdk_tools") %] -d $SDK_HOME
unzip -qq [% c("input_files_by_name/android_ndk_compiler")%] -d $NDK_HOME
# GeckoView is still using an older Android NDK, bundle it, too.
unzip -qq [% c("input_files_by_name/android_ndk_compiler_old")%] -d $NDK_HOME
unzip -qq [% c("input_files_by_name/gradle_bin") %] -d $GRADLE_HOME
# GeckoView is still using an older Gradle, bundle it, too.
unzip -qq [% c("input_files_by_name/gradle_bin_old") %] -d $GRADLE_HOME
# application-services is using a comparatively new Gradle, bundle it, too.
unzip -qq [% c("input_files_by_name/gradle_bin_new") %] -d $GRADLE_HOME
# NDK Archive
for version in [% c("var/android_ndk_version") %][% c("var/android_ndk_revision") %] [% c("var/android_ndk_version_old") %]; do
cd $NDK_HOME
# Adjust cross compilation prefix for armv7a. Unfortunately, the compiler cross
# compilation prefix and the one for all the other tools differ. Let's fix that
# so we only have to take care of one. See: #33557 (comment 2674649).
cd android-ndk-r$version/toolchains/llvm/prebuilt/linux-x86_64/bin
for f in `ls arm-linux-androideabi-*`; do
ln -s $f ${f//arm-linux-androideabi/armv7a-linux-androideabi}
done
done
# Tool Archives
cd $SDK_HOME
unzip -qq $HOME/[% c("input_files_by_name/build_tools") %] -d $SDK_HOME
mkdir -p build-tools/[% c("version") %]
mv $android_release_dir/* build-tools/[% c("version") %]
# Fenix has not updated to build-tools 29 yet, bundle therefore build-tools 28,
# too.
unzip -qq $HOME/[% c("input_files_by_name/build_tools_old") %] -d $SDK_HOME
mkdir -p build-tools/[% c("version_old") %]
mv $android_release_dir_old/* build-tools/[% c("version_old") %]
unzip -qq $HOME/[% c("input_files_by_name/platform") %] -d $SDK_HOME
mkdir -p platforms/android-[% c("var/android_api_level") %]
mv $android_release_dir/* platforms/android-[% c("var/android_api_level") %]
# Fenix has not updated to Android 29 yet, bundle therefore Android 28, too.
unzip -qq $HOME/[% c("input_files_by_name/platform_old") %] -d $SDK_HOME
mkdir -p platforms/android-[% c("var/android_api_level_old") %]
mv $android_release_dir_old/* platforms/android-[% c("var/android_api_level_old") %]
unzip -qq $HOME/[% c("input_files_by_name/platform_tools") %] -d $SDK_HOME
# That's a quirk required by GeckoView but let's have it here instead of in the
# project's build script
mkdir emulator
cp tools/emulator emulator/
# Cleanup
rm -fR $android_release_dir $android_release_dir_old
# Archive dist directory
cd /var/tmp/dist
[% c('tar', {
tar_src => [ project ],
tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
}) %]
# vim: filetype=yaml sw=2
filename: '[% project %]-[% c("version") %]-[% c("version_old") %]-[% c("var/build_id") %].tar.gz'
version: 29.0.3
version_old: 28.0.3
var:
container:
use_container: 1
deps:
- unzip
- python
setup: |
mkdir -p /var/tmp/dist
tar -C /var/tmp/dist -xf $rootdir/[% c("compiler_tarfile") %]
export ANDROID_SDK_HOME=/var/tmp/dist/[% project %]/android-sdk-linux
# By default we use the old NDK which is the one GeckoView is using.
# However, we can overwrite that per project if needed (e.g.
# application-services is currently on a newer NDK).
export ANDROID_NDK_HOME=/var/tmp/dist/[% project %]/android-ndk/android-ndk-r[% c("var/android_ndk_version_old") %]
export GRADLE_HOME=/var/tmp/dist/[% project %]/gradle
export ANDROID_HOME=$ANDROID_SDK_HOME
export GRADLE_USER_HOME=$GRADLE_HOME
export PATH=$PATH:$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$GRADLE_HOME/gradle-[% c("var/gradle_version") %]/bin
google_repo: https://dl.google.com/android/repository
android_api_level: 29
android_api_level_old: 28
android_platform_revision: 04
android_ndk_version: 21
android_ndk_version_old: 20
android_ndk_revision: d
gradle_version_new: 6.3
gradle_version: 5.6.4
gradle_version_old: 5.1.1
input_files:
- project: container-image
- URL: '[% c("var/google_repo") %]/build-tools_r[% c("version") %]-linux.zip'
name: build_tools
sha256sum: 5652d8cd5eaaade0b853bfe0ae6cbfa0706a6f70a0ebb25ca24a6f484ec3d855
- URL: '[% c("var/google_repo") %]/build-tools_r[% c("version_old") %]-linux.zip'
name: build_tools_old
sha256sum: 7954956a40633c88f693d638cbc23f68e9e2499dc7a4b7dfdaf6a3e91387749a
- URL: '[% c("var/google_repo") %]/platform-[% c("var/android_api_level") %]_r[% c("var/android_platform_revision") %].zip'
name: platform
sha256sum: c9eaf2ce4e8fa6f5a8036bd3c95363d003733bf0a1bd349718cadf802db44c69
- URL: '[% c("var/google_repo") %]/platform-[% c("var/android_api_level_old") %]_r[% c("var/android_platform_revision") %].zip'
name: platform_old
sha256sum: 967f8ca99b71d337aa9c7781f9d65dd8110bf5c4746f44304047bf71b20d0ded
# ./mach bootstrap is fetching the latest version, so it does not seem to
# matter which particular version we are using. Pin to the one fitting best to
# SDK version/build-tools version.
- URL: '[% c("var/google_repo") %]/platform-tools_r[% c("version") %]-linux.zip'
name: platform_tools
sha256sum: 49e676ec90bff1f7d7dfe4fb7d0ab78e14fa8fb06a8dccca2ef57a1bc29497a0
- URL: '[% c("var/google_repo") %]/sdk-tools-linux-4333796.zip'
name: android_sdk_tools
sha256sum: 92ffee5a1d98d856634e8b71132e8a95d96c83a63fde1099be3d86df3106def9
- URL: '[% c("var/google_repo") %]/android-ndk-r[% c("var/android_ndk_version") %][% c("var/android_ndk_revision") %]-linux-x86_64.zip'
name: android_ndk_compiler
sha256sum: dd6dc090b6e2580206c64bcee499bc16509a5d017c6952dcd2bed9072af67cbd
- URL: '[% c("var/google_repo") %]/android-ndk-r[% c("var/android_ndk_version_old") %]-linux-x86_64.zip'
name: android_ndk_compiler_old
sha256sum: 57435158f109162f41f2f43d5563d2164e4d5d0364783a9a6fab3ef12cb06ce0
- URL: https://services.gradle.org/distributions/gradle-[% c("var/gradle_version_new") %]-bin.zip
name: gradle_bin_new
sha256sum: 038794feef1f4745c6347107b6726279d1c824f3fc634b60f86ace1e9fbd1768
- URL: https://services.gradle.org/distributions/gradle-[% c("var/gradle_version") %]-bin.zip
name: gradle_bin
sha256sum: 1f3067073041bc44554d0efe5d402a33bc3d3c93cc39ab684f308586d732a80d
- URL: https://services.gradle.org/distributions/gradle-[% c("var/gradle_version_old") %]-bin.zip
name: gradle_bin_old
sha256sum: 4953323605c5d7b89e97d0dc7779e275bccedefcdac090aec123375eae0cc798
#!/bin/bash
[% c("var/set_default_env") -%]
output_dir=[% dest_dir %]/[% c('filename') %]
gradle_repo=$rootdir/[% c('input_files_by_name/gradle-dependencies') %]
# The download script assumes artifact package name is the complete URL path.
# In some cases this is incorrect, so copy those artifacts to correct location
cp -r $gradle_repo/dl/android/maven2/* $gradle_repo
cp -r $gradle_repo/plugins-release/* $gradle_repo
cp -r $gradle_repo/maven2/* $gradle_repo
mkdir -p /var/tmp/build $output_dir
[% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz
cd /var/tmp/build/[% project %]-[% c('version') %]
# Replace pre-packaged tor library with the latest build
rm -fR service/src/main/jniLibs/*
tar -C service/src/main -xf $rootdir/[% c('input_files_by_name/tor') %]/tor.tar.gz
# Replace libraries with the config dependencies
rm service/libs/*
cp $rootdir/[% c('input_files_by_name/topl') %]/*{.aar,.jar} service/libs/
# Build Android Libraries and Apps
gradle --offline --no-daemon -P androidplugin=3.6.0 -P appcompatVersion=28.0.0 -P compileVersion=29 -P targetVersion=29 -P minVersion=16 -Dmaven.repo.local=$gradle_repo assembleRelease -x lint
# Package
cp jsocksAndroid/build/outputs/aar/* service/build/outputs/aar/* $output_dir
# vim: filetype=yaml sw=2
version: '[% c("abbrev") %]'
filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %]'
git_hash: 8f40b9b2a6f4f8c05b84c5a0fec26a4b7ad77098
git_url: https://git.torproject.org/tor-android-service.git
git_submodule: 1
var:
deps:
- build-essential
container:
use_container: 1
# this should be updated when the list of gradle dependencies is changed
gradle_dependencies_version: 1
input_files:
- project: container-image
- name: '[% c("var/compiler") %]'
project: '[% c("var/compiler") %]'
- filename: 'gradle-dependencies-[% c("var/gradle_dependencies_version") %]'
name: gradle-dependencies
exec: '[% INCLUDE "fetch-gradle-dependencies" %]'
- project: fenix-tor-onion-proxy-library
name: topl
- project: tor
name: tor
From e006e215b274b1b834e098b199ea2697bc11b0f1 Mon Sep 17 00:00:00 2001
From: Georg Koppen <gk@torproject.org>
Date: Sun, 10 May 2020 08:29:10 +0000
Subject: [PATCH] Bug 30318: Add snowflake support
diff --git a/android/build.gradle b/android/build.gradle
index a8d9bdc..2392731 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -93,6 +93,9 @@ task copyPluggableTransports(type: Copy) {
rename { filename ->
filename.replace 'obfs4proxy', 'libObfs4proxy.so'
}
+ rename { filename ->
+ filename.replace 'snowflake-client', 'libSnowflake.so'
+ }
}
gradle.projectsEvaluated {
diff --git a/universal/src/main/java/com/msopentech/thali/toronionproxy/TorConfigBuilder.java b/universal/src/main/java/com/msopentech/thali/toronionproxy/TorConfigBuilder.java
index 2405097..bcb6a37 100644
--- a/universal/src/main/java/com/msopentech/thali/toronionproxy/TorConfigBuilder.java
+++ b/universal/src/main/java/com/msopentech/thali/toronionproxy/TorConfigBuilder.java
@@ -109,22 +109,33 @@ public final class TorConfigBuilder {
return this;
}
- public TorConfigBuilder configurePluggableTransportsFromSettings(File pluggableTransportClient) throws IOException {
- if (pluggableTransportClient == null) {
+ public TorConfigBuilder configurePluggableTransportsFromSettings(File pluggableTransportObfs, File pluggableTransportSnow) throws IOException {
+ if (pluggableTransportObfs == null || pluggableTransportSnow == null) {
return this;
}
- if (!pluggableTransportClient.exists()) {
- throw new IOException("Bridge binary does not exist: " + pluggableTransportClient
+ if (!pluggableTransportObfs.exists()) {
+ throw new IOException("Obfs4proxy binary does not exist: " + pluggableTransportObfs
.getCanonicalPath());
}
- if (!pluggableTransportClient.canExecute()) {
- throw new IOException("Bridge binary is not executable: " + pluggableTransportClient
+ if (!pluggableTransportSnow.exists()) {
+ throw new IOException("Snowflake binary does not exist: " + pluggableTransportSnow
.getCanonicalPath());
}
- transportPlugin(pluggableTransportClient.getCanonicalPath());
+ if (!pluggableTransportObfs.canExecute()) {
+ throw new IOException("Obfs4proxy binary is not executable: " + pluggableTransportObfs
+ .getCanonicalPath());
+ }
+
+ if (!pluggableTransportSnow.canExecute()) {
+ throw new IOException("Snowflake binary is not executable: " + pluggableTransportSnow
+ .getCanonicalPath());
+ }
+
+
+ transportPlugin(pluggableTransportObfs.getCanonicalPath(), pluggableTransportSnow.getCanonicalPath());
return this;
}
@@ -491,8 +502,9 @@ public final class TorConfigBuilder {
return transPort(settings.transPort());
}
- public TorConfigBuilder transportPlugin(String clientPath) {
- buffer.append("ClientTransportPlugin meek_lite,obfs3,obfs4 exec ").append(clientPath).append('\n');
+ public TorConfigBuilder transportPlugin(String obfsPath, String snowPath) {
+ buffer.append("ClientTransportPlugin meek_lite,obfs3,obfs4 exec ").append(obfsPath).append('\n');
+ buffer.append("ClientTransportPlugin snowflake exec ").append(snowPath).append(" -url https://snowflake-broker.azureedge.net/ -front ajax.aspnetcdn.com -ice stun:stun.l.google.com:19302\n");
return this;
}
@@ -557,6 +569,9 @@ public final class TorConfigBuilder {
case 3:
reqBridgeType = "meek_lite";
break;
+ case 4:
+ reqBridgeType = "snowflake";
+ break;
default:
throw new IOException("Requested unknown transport type: " + bridgesType);
}
--
2.26.2
From 9a2048f02d602cab7bd937c66a4d3f9c35fbfa9e Mon Sep 17 00:00:00 2001
From: Matthew Finkel <sysrqb@torproject.org>
Date: Thu, 30 Apr 2020 15:40:25 +0000
Subject: [PATCH] Bug 33931 - Filter bridges in stream by type
The InputStream contains a first-byte that indicates the format of the
following datastream. If the first-byte is 1, then the following stream
is a string of bridges that are separated by the '\n' byte. If the
first-byte is not 1, then the following data stream is default bridges
and that list should be filtered such that only the requested bridge
type is used.
---
.../thali/toronionproxy/TorConfigBuilder.java | 35 ++++++++++++++++---
1 file changed, 31 insertions(+), 4 deletions(-)
diff --git a/universal/src/main/java/com/msopentech/thali/toronionproxy/TorConfigBuilder.java b/universal/src/main/java/com/msopentech/thali/toronionproxy/TorConfigBuilder.java
index ab11948..2405097 100644
--- a/universal/src/main/java/com/msopentech/thali/toronionproxy/TorConfigBuilder.java
+++ b/universal/src/main/java/com/msopentech/thali/toronionproxy/TorConfigBuilder.java
@@ -535,9 +535,32 @@ public final class TorConfigBuilder {
TorConfigBuilder addBridgesFromResources() throws IOException {
if(settings.hasBridges()) {
InputStream bridgesStream = context.getInstaller().openBridgesStream();
- int formatType = bridgesStream.read();
- if (formatType == 0) {
- addBridges(bridgesStream);
+ // The first byte encodes the type of bridges contained within the
+ // following data stream. Currently, it may contain either default bridges
+ // or user-provided bridges.
+ int bridgesType = bridgesStream.read();
+
+ // When bridgesType is 0x01, then the following stream is
+ // user-provided (custom) bridges.
+ // When bridgesType is one of: 0x02 or 0x03, then the Stream
+ // consists of default PT bridges. That list must be filtered, after
+ // parsing each bridge line, such that only the requested bridge type