Igor Murashkin | 2a33775 | 2017-06-16 14:34:40 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright (C) 2017 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 | # |
| 18 | # This script lists the boot jars that an ART bootclasspath would need. |
| 19 | # |
| 20 | |
| 21 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
| 22 | TOP="$DIR/../.." |
| 23 | |
Igor Murashkin | 88c6809 | 2018-03-07 17:02:51 -0800 | [diff] [blame] | 24 | source "${TOP}/art/tools/build/var_cache.sh" >&/dev/null # import get_build_var |
Igor Murashkin | 2a33775 | 2017-06-16 14:34:40 +0000 | [diff] [blame] | 25 | |
| 26 | selected_env_var= |
| 27 | core_jars_only=n |
| 28 | print_file_path=n |
| 29 | mode=target |
| 30 | while true; do |
| 31 | case $1 in |
| 32 | --help) |
| 33 | echo "Usage: $0 [--core] [--path] [--host|--target] [--help]" |
| 34 | exit 0 |
| 35 | ;; |
| 36 | --core) |
| 37 | core_jars_only=y |
| 38 | ;; |
| 39 | --path) |
| 40 | print_file_path=y |
| 41 | ;; |
| 42 | --host) |
| 43 | mode=host |
| 44 | ;; |
| 45 | --target) |
| 46 | mode=target |
| 47 | ;; |
| 48 | *) |
| 49 | break |
| 50 | ;; |
| 51 | esac |
| 52 | shift |
| 53 | done |
| 54 | |
| 55 | if [[ $mode == target ]]; then |
| 56 | if [[ $core_jars_only == y ]]; then |
Vladimir Marko | 7a85e70 | 2018-12-03 18:47:23 +0000 | [diff] [blame] | 57 | selected_env_var=TARGET_TEST_CORE_JARS |
Igor Murashkin | 2a33775 | 2017-06-16 14:34:40 +0000 | [diff] [blame] | 58 | else |
| 59 | selected_env_var=PRODUCT_BOOT_JARS |
| 60 | fi |
| 61 | intermediates_env_var=TARGET_OUT_COMMON_INTERMEDIATES |
| 62 | elif [[ $mode == host ]]; then |
| 63 | if [[ $core_jars_only == n ]]; then |
| 64 | echo "Error: --host does not have non-core boot jars, --core required" >&2 |
| 65 | exit 1 |
| 66 | fi |
Vladimir Marko | 7a85e70 | 2018-12-03 18:47:23 +0000 | [diff] [blame] | 67 | selected_env_var=HOST_TEST_CORE_JARS |
Igor Murashkin | 2a33775 | 2017-06-16 14:34:40 +0000 | [diff] [blame] | 68 | intermediates_env_var=HOST_OUT_COMMON_INTERMEDIATES |
| 69 | fi |
| 70 | |
Vladimir Marko | 7a85e70 | 2018-12-03 18:47:23 +0000 | [diff] [blame] | 71 | if [[ $core_jars_only == y ]]; then |
| 72 | # FIXME: The soong invocation we're using for getting the variables does not give us anything |
| 73 | # defined in Android.common_path.mk, otherwise we would just use HOST-/TARGET_TEST_CORE_JARS. |
| 74 | |
Vladimir Marko | 0ace563 | 2018-12-14 11:11:47 +0000 | [diff] [blame] | 75 | # Note: This must start with the CORE_IMG_JARS in Android.common_path.mk |
David Srbecky | 6355d69 | 2020-03-26 14:10:26 +0000 | [diff] [blame] | 76 | # because that's what we use for compiling the boot.art image. |
Vladimir Marko | 0ace563 | 2018-12-14 11:11:47 +0000 | [diff] [blame] | 77 | # It may contain additional modules from TEST_CORE_JARS. |
Victor Chang | d20e51d | 2020-05-05 16:01:19 +0100 | [diff] [blame] | 78 | core_jars_list="core-oj core-libart okhttp bouncycastle apache-xml core-icu4j" |
Vladimir Marko | 7a85e70 | 2018-12-03 18:47:23 +0000 | [diff] [blame] | 79 | boot_jars_list="" |
| 80 | boot_separator="" |
| 81 | for boot_module in ${core_jars_list}; do |
Victor Chang | d20e51d | 2020-05-05 16:01:19 +0100 | [diff] [blame] | 82 | jar_suffix= |
| 83 | if [[ $mode == host ]]; then |
| 84 | if [[ $boot_module == core-icu4j ]]; then |
| 85 | jar_suffix="-host-hostdex" |
| 86 | else |
| 87 | jar_suffix="-hostdex" |
| 88 | fi |
| 89 | fi |
| 90 | boot_jars_list+="${boot_separator}${boot_module}${jar_suffix}" |
Vladimir Marko | 7a85e70 | 2018-12-03 18:47:23 +0000 | [diff] [blame] | 91 | boot_separator=" " |
| 92 | done |
| 93 | else |
| 94 | boot_jars_list=$(get_build_var "$selected_env_var") |
| 95 | fi |
Igor Murashkin | 2a33775 | 2017-06-16 14:34:40 +0000 | [diff] [blame] | 96 | |
| 97 | # Print only the list of boot jars. |
| 98 | if [[ $print_file_path == n ]]; then |
| 99 | echo $boot_jars_list |
| 100 | exit 0 |
| 101 | fi |
| 102 | |
| 103 | # Print the file path (relative to $TOP) to the classes.jar of each boot jar in the intermediates directory. |
| 104 | intermediates_dir=$(get_build_var "$intermediates_env_var") |
| 105 | |
Alex Light | ab6fa4f | 2017-06-23 09:52:58 -0700 | [diff] [blame] | 106 | # turn the file path into an absolute path if needed |
| 107 | pushd "$TOP" >/dev/null |
| 108 | intermediates_dir=$(readlink -m "$intermediates_dir") |
| 109 | popd >/dev/null |
Igor Murashkin | 2a33775 | 2017-06-16 14:34:40 +0000 | [diff] [blame] | 110 | |
Nicolas Geoffray | 31e0dc2 | 2020-03-20 15:48:09 +0000 | [diff] [blame] | 111 | if [[ $mode == target ]]; then |
| 112 | for jar in $boot_jars_list; do |
| 113 | if [[ $jar == "conscrypt" ]]; then |
| 114 | echo "$intermediates_dir/JAVA_LIBRARIES/${jar}.com.android.conscrypt_intermediates/classes.jar" |
Victor Chang | d20e51d | 2020-05-05 16:01:19 +0100 | [diff] [blame] | 115 | elif [[ $jar == "core-icu4j" ]]; then |
Nicolas Geoffray | c69b3f8 | 2020-06-22 12:33:38 +0000 | [diff] [blame] | 116 | # The location of ICU is different on an unbundled build. |
| 117 | if [[ -f "$intermediates_dir/JAVA_LIBRARIES/${jar}.com.android.i18n_intermediates/classes.jar" ]]; then |
| 118 | echo "$intermediates_dir/JAVA_LIBRARIES/${jar}.com.android.i18n_intermediates/classes.jar" |
| 119 | else |
| 120 | echo "$intermediates_dir/JAVA_LIBRARIES/${jar}_intermediates/classes.jar" |
| 121 | fi |
Nicolas Geoffray | 31e0dc2 | 2020-03-20 15:48:09 +0000 | [diff] [blame] | 122 | else |
| 123 | echo "$intermediates_dir/JAVA_LIBRARIES/${jar}.com.android.art.testing_intermediates/classes.jar" |
| 124 | fi |
| 125 | done |
| 126 | else |
| 127 | for jar in $boot_jars_list; do |
| 128 | echo "$intermediates_dir/JAVA_LIBRARIES/${jar}_intermediates/classes.jar" |
| 129 | done |
| 130 | fi |