build-mainline-modules.sh 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #!/bin/bash -e
  2. # Non exhaustive list of modules where we want prebuilts. More can be added as
  3. # needed.
  4. MAINLINE_MODULES=(
  5. com.android.art
  6. com.android.art.debug
  7. com.android.art.testing
  8. com.android.conscrypt
  9. com.android.i18n
  10. com.android.os.statsd
  11. com.android.runtime
  12. com.android.tzdata
  13. )
  14. # List of SDKs and module exports we know of.
  15. MODULES_SDK_AND_EXPORTS=(
  16. art-module-sdk
  17. art-module-test-exports
  18. compos-module-sdk
  19. conscrypt-module-host-exports
  20. conscrypt-module-sdk
  21. conscrypt-module-test-exports
  22. i18n-module-host-exports
  23. i18n-module-sdk
  24. i18n-module-test-exports
  25. platform-mainline-sdk
  26. platform-mainline-test-exports
  27. runtime-module-host-exports
  28. runtime-module-sdk
  29. statsd-module-sdk
  30. tzdata-module-test-exports
  31. )
  32. # List of libraries installed on the platform that are needed for ART chroot
  33. # testing.
  34. PLATFORM_LIBRARIES=(
  35. heapprofd_client_api
  36. libartpalette-system
  37. liblog
  38. )
  39. # We want to create apex modules for all supported architectures.
  40. PRODUCTS=(
  41. aosp_arm
  42. aosp_arm64
  43. aosp_x86
  44. aosp_x86_64
  45. )
  46. if [ ! -e "build/make/core/Makefile" ]; then
  47. echo "$0 must be run from the top of the tree"
  48. exit 1
  49. fi
  50. echo_and_run() {
  51. echo "$*"
  52. "$@"
  53. }
  54. lib_dir() {
  55. case $1 in
  56. (aosp_arm|aosp_x86) echo "lib";;
  57. (aosp_arm64|aosp_x86_64) echo "lib64";;
  58. esac
  59. }
  60. # Make sure this build builds from source, regardless of the default.
  61. export SOONG_CONFIG_art_module_source_build=true
  62. # This script does not intend to handle compressed APEX
  63. export OVERRIDE_PRODUCT_COMPRESSED_APEX=false
  64. OUT_DIR=$(source build/envsetup.sh > /dev/null; TARGET_PRODUCT= get_build_var OUT_DIR)
  65. DIST_DIR=$(source build/envsetup.sh > /dev/null; TARGET_PRODUCT= get_build_var DIST_DIR)
  66. for product in "${PRODUCTS[@]}"; do
  67. echo_and_run build/soong/soong_ui.bash --make-mode $@ \
  68. TARGET_PRODUCT=${product} \
  69. ${MAINLINE_MODULES[@]} \
  70. ${PLATFORM_LIBRARIES[@]}
  71. PRODUCT_OUT=$(source build/envsetup.sh > /dev/null; TARGET_PRODUCT=${product} get_build_var PRODUCT_OUT)
  72. TARGET_ARCH=$(source build/envsetup.sh > /dev/null; TARGET_PRODUCT=${product} get_build_var TARGET_ARCH)
  73. rm -rf ${DIST_DIR}/${TARGET_ARCH}/
  74. mkdir -p ${DIST_DIR}/${TARGET_ARCH}/
  75. for module in "${MAINLINE_MODULES[@]}"; do
  76. echo_and_run cp ${PWD}/${PRODUCT_OUT}/system/apex/${module}.apex ${DIST_DIR}/${TARGET_ARCH}/
  77. done
  78. for library in "${PLATFORM_LIBRARIES[@]}"; do
  79. libdir=$(lib_dir $product)
  80. echo_and_run cp ${PWD}/${PRODUCT_OUT}/system/${libdir}/${library}.so ${DIST_DIR}/${TARGET_ARCH}/
  81. done
  82. done
  83. # We use force building LLVM components flag (even though we actually don't
  84. # compile them) because we don't have bionic host prebuilts
  85. # for them.
  86. export FORCE_BUILD_LLVM_COMPONENTS=true
  87. # Create multi-archs SDKs in a different out directory. The multi-arch script
  88. # uses Soong in --soong-only mode which cannot use the same directory as normal
  89. # mode with make.
  90. export OUT_DIR=${OUT_DIR}/aml
  91. echo_and_run build/soong/scripts/build-aml-prebuilts.sh \
  92. TARGET_PRODUCT=mainline_sdk ${MODULES_SDK_AND_EXPORTS[@]}
  93. rm -rf ${DIST_DIR}/mainline-sdks
  94. echo_and_run cp -R ${OUT_DIR}/soong/mainline-sdks ${DIST_DIR}