build 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/bin/bash
  2. [% c("var/set_default_env") -%]
  3. export PROJECT_PATH=/var/tmp/dist/[% project %]
  4. export SDK_HOME=$PROJECT_PATH/android-sdk-linux
  5. export NDK_HOME=$PROJECT_PATH/android-ndk
  6. export GRADLE_HOME=$PROJECT_PATH/gradle
  7. android_release_dir=android-10
  8. android_release_dir_old=android-9
  9. # Make directories
  10. mkdir -p $NDK_HOME $SDK_HOME $GRADLE_HOME
  11. # Compiler Archives
  12. unzip -qq [% c("input_files_by_name/android_sdk_tools") %] -d $SDK_HOME
  13. unzip -qq [% c("input_files_by_name/android_ndk_compiler")%] -d $NDK_HOME
  14. # GeckoView is still using an older Android NDK, bundle it, too.
  15. unzip -qq [% c("input_files_by_name/android_ndk_compiler_old")%] -d $NDK_HOME
  16. unzip -qq [% c("input_files_by_name/gradle564") %] -d $GRADLE_HOME
  17. # GeckoView is still using an older Gradle, bundle it, too.
  18. unzip -qq [% c("input_files_by_name/gradle511") %] -d $GRADLE_HOME
  19. # application-services is using a comparatively new Gradle, bundle it, too.
  20. unzip -qq [% c("input_files_by_name/gradle63") %] -d $GRADLE_HOME
  21. # Fenix switched to a fairly recent Gradle, add it as well.
  22. unzip -qq [% c("input_files_by_name/gradle651") %] -d $GRADLE_HOME
  23. # NDK Archive
  24. for version in [% c("var/android_ndk_version") %][% c("var/android_ndk_revision") %] [% c("var/android_ndk_version_old") %]; do
  25. # Adjust cross compilation prefix for armv7a. Unfortunately, the compiler cross
  26. # compilation prefix and the one for all the other tools differ. Let's fix that
  27. # so we only have to take care of one. See: #33557 (comment 2674649).
  28. cd $NDK_HOME/android-ndk-r$version/toolchains/llvm/prebuilt/linux-x86_64/bin
  29. for f in `ls arm-linux-androideabi-*`; do
  30. ln -s $f ${f//arm-linux-androideabi/armv7a-linux-androideabi}
  31. done
  32. done
  33. # Tool Archives
  34. cd $SDK_HOME
  35. unzip -qq $HOME/[% c("input_files_by_name/build_tools") %] -d $SDK_HOME
  36. mkdir -p build-tools/[% c("version") %]
  37. mv $android_release_dir/* build-tools/[% c("version") %]
  38. # Apart from GeckoView all other projects do still need build-tools 28.0.3 as
  39. # they are using the Gradle plugin 3.2.1 - 3.6.0 without specifying
  40. # `buildToolsVersion`.
  41. unzip -qq $HOME/[% c("input_files_by_name/build_tools_old") %] -d $SDK_HOME
  42. mkdir -p build-tools/[% c("version_old") %]
  43. mv $android_release_dir_old/* build-tools/[% c("version_old") %]
  44. unzip -qq $HOME/[% c("input_files_by_name/platform") %] -d $SDK_HOME
  45. mkdir -p platforms/android-[% c("var/android_api_level") %]
  46. mv $android_release_dir/* platforms/android-[% c("var/android_api_level") %]
  47. unzip -qq $HOME/[% c("input_files_by_name/platform_tools") %] -d $SDK_HOME
  48. # That's a quirk required by GeckoView but let's have it here instead of in the
  49. # project's build script
  50. mkdir emulator
  51. cp tools/emulator emulator/
  52. # Cleanup
  53. rm -fR $android_release_dir $android_release_dir_old
  54. # Archive dist directory
  55. cd /var/tmp/dist
  56. [% c('tar', {
  57. tar_src => [ project ],
  58. tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
  59. }) %]