[tor-commits] [Git][tpo/applications/tor-browser-build][main] Bug 41082: Tor Expert Bundle android builds create .aar file

Pier Angelo Vendrame (@pierov) git at gitlab.torproject.org
Wed Feb 28 22:27:24 UTC 2024



Pier Angelo Vendrame pushed to branch main at The Tor Project / Applications / tor-browser-build


Commits:
b5acc813 by Dan Ballard at 2024-02-28T12:59:28-08:00
Bug 41082: Tor Expert Bundle android builds create .aar file

- - - - -


7 changed files:

- projects/browser/build
- projects/browser/build.android
- projects/tor-android-service/build
- + projects/tor-expert-bundle/AndroidManifest.xml
- projects/tor-expert-bundle/build
- projects/tor-expert-bundle/config
- projects/tor-onion-proxy-library/build


Changes:

=====================================
projects/browser/build
=====================================
@@ -90,10 +90,10 @@ mv [% c('input_files_by_name/noscript') %] "$TBDIR/$EXTSPATH/{73a6fe31-595d-460b
     [% END -%]
   }
 
-  tar -xvf [% c('input_files_by_name/tor-expert-bundle') %]
+  tar -xvf [% c('input_files_by_name/tor-expert-bundle') %]/tor-expert-bundle.tar.gz
   [% IF c("var/macos_universal") -%]
     mkdir aarch64
-    tar -C aarch64 -xf [% c('input_files_by_name/tor-expert-bundle-aarch64') %]
+    tar -C aarch64 -xf [% c('input_files_by_name/tor-expert-bundle-aarch64') %]/tor-expert-bundle.tar.gz
   [% END -%]
 
   # geoip(6) and anything else that belongs in the data dir from the expert bundle
@@ -451,13 +451,13 @@ fi
 [%IF c("var/tor-browser") -%]
   tor_expert_bundle_src="[% c("input_files_by_name/tor-expert-bundle") %]"
   # strip off trailing "$buildid.tar.gz"
-  tor_expert_bundle_dest=${tor_expert_bundle_src:0:-14}.tar.gz
-  cp $rootdir/[% c("input_files_by_name/tor-expert-bundle") %] "$OUTDIR"/$tor_expert_bundle_dest
+  tor_expert_bundle_dest=${tor_expert_bundle_src:0:-7}.tar.gz
+  cp $rootdir/[% c("input_files_by_name/tor-expert-bundle") %]/tor-expert-bundle.tar.gz "$OUTDIR"/$tor_expert_bundle_dest
   [% IF c("var/macos_universal") %]
     tor_expert_bundle_src="[% c('input_files_by_name/tor-expert-bundle-aarch64') %]"
     # strip off trailing "$buildid.tar.gz"
-    tor_expert_bundle_dest=${tor_expert_bundle_src:0:-14}.tar.gz
-    cp $rootdir/[% c('input_files_by_name/tor-expert-bundle-aarch64') %] "$OUTDIR"/$tor_expert_bundle_dest
+    tor_expert_bundle_dest=${tor_expert_bundle_src:0:-7}.tar.gz
+    cp $rootdir/[% c('input_files_by_name/tor-expert-bundle-aarch64') %]/tor-expert-bundle.tar.gz "$OUTDIR"/$tor_expert_bundle_dest
   [% END -%]
 [% END -%]
 [% IF c("var/build_infos_json") -%]


=====================================
projects/browser/build.android
=====================================
@@ -24,7 +24,7 @@ cd /var/tmp/build
 mv $rootdir/[% c('input_files_by_name/noscript') %] "$noscript_path"
 
 [%IF c("var/tor-browser") -%]
-  tar -xaf "$rootdir/[% c("input_files_by_name/tor-expert-bundle") %]" tor/pluggable_transports/pt_config.json
+  tar -xaf "$rootdir/[% c("input_files_by_name/tor-expert-bundle") %]/tor-expert-bundle.tar.gz" tor/pluggable_transports/pt_config.json
 [% END -%]
 unzip -j "$apk" assets/omni.ja
 mkdir omni
@@ -70,8 +70,8 @@ unsign_patch="[% dest_dir %]/[% c('filename') %]/[% c('var/project-name') %]-qa-
 bsdiff $qa_apk $aligned_apk $unsign_patch
 
 [%IF c("var/tor-browser") -%]
-  tor_expert_bundle_src="[% c("input_files_by_name/tor-expert-bundle") %]"
+  tor_expert_bundle_src="[% c('input_files_by_name/tor-expert-bundle') %]"
   # strip off trailing "$buildid.tar.gz"
-  tor_expert_bundle_dest=${tor_expert_bundle_src:0:-14}.tar.gz
-  cp $rootdir/$tor_expert_bundle_src [% dest_dir %]/[% c('filename') %]/$tor_expert_bundle_dest
+  tor_expert_bundle_dest=${tor_expert_bundle_src:0:-7}.tar.gz
+  cp "$rootdir/[% c("input_files_by_name/tor-expert-bundle") %]/tor-expert-bundle.tar.gz" [% dest_dir %]/[% c('filename') %]/$tor_expert_bundle_dest
 [% END -%]


=====================================
projects/tor-android-service/build
=====================================
@@ -35,7 +35,7 @@ rm -fR service/src/main/jniLibs/*
   # Extract tor-expert-bundle
   tebdir=$rootdir/tor-expert-bundle-[% arch %]
   mkdir $tebdir
-  tar -C $tebdir -xf $rootdir/[% c('input_files_by_name/tor-expert-bundle-' _ arch) %]
+  tar -C $tebdir -xf $rootdir/[% c('input_files_by_name/tor-expert-bundle-' _ arch) %]/tor-expert-bundle.tar.gz
 
   # Figure out our android abi from our arch
   [% IF arch == "armv7" -%]


=====================================
projects/tor-expert-bundle/AndroidManifest.xml
=====================================
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+          package="org.torproject.torExpertBundle"
+          android:versionCode="1"
+          android:versionName="0.0.1" >
+
+    <uses-sdk
+            android:minSdkVersion="16"
+            android:targetSdkVersion="29" />
+
+    <uses-permission android:name="android.permission.INTERNET" />
+
+    <application android:allowBackup="false" >
+    </application>
+
+</manifest>
\ No newline at end of file


=====================================
projects/tor-expert-bundle/build
=====================================
@@ -2,6 +2,10 @@
 [% c("var/set_default_env") -%]
 distdir=/var/tmp/dist/[% project %]
 mkdir -p $distdir
+
+output_dir=[% dest_dir %]/[% c('filename') %]
+mkdir -p $output_dir
+
 cd $distdir
 
 tar -xkf $rootdir/[% c('input_files_by_name/tor') %]
@@ -18,6 +22,32 @@ tar -xkf $rootdir/[% c('input_files_by_name/conjure') %]
 awk '{gsub(/\$\{pt_extension\}/, "[% c("var/pt_extension") %]"); print}' $rootdir/pt_config.json > pt_config.json
 
 cd $distdir
+
+# package a .aar on android
+[% IF c("var/android") -%]
+  aar_file=torExpertBundle-[% c('arch') %].aar
+
+  mkdir aar
+  mkdir -p aar/jni/[% c('arch') %]
+  mkdir -p aar/assets/common
+
+  cp -a tor/libTor.so aar/jni/[% c('arch') %]/
+  cp -a tor/pluggable_transports/conjure-client aar/jni/[% c('arch') %]/libConjure.so
+  cp -a tor/pluggable_transports/lyrebird aar/jni/[% c('arch') %]/Lyrebird.so
+  cp -a tor/pluggable_transports/snowflake-client aar/jni/[% c('arch') %]/libSnowflake.so
+  cp -a tor/pluggable_transports/webtunnel-client aar/jni/[% c('arch') %]/libWebtunnel.so
+
+  cp -a data/* aar/assets/common/
+
+  cp -a tor/pluggable_transports/pt_config.json aar/assets/common/
+
+  cp -a $rootdir/AndroidManifest.xml aar/
+
+  cd aar
+  jar -cvf $output_dir/tor-expert-bundle-[% c('arch') %].aar *
+  cd ..
+[% END %]
+
 [%
   SET tar_src = [ "tor", "data" ];
   IF c("var/linux");
@@ -25,6 +55,6 @@ cd $distdir
   END;
   c('tar', {
     tar_src => tar_src,
-    tar_args => '-czvf' _ dest_dir _ '/' _ c('filename'),
+    tar_args => '-czvf' _ dest_dir _ '/' _ c('filename') _ '/tor-expert-bundle.tar.gz',
   });
-%]
+%]
\ No newline at end of file


=====================================
projects/tor-expert-bundle/config
=====================================
@@ -1,5 +1,5 @@
 # vim: filetype=yaml sw=2
-filename: '[% project %]-[% c("var/osname") %]-[% c("version") %]-[% c("var/build_id") %].tar.gz'
+filename: '[% project %]-[% c("var/osname") %]-[% c("version") %]-[% c("var/build_id") %]'
 version: '[% c("var/torbrowser_version") %]'
 
 container:
@@ -23,3 +23,4 @@ input_files:
   - name: conjure
     project: conjure    
   - filename: pt_config.json
+  - filename: AndroidManifest.xml


=====================================
projects/tor-onion-proxy-library/build
=====================================
@@ -43,7 +43,7 @@ patch -p1 < $rootdir/0001-Bug-40800-Add-WebTunnel-support.patch
   # Extract tor-expert-bundle
   tebdir=$rootdir/tor-expert-bundle-[% arch %]
   mkdir $tebdir
-  tar -C $tebdir -xf $rootdir/[% c('input_files_by_name/tor-expert-bundle-' _ arch) %]
+  tar -C $tebdir -xf $rootdir/[% c('input_files_by_name/tor-expert-bundle-' _ arch) %]/tor-expert-bundle.tar.gz
   ptdir=$tebdir/tor/pluggable_transports
 
   # Overwrite the obfs4proxy binary provided by Pluto and add Snowflake



View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/b5acc81374a372195912d080ea2464e1f1bfa646

-- 
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/b5acc81374a372195912d080ea2464e1f1bfa646
You're receiving this email because of your account on gitlab.torproject.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tor-commits/attachments/20240228/6e76189d/attachment-0001.htm>


More information about the tor-commits mailing list