commit 6bb6ec3650e28c07d9076ffa1f72099393f9e44a Author: Alex Catarineu acat@torproject.org Date: Fri Aug 28 19:32:52 2020 +0200
Bug 40058: Build Fenix with tor-android-service and topl
With this tor-onion-proxy-library and tor-android-service will build fat aars with all the archs we support. We copy those over the fenix/app/ folder so that the Fenix build system picks them up for the final apks. --- projects/fenix/build | 5 ++++ projects/fenix/config | 6 ++++- projects/fenix/gradle-dependencies-list.txt | 10 +++++--- projects/tor-android-service/build | 4 ++- projects/tor-android-service/config | 16 +++++++++++- projects/tor-onion-proxy-library/build | 38 ++++++++++++++++++----------- projects/tor-onion-proxy-library/config | 32 ++++++++++++++++++++++-- 7 files changed, 89 insertions(+), 22 deletions(-)
diff --git a/projects/fenix/build b/projects/fenix/build index 9726bc4..fdc6499 100644 --- a/projects/fenix/build +++ b/projects/fenix/build @@ -24,6 +24,11 @@ mkdir -p /var/tmp/build tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz
cd $builddir-[% c("version") %] + +# Move Android library dependencies so they will be included in the apk during the build +cp $rootdir/[% c('input_files_by_name/topl') %]/* app/ +cp $rootdir/[% c('input_files_by_name/tor-android-service') %]/* app/ + [% IF c("var/fetch_gradle_dependencies") %] gradle --debug --no-daemon app:assemble[% c('build_flavor') %] -x lint [% ELSE %] diff --git a/projects/fenix/config b/projects/fenix/config index 2f8ae66..7a8b2f9 100644 --- a/projects/fenix/config +++ b/projects/fenix/config @@ -16,7 +16,7 @@ var: container: use_container: 1 # This should be updated when the list of gradle dependencies is changed. - gradle_dependencies_version: 1 + gradle_dependencies_version: 2 # Switch to make it easier to grab all dependencies during a dry-run. fetch_gradle_dependencies: 0
@@ -47,3 +47,7 @@ input_files: exec: '[% INCLUDE "fetch-gradle-dependencies" %]' - filename: mavenLocal.patch enable: '[% !c("var/fetch_gradle_dependencies") %]' + - project: tor-android-service + name: tor-android-service + - project: tor-onion-proxy-library + name: topl diff --git a/projects/fenix/gradle-dependencies-list.txt b/projects/fenix/gradle-dependencies-list.txt index 86c4be0..f8a97a9 100644 --- a/projects/fenix/gradle-dependencies-list.txt +++ b/projects/fenix/gradle-dependencies-list.txt @@ -462,6 +462,8 @@ f014af749024c57989ca2aa51b0a986f9d86d2669d074c1dee068a8f8da19562 | https://jcent 943e12b100627804638fa285805a0ab788a680266531e650921ebfe4621a8bfa | https://jcenter.bintray.com/javax/inject/javax.inject/1/javax.inject-1.pom b5e60cd8b7b5ff01ce4a74c5dd008f4fbd14ced3495d0b47b85cfedc182211f2 | https://jcenter.bintray.com/javax/xml/bind/jaxb-api/2.2.12-b140109.1041/jaxb... 2092a7d8d9bc5698c59b094bdea46622915c48c83ae66d5b5ad549c7bf16155b | https://jcenter.bintray.com/javax/xml/bind/jaxb-api/2.2.12-b140109.1041/jaxb... +ec3a75bebddbf19ff56a281cf5d1ad146169dcaa0e69d7b14f4aaba2e7775f34 | https://jcenter.bintray.com/net/freehaven/tor/control/jtorctl/0.2/jtorctl-0.... +3369726ca2b0e3736c741ff3c22e06f707a1007ff20ccc5b5ba5d0d9a01ead30 | https://jcenter.bintray.com/net/freehaven/tor/control/jtorctl/0.2/jtorctl-0.... c83a9c71358d781539c34b38d76a88e3ec8e2d587c7f04b611acc9041919b310 | https://jcenter.bintray.com/net/java/dev/jna/jna/5.2.0/jna-5.2.0.aar aafe6935d6bedb89a6aa32563d441fbe305da1de193d6f71a45a0212acf9b756 | https://jcenter.bintray.com/net/java/dev/jna/jna/5.2.0/jna-5.2.0.pom 281440811268e65d9e266b3cc898297e214e04f09740d0386ceeb4a8923d63bf | https://jcenter.bintray.com/net/java/jvnet-parent/1/jvnet-parent-1.pom @@ -645,9 +647,11 @@ c0e82b220b0a52c71c7ca2a58c99a2530696c7b58b173052b9d48fe3efb10073 | https://jcent 0f8a1b116e760b8fe6389c51b84e4b07a70fc11082d4f936e453b583dd50b43b | https://jcenter.bintray.com/org/ow2/ow2/1.5/ow2-1.5.pom 6e58dad0b8565b95c6fb14b4bfbf570523d1c5290244cfb33822789fa53b1d25 | https://jcenter.bintray.com/org/python/jython-installer/2.7.1/jython-install... 2a42db37f9a565f1baa833b7cb7e9f901bd9fd750d10b9bd7ca76b2385b22387 | https://jcenter.bintray.com/org/python/jython-installer/2.7.1/jython-install... -baf3c7fe15fefeaf9e5b000d94547379dc48370f22a8797e239c127e7d7756ec | https://jcenter.bintray.com/org/slf4j/slf4j-api/1.7.24/slf4j-api-1.7.24.jar -d7a15266d22fadc1c81bbc3b62637801d116e484eb6c831217dc36c537be48d2 | https://jcenter.bintray.com/org/slf4j/slf4j-api/1.7.24/slf4j-api-1.7.24.pom -36367d127a586d502b60bf54db2d7397ec94573620eff523873ec12a12e54839 | https://jcenter.bintray.com/org/slf4j/slf4j-parent/1.7.24/slf4j-parent-1.7.2... +fbd7b254e02d8aef60c418a5f0e14a783b38a16162caffb2d2a16ccd5d2c09b4 | https://jcenter.bintray.com/org/slf4j/slf4j-android/1.7.25/slf4j-android-1.7... +bd9b9cb1a3987b1427f7a18babe7f92078e32bbe2e1dca6dced00cc0e3a077a9 | https://jcenter.bintray.com/org/slf4j/slf4j-android/1.7.25/slf4j-android-1.7... +18c4a0095d5c1da6b817592e767bb23d29dd2f560ad74df75ff3961dbde25b79 | https://jcenter.bintray.com/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar +7cd9d7a0b5d93dfd461a148891b43509cf403a9c7f9fb49060d3554df1c81e1e | https://jcenter.bintray.com/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.pom +18f5c52120db036e88d6136f8839c832d074bdda95c756c6f429249d2db54ac6 | https://jcenter.bintray.com/org/slf4j/slf4j-parent/1.7.25/slf4j-parent-1.7.2... b51f8867c92b6a722499557fc3a1fdea77bdf9ef574722fe90ce436a29559454 | https://jcenter.bintray.com/org/sonatype/oss/oss-parent/7/oss-parent-7.pom fb40265f982548212ff82e362e59732b2187ec6f0d80182885c14ef1f982827a | https://jcenter.bintray.com/org/sonatype/oss/oss-parent/9/oss-parent-9.pom d3f7f09989d5b0ce5c4791818ef937ee7663f1e359c2ef2d312f938aad0763da | https://jcenter.bintray.com/org/yaml/snakeyaml/1.24/snakeyaml-1.24.jar diff --git a/projects/tor-android-service/build b/projects/tor-android-service/build index 4fb41bc..df83673 100644 --- a/projects/tor-android-service/build +++ b/projects/tor-android-service/build @@ -17,7 +17,9 @@ 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 +[% FOREACH arch = ['armv7', 'aarch64', 'x86', 'x86_64'] -%] + tar -C service/src/main -xf $rootdir/[% c('input_files_by_name/tor-' _ arch) %]/tor.tar.gz +[% END -%]
# Replace libraries with the config dependencies rm service/libs/* diff --git a/projects/tor-android-service/config b/projects/tor-android-service/config index 1f833ba..e2bb2db 100644 --- a/projects/tor-android-service/config +++ b/projects/tor-android-service/config @@ -23,4 +23,18 @@ input_files: - project: tor-onion-proxy-library name: topl - project: tor - name: tor + name: tor-armv7 + target_prepend: + - torbrowser-android-armv7 + - project: tor + name: tor-aarch64 + target_prepend: + - torbrowser-android-aarch64 + - project: tor + name: tor-x86 + target_prepend: + - torbrowser-android-x86 + - project: tor + name: tor-x86_64 + target_prepend: + - torbrowser-android-x86_64 diff --git a/projects/tor-onion-proxy-library/build b/projects/tor-onion-proxy-library/build index 3e02fb4..edeb8ae 100644 --- a/projects/tor-onion-proxy-library/build +++ b/projects/tor-onion-proxy-library/build @@ -23,20 +23,30 @@ patch -p1 < $rootdir/gradle.patch patch -p1 < $rootdir/0001-Bug-33931-Filter-bridges-in-stream-by-type.patch patch -p1 < $rootdir/0001-Bug-30318-Add-snowflake-support.patch
-# Extract obfs4proxy from TorBrowser/Tor/PluggableTransports/obfs4proxy -tar --strip-components=4 -xf $rootdir/[% c('input_files_by_name/obfs4') %] - -# Extract snowflake from TorBrowser/Tor/PluggableTransports/snowflake -tar --strip-components=4 -xf $rootdir/[% c('input_files_by_name/snowflake') %] - -# Overwrite the obfs4proxy binary provided by Pluto and add Snowflake -for d in external/pluto/bin/*; do - cp obfs4proxy $d/ - cp snowflake-client $d/ -done - -rm obfs4proxy -rm snowflake-client +[% FOREACH arch = ['armv7', 'aarch64', 'x86', 'x86_64'] -%] + # Extract obfs4proxy from TorBrowser/Tor/PluggableTransports/obfs4proxy + tar --strip-components=4 -xf $rootdir/[% c('input_files_by_name/obfs4-' _ arch) %] + + # Extract snowflake from TorBrowser/Tor/PluggableTransports/snowflake + tar --strip-components=4 -xf $rootdir/[% c('input_files_by_name/snowflake-' _ arch) %] + + # Overwrite the obfs4proxy binary provided by Pluto and add Snowflake + [% IF arch == "armv7" -%] + cp obfs4proxy external/pluto/bin/armeabi-v7a/ + cp obfs4proxy external/pluto/bin/armeabi/ + cp snowflake-client external/pluto/bin/armeabi-v7a/ + cp snowflake-client external/pluto/bin/armeabi/ + [% ELSIF arch == "aarch64" -%] + cp obfs4proxy external/pluto/bin/arm64-v8a/ + cp snowflake-client external/pluto/bin/arm64-v8a/ + [% ELSE -%] + cp obfs4proxy external/pluto/bin/[% arch %]/ + cp snowflake-client external/pluto/bin/[% arch %]/ + [% END -%] + + rm obfs4proxy + rm snowflake-client +[% END -%]
# Build Android Libraries and Apps gradle --offline --no-daemon -P androidplugin=3.6.0 -Dmaven.repo.local=$gradle_repo assembleRelease -x lint diff --git a/projects/tor-onion-proxy-library/config b/projects/tor-onion-proxy-library/config index 58aa4f6..671e988 100644 --- a/projects/tor-onion-proxy-library/config +++ b/projects/tor-onion-proxy-library/config @@ -20,9 +20,37 @@ input_files: - name: '[% c("var/compiler") %]' project: '[% c("var/compiler") %]' - project: obfs4 - name: obfs4 + name: obfs4-armv7 + target_prepend: + - torbrowser-android-armv7 + - project: obfs4 + name: obfs4-aarch64 + target_prepend: + - torbrowser-android-aarch64 + - project: obfs4 + name: obfs4-x86 + target_prepend: + - torbrowser-android-x86 + - project: obfs4 + name: obfs4-x86_64 + target_prepend: + - torbrowser-android-x86_64 + - project: snowflake + name: snowflake-armv7 + target_prepend: + - torbrowser-android-armv7 + - project: snowflake + name: snowflake-aarch64 + target_prepend: + - torbrowser-android-aarch64 + - project: snowflake + name: snowflake-x86 + target_prepend: + - torbrowser-android-x86 - project: snowflake - name: snowflake + name: snowflake-x86_64 + target_prepend: + - torbrowser-android-x86_64 - filename: 'gradle-dependencies-[% c("var/gradle_dependencies_version") %]' name: gradle-dependencies exec: '[% INCLUDE "fetch-gradle-dependencies" %]'