build 1.3 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. export GRADLE_MAVEN_REPO="file://$gradle_repo"
  6. # The download script assumes artifact package name is the complete URL path.
  7. # In some cases this is incorrect, so copy those artifacts to correct location
  8. cp -r $gradle_repo/guardianproject/gpmaven/master/* $gradle_repo
  9. cp -r $gradle_repo/dl/android/maven2/* $gradle_repo
  10. mkdir -p /var/tmp/build $output_dir
  11. [% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
  12. tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz
  13. # Patch projects
  14. cd /var/tmp/build/[% project %]-[% c('version') %]
  15. for p in $rootdir/*.patch
  16. do patch -p1 < $p
  17. done
  18. # Use Orbot's PT capabilities
  19. [% IF c("var/android-armv7") %]
  20. arch=armeabi-v7a
  21. [% ELSE %]
  22. arch=x86
  23. [% END %]
  24. obfs4dir=orbotservice/src/main/libs/$arch
  25. mkdir -p $obfs4dir
  26. mv external/pluto/bin/$arch/obfs4proxy $obfs4dir/obfs4proxy.so
  27. # Build Android Libraries and Apps
  28. $GRADLE_HOME/gradle-4.1/bin/gradle --offline assembleRelease -x lint
  29. # Package
  30. cp app/build/outputs/aar/* $output_dir
  31. cp orbotservice/build/outputs/aar/* $output_dir
  32. cp jsocksAndroid/build/outputs/aar/* $output_dir