build 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/bash
  2. [% c("var/set_default_env") -%]
  3. output_dir=[% dest_dir %]/[% c('filename') %]
  4. gradle_repo=$rootdir/[% c('input_files_by_name/gradle-dependencies') %]
  5. # The download script assumes artifact package name is the complete URL path.
  6. # In some cases this is incorrect, so copy those artifacts to correct location
  7. cp -r $gradle_repo/dl/android/maven2/* $gradle_repo
  8. cp -r $gradle_repo/maven2/* $gradle_repo
  9. mkdir -p /var/tmp/build $output_dir
  10. [% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
  11. tar -C $GRADLE_HOME -xf $rootdir/[% c('input_files_by_name/gradle') %]
  12. tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz
  13. unzip -d $rootdir $rootdir/[% c('input_files_by_name/jetifier') %]
  14. cd /var/tmp/build/[% project %]-[% c('version') %]
  15. # Replace pre-packaged tor library with the latest build
  16. rm -fR service/src/main/jniLibs/*
  17. [% FOREACH arch = ['armv7', 'aarch64', 'x86', 'x86_64'] -%]
  18. tar -C service/src/main -xf $rootdir/[% c('input_files_by_name/tor-' _ arch) %]/tor.tar.gz
  19. [% END -%]
  20. # Replace libraries with the config dependencies
  21. rm service/libs/*
  22. cp $rootdir/[% c('input_files_by_name/topl') %]/*{.aar,.jar} service/libs/
  23. # Update bridges list
  24. cat $rootdir/bridges_list.obfs4.txt $rootdir/bridges_list.meek-azure.txt \
  25. $rootdir/bridges_list.snowflake.txt > service/src/main/assets/common/bridges.txt
  26. # Build Android Libraries and Apps
  27. 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
  28. # Bug 40398: Manually jetify each archive and save it in $output_dir
  29. for aar in jsocksAndroid/build/outputs/aar/* service/build/outputs/aar/*; do
  30. fn=`basename $aar`
  31. $rootdir/jetifier-standalone/bin/jetifier-standalone -l info -i $aar -o $output_dir/$fn
  32. done