Nicolas Geoffray | fbeca75 | 2015-05-29 10:54:12 +0100 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright (C) 2015 The Android Open Source Project |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
| 17 | if [ ! -d art ]; then |
| 18 | echo "Script needs to be run at the root of the android tree" |
| 19 | exit 1 |
| 20 | fi |
| 21 | |
Colin Cross | e0ef0a8 | 2017-07-27 21:29:18 +0000 | [diff] [blame] | 22 | source build/envsetup.sh >&/dev/null # for get_build_var |
| 23 | |
Fredrik Roubert | ad9c4a3 | 2016-11-11 19:28:18 -0800 | [diff] [blame] | 24 | # Logic for setting out_dir from build/make/core/envsetup.mk: |
| 25 | if [[ -z $OUT_DIR ]]; then |
| 26 | if [[ -z $OUT_DIR_COMMON_BASE ]]; then |
| 27 | out_dir=out |
| 28 | else |
| 29 | out_dir=${OUT_DIR_COMMON_BASE}/${PWD##*/} |
| 30 | fi |
| 31 | else |
| 32 | out_dir=${OUT_DIR} |
| 33 | fi |
| 34 | |
Nicolas Geoffray | 4b29f38 | 2015-10-07 09:28:52 +0100 | [diff] [blame] | 35 | java_libraries_dir=${out_dir}/target/common/obj/JAVA_LIBRARIES |
Andreas Gampe | 6c3e1a0 | 2017-11-09 10:29:32 -0800 | [diff] [blame] | 36 | common_targets="vogar core-tests apache-harmony-jdwp-tests-hostdex jsr166-tests mockito-target" |
Nicolas Geoffray | fbeca75 | 2015-05-29 10:54:12 +0100 | [diff] [blame] | 37 | mode="target" |
| 38 | j_arg="-j$(nproc)" |
Roland Levillain | b8b9356 | 2015-08-20 17:49:56 +0100 | [diff] [blame] | 39 | showcommands= |
Nicolas Geoffray | fbeca75 | 2015-05-29 10:54:12 +0100 | [diff] [blame] | 40 | make_command= |
| 41 | |
Nicolas Geoffray | fbeca75 | 2015-05-29 10:54:12 +0100 | [diff] [blame] | 42 | while true; do |
| 43 | if [[ "$1" == "--host" ]]; then |
| 44 | mode="host" |
| 45 | shift |
| 46 | elif [[ "$1" == "--target" ]]; then |
| 47 | mode="target" |
| 48 | shift |
Nicolas Geoffray | fbeca75 | 2015-05-29 10:54:12 +0100 | [diff] [blame] | 49 | elif [[ "$1" == -j* ]]; then |
Nicolas Geoffray | 667b99e | 2015-05-29 12:17:06 +0100 | [diff] [blame] | 50 | j_arg=$1 |
Nicolas Geoffray | fbeca75 | 2015-05-29 10:54:12 +0100 | [diff] [blame] | 51 | shift |
Roland Levillain | b8b9356 | 2015-08-20 17:49:56 +0100 | [diff] [blame] | 52 | elif [[ "$1" == "--showcommands" ]]; then |
| 53 | showcommands="showcommands" |
| 54 | shift |
Nicolas Geoffray | fbeca75 | 2015-05-29 10:54:12 +0100 | [diff] [blame] | 55 | elif [[ "$1" == "" ]]; then |
| 56 | break |
Andreas Gampe | 0dcee91 | 2017-02-01 22:07:45 -0800 | [diff] [blame] | 57 | else |
| 58 | echo "Unknown options $@" |
| 59 | exit 1 |
Nicolas Geoffray | fbeca75 | 2015-05-29 10:54:12 +0100 | [diff] [blame] | 60 | fi |
| 61 | done |
| 62 | |
Andreas Gampe | 353d818 | 2017-10-12 10:17:34 -0700 | [diff] [blame] | 63 | # Allow to build successfully in master-art. |
Nicolas Geoffray | 21622b8 | 2018-11-15 14:50:07 +0000 | [diff] [blame] | 64 | extra_args="SOONG_ALLOW_MISSING_DEPENDENCIES=true TEMPORARY_DISABLE_PATH_RESTRICTIONS=true" |
Andreas Gampe | 353d818 | 2017-10-12 10:17:34 -0700 | [diff] [blame] | 65 | |
Nicolas Geoffray | fbeca75 | 2015-05-29 10:54:12 +0100 | [diff] [blame] | 66 | if [[ $mode == "host" ]]; then |
Andreas Gampe | 6c3e1a0 | 2017-11-09 10:29:32 -0800 | [diff] [blame] | 67 | make_command="make $j_arg $extra_args $showcommands build-art-host-tests $common_targets" |
Orion Hodson | f7f85d0 | 2019-02-22 16:17:46 +0000 | [diff] [blame] | 68 | make_command+=" dx-tests junit-host" |
Andreas Gampe | 6c3e1a0 | 2017-11-09 10:29:32 -0800 | [diff] [blame] | 69 | mode_suffix="-host" |
Nicolas Geoffray | fbeca75 | 2015-05-29 10:54:12 +0100 | [diff] [blame] | 70 | elif [[ $mode == "target" ]]; then |
Evgeny Astigeevich | 069391e | 2018-09-05 22:40:57 +0100 | [diff] [blame] | 71 | if [[ -z "${ANDROID_PRODUCT_OUT}" ]]; then |
| 72 | echo 'ANDROID_PRODUCT_OUT environment variable is empty; did you forget to run `lunch`?' |
Roland Levillain | fe3e2bf | 2018-03-02 16:01:50 +0000 | [diff] [blame] | 73 | exit 1 |
| 74 | fi |
Nicolas Geoffray | ab4825d | 2018-02-05 16:12:52 +0000 | [diff] [blame] | 75 | make_command="make $j_arg $extra_args $showcommands build-art-target-tests $common_targets" |
Roland Levillain | 7b7ea79 | 2019-01-08 19:47:50 +0000 | [diff] [blame] | 76 | make_command+=" libjavacrypto-target libnetd_client-target linker toybox toolbox sh unzip" |
Roland Levillain | b52dbb7 | 2018-05-01 14:03:45 +0100 | [diff] [blame] | 77 | make_command+=" debuggerd su" |
Nicolas Geoffray | 512c121 | 2018-10-08 09:03:23 +0100 | [diff] [blame] | 78 | make_command+=" libstdc++ " |
Evgeny Astigeevich | 069391e | 2018-09-05 22:40:57 +0100 | [diff] [blame] | 79 | make_command+=" ${ANDROID_PRODUCT_OUT#"${ANDROID_BUILD_TOP}/"}/system/etc/public.libraries.txt" |
Nicolas Geoffray | 3f285b2 | 2019-02-14 14:08:55 +0000 | [diff] [blame] | 80 | make_command+=" standalone-apex-files" |
Roland Levillain | e4f1c51 | 2017-10-30 13:28:28 +0000 | [diff] [blame] | 81 | if [[ -n "$ART_TEST_CHROOT" ]]; then |
| 82 | # These targets are needed for the chroot environment. |
| 83 | make_command+=" crash_dump event-log-tags" |
| 84 | fi |
Roland Levillain | 7b7ea79 | 2019-01-08 19:47:50 +0000 | [diff] [blame] | 85 | # Build the Debug Runtime APEX (which is a superset of the Release Runtime APEX). |
| 86 | make_command+=" com.android.runtime.debug" |
Roland Levillain | 13458cd | 2019-01-13 22:23:32 +0000 | [diff] [blame] | 87 | # Build the bootstrap Bionic libraries (libc, libdl, libm). These are required |
| 88 | # as the "main" libc, libdl, and libm have moved to the Runtime APEX. This is |
| 89 | # a temporary change needed until both the ART Buildbot and Golem fully |
| 90 | # support the Runtime APEX. |
| 91 | # |
Roland Levillain | d801a7b | 2019-05-01 14:59:00 +0100 | [diff] [blame] | 92 | # TODO(b/121117762, b/129332183): Remove this when the ART Buildbot and Golem |
| 93 | # have full support for the Runtime APEX. |
Roland Levillain | 13458cd | 2019-01-13 22:23:32 +0000 | [diff] [blame] | 94 | make_command+=" libc.bootstrap libdl.bootstrap libm.bootstrap" |
Neil Fuller | 90ffe12 | 2019-06-06 17:25:48 +0100 | [diff] [blame] | 95 | # Create a copy of the ICU .dat prebuilt file in /system/etc/icu on target, |
Roland Levillain | f6c84a4 | 2019-01-10 16:54:12 +0000 | [diff] [blame] | 96 | # so that it can found even if the Runtime APEX is not available, by setting |
| 97 | # the environment variable `ART_TEST_ANDROID_RUNTIME_ROOT` to "/system" on |
| 98 | # device. This is a temporary change needed until both the ART Buildbot and |
| 99 | # Golem fully support the Runtime APEX. |
| 100 | # |
Roland Levillain | d801a7b | 2019-05-01 14:59:00 +0100 | [diff] [blame] | 101 | # TODO(b/121117762, b/129332183): Remove this when the ART Buildbot and Golem |
| 102 | # have full support for the Runtime APEX. |
Neil Fuller | 90ffe12 | 2019-06-06 17:25:48 +0100 | [diff] [blame] | 103 | make_command+=" icu-data-art-test-runtime" |
| 104 | # Create a copy of the runtime module prebuilt time zone data files in |
| 105 | # /system/etc/tz on target, so that they can be found even if the Runtime APEX |
| 106 | # is not available, by setting the environment variable |
| 107 | # `ART_TEST_ANDROID_RUNTIME_ROOT` to "/system" on device. This is a temporary |
| 108 | # change needed until both the ART Buildbot and Golem fully support the |
| 109 | # Runtime APEX. |
Roland Levillain | d801a7b | 2019-05-01 14:59:00 +0100 | [diff] [blame] | 110 | # |
| 111 | # TODO(b/121117762, b/129332183): Remove this when the ART Buildbot and Golem |
| 112 | # have full support for the Runtime APEX. |
Neil Fuller | 90ffe12 | 2019-06-06 17:25:48 +0100 | [diff] [blame] | 113 | make_command+=" tzdata-art-test-runtime tzlookup.xml-art-test-runtime tz_version-art-test-runtime" |
| 114 | # Create a copy of the time zone data module prebuilt time zone data files in |
| 115 | # /system/etc/tzdata_module/etc on target, so that they can be found even if |
| 116 | # the Time Zone Data APEX is not available, by setting the environment |
| 117 | # variable `ART_TEST_ANDROID_TZDATA_ROOT` to "/system/etc/tzdata_module" on |
| 118 | # device. This is a temporary change needed until both the ART Buildbot and |
| 119 | # Golem fully support the Time Zone Data APEX. |
| 120 | # |
| 121 | # TODO(b/121117762, b/129332183): Remove this when the ART Buildbot and Golem |
| 122 | # have full support for the Time Zone Data APEX. |
| 123 | make_command+=" icu_overlay-art-test-tzdata tzdata-art-test-tzdata tzlookup.xml-art-test-tzdata tz_version-art-test-tzdata" |
Andreas Gampe | 6c3e1a0 | 2017-11-09 10:29:32 -0800 | [diff] [blame] | 124 | mode_suffix="-target" |
Nicolas Geoffray | fbeca75 | 2015-05-29 10:54:12 +0100 | [diff] [blame] | 125 | fi |
| 126 | |
Andreas Gampe | 6c3e1a0 | 2017-11-09 10:29:32 -0800 | [diff] [blame] | 127 | mode_specific_libraries="libjavacoretests libjdwp libwrapagentproperties libwrapagentpropertiesd" |
| 128 | for LIB in ${mode_specific_libraries} ; do |
| 129 | make_command+=" $LIB${mode_suffix}" |
| 130 | done |
| 131 | |
| 132 | |
| 133 | |
Nicolas Geoffray | aadc986 | 2015-09-29 14:56:31 +0100 | [diff] [blame] | 134 | echo "Executing $make_command" |
Nicolas Geoffray | a8e8cdf | 2018-10-16 09:44:58 +0100 | [diff] [blame] | 135 | # Disable path restrictions to enable luci builds using vpython. |
Nicolas Geoffray | 21622b8 | 2018-11-15 14:50:07 +0000 | [diff] [blame] | 136 | bash -c "$make_command" |