build 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  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/dl/android/maven2/* $gradle_repo
  9. cp -r $gradle_repo/plugins-release/* $gradle_repo
  10. cp -r $gradle_repo/maven2/* $gradle_repo
  11. mkdir -p /var/tmp/build $output_dir
  12. [% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
  13. tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz
  14. # Patch projects
  15. cd /var/tmp/build/[% project %]-[% c('version') %]
  16. patch -p1 < $rootdir/gradle.patch
  17. patch -p1 < $rootdir/require-api.patch
  18. # Remove native files, otherwise build will fail after gradle.patch
  19. rm -fR service/src/main/jni
  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. # Build Android Libraries and Apps
  24. $GRADLE_HOME/gradle-4.1/bin/gradle --offline -P androidplugin=3.0.1 -P appcompatVersion=23.4.0 -P compileVersion=26 -P targetVersion=26 -P minVersion=16 assembleRelease -x lint
  25. # Package
  26. cp jsocksAndroid/build/outputs/aar/* service/build/outputs/aar/* $output_dir