build 1.3 KB

12345678910111213141516171819202122232425262728293031
  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/plugins-release/* $gradle_repo
  9. cp -r $gradle_repo/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. cd /var/tmp/build/[% project %]-[% c('version') %]
  14. patch -p1 < $rootdir/remove-native-build.patch
  15. # Remove native files, otherwise build will fail after gradle.patch
  16. rm -fR service/src/main/jni
  17. # Replace libraries with the config dependencies
  18. rm service/libs/*
  19. cp $rootdir/[% c('input_files_by_name/topl') %]/*{.aar,.jar} service/libs/
  20. # Build Android Libraries and Apps
  21. $GRADLE_HOME/gradle-4.10.2/bin/gradle --offline --no-daemon -P androidplugin=3.1.0 -P appcompatVersion=28.0.0 -P compileVersion=28 -P targetVersion=28 -P minVersion=16 -Dmaven.repo.local=$gradle_repo assembleRelease -x lint
  22. # Package
  23. cp jsocksAndroid/build/outputs/aar/* service/build/outputs/aar/* $output_dir