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 | |
| 24 | source "${TOP}/build/envsetup.sh" >&/dev/null # import get_build_var |
| 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 |
| 57 | selected_env_var=TARGET_CORE_JARS |
| 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 |
| 67 | selected_env_var=HOST_CORE_JARS |
| 68 | intermediates_env_var=HOST_OUT_COMMON_INTERMEDIATES |
| 69 | fi |
| 70 | |
| 71 | boot_jars_list=$(get_build_var "$selected_env_var") |
| 72 | |
| 73 | # Print only the list of boot jars. |
| 74 | if [[ $print_file_path == n ]]; then |
| 75 | echo $boot_jars_list |
| 76 | exit 0 |
| 77 | fi |
| 78 | |
| 79 | # Print the file path (relative to $TOP) to the classes.jar of each boot jar in the intermediates directory. |
| 80 | intermediates_dir=$(get_build_var "$intermediates_env_var") |
| 81 | |
Alex Light | ab6fa4f | 2017-06-23 09:52:58 -0700 | [diff] [blame] | 82 | # turn the file path into an absolute path if needed |
| 83 | pushd "$TOP" >/dev/null |
| 84 | intermediates_dir=$(readlink -m "$intermediates_dir") |
| 85 | popd >/dev/null |
Igor Murashkin | 2a33775 | 2017-06-16 14:34:40 +0000 | [diff] [blame] | 86 | |
| 87 | for jar in $boot_jars_list; do |
| 88 | echo "$intermediates_dir/JAVA_LIBRARIES/${jar}_intermediates/classes.jar" |
| 89 | done |