build 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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=$SDK_HOME/ndk
  6. # Make directories
  7. mkdir -p $NDK_HOME $SDK_HOME
  8. # Compiler Archives
  9. unzip -qq [% c("input_files_by_name/android_sdk_tools") %] -d $SDK_HOME
  10. mkdir -p $SDK_HOME/cmdline-tools
  11. unzip -qq [% c("input_files_by_name/android_commandlinetools") %] -d $SDK_HOME/cmdline-tools
  12. mv $SDK_HOME/cmdline-tools/cmdline-tools $SDK_HOME/cmdline-tools/[% c("var/commandlinetools_version_string") %]
  13. unzip -qq [% c("input_files_by_name/android_ndk_compiler")%] -d $NDK_HOME
  14. ln -s $NDK_HOME/android-ndk-r[% c("var/android_ndk_version") %][% c("var/android_ndk_revision") %] $NDK_HOME/[% c("var/android_ndk_version_build") %]
  15. # NDK Archive
  16. # Adjust cross compilation prefix for armv7a. Unfortunately, the compiler cross
  17. # compilation prefix and the one for all the other tools differ. Let's fix that
  18. # so we only have to take care of one. See: #33557 (comment 2674649).
  19. cd $NDK_HOME/android-ndk-r[% c("var/android_ndk_version") %][% c("var/android_ndk_revision") %]/toolchains/llvm/prebuilt/linux-x86_64/bin
  20. for f in `ls arm-linux-androideabi-*`; do
  21. ln -s $f ${f//arm-linux-androideabi/armv7a-linux-androideabi}
  22. done
  23. # Tool Archives
  24. cd $SDK_HOME
  25. unzip -qq $HOME/[% c("input_files_by_name/build_tools") %] -d $SDK_HOME
  26. mkdir -p build-tools/[% c("var/version_31") %]
  27. mv [% c("var/android_release_dir") %]/* build-tools/[% c("var/version_31") %]
  28. unzip -qq $HOME/[% c("input_files_by_name/platform") %] -d $SDK_HOME
  29. mkdir -p platforms/android-[% c("var/android_api_level") %]
  30. mv [% c("var/android_release_dir") %]/* platforms/android-[% c("var/android_api_level") %]
  31. # Apart from GeckoView all other projects do still need build-tools 28.0.3 as
  32. # they are using the Gradle plugin 3.2.1 - 3.6.0 without specifying
  33. # `buildToolsVersion`.
  34. unzip -qq $HOME/[% c("input_files_by_name/build_tools_28") %] -d $SDK_HOME
  35. mkdir -p build-tools/[% c("var/version_28") %]
  36. mv [% c("var/android_release_dir_28") %]/* build-tools/[% c("var/version_28") %]
  37. # Application Services currently needs build tools 30.0.2
  38. unzip -qq $HOME/[% c("input_files_by_name/build_tools_30") %] -d $SDK_HOME
  39. mkdir -p build-tools/[% c("var/version_30") %]
  40. mv [% c("var/android_release_dir_30") %]/* build-tools/[% c("var/version_30") %]
  41. unzip -qq $HOME/[% c("input_files_by_name/build_tools_29") %] -d $SDK_HOME
  42. mkdir -p build-tools/[% c("var/version_29") %]
  43. mv [% c("var/android_release_dir_29") %]/* build-tools/[% c("var/version_29") %]
  44. unzip -qq $HOME/[% c("input_files_by_name/platform_30") %] -d $SDK_HOME
  45. mkdir -p platforms/android-[% c("var/android_api_level_30") %]
  46. mv [% c("var/android_release_dir_30") %]/* platforms/android-[% c("var/android_api_level_30") %]
  47. unzip -qq $HOME/[% c("input_files_by_name/platform_29") %] -d $SDK_HOME
  48. mkdir -p platforms/android-[% c("var/android_api_level_29") %]
  49. mv [% c("var/android_release_dir_29") %]/* platforms/android-[% c("var/android_api_level_29") %]
  50. unzip -qq $HOME/[% c("input_files_by_name/platform_tools") %] -d $SDK_HOME
  51. # That's a quirk required by GeckoView but let's have it here instead of in the
  52. # project's build script
  53. mkdir emulator
  54. cp tools/emulator emulator/
  55. # Archive dist directory
  56. cd /var/tmp/dist
  57. [% c('tar', {
  58. tar_src => [ project ],
  59. tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
  60. }) %]