#!/bin/bash # Copyright (C) 2018 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # set -e # Run ART APEX tests. SCRIPT_DIR=$(dirname $0) # Status of whole test script. exit_status=0 # Status of current test suite. test_status=0 function say { echo "$0: $*" } function die { echo "$0: $*" exit 1 } if [[ -z "$ANDROID_BUILD_TOP" ]]; then export ANDROID_BUILD_TOP=$(pwd) if [[ ! -x "$ANDROID_BUILD_TOP/build/soong/soong_ui.bash" ]]; then die "Run from the root of the Android tree, or run lunch/banchan/tapas first." fi fi query_build_vars=( HOST_OUT PRODUCT_COMPRESSED_APEX PRODUCT_OUT TARGET_FLATTEN_APEX ) vars="$($ANDROID_BUILD_TOP/build/soong/soong_ui.bash \ --dumpvars-mode --vars="${query_build_vars[*]}")" # Assign to a variable and eval that, since bash ignores any error status from # the command substitution if it's directly on the eval line. eval $vars # Switch the build system to unbundled mode in the reduced manifest branch. if [ ! -d $ANDROID_BUILD_TOP/frameworks/base ]; then export TARGET_BUILD_UNBUNDLED=true fi deapex_binaries=( blkid_static deapexer debugfs_static fsck.erofs ) have_deapex_binaries=false if [[ "$TARGET_FLATTEN_APEX" != true ]]; then have_deapex_binaries=true for f in ${deapex_binaries[@]}; do if [ ! -e "$HOST_OUT/bin/$f" ]; then have_deapex_binaries=false fi done if $have_deapex_binaries; then :; else deapex_targets=( ${deapex_binaries[@]/%/-host} ) say "Building host binaries for deapexer: ${deapex_targets[*]}" build/soong/soong_ui.bash --make-mode ${deapex_targets[@]} || \ die "Failed to build: ${deapex_targets[*]}" fi fi # Fail early. set -e build_apex_p=true list_image_files_p=false print_image_tree_p=false print_file_sizes_p=false function usage { cat <