1#!/bin/bash 2# Copyright (C) 2023 The Android Open Source Project 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15 16 17# Script to build hoststubgen and run it directly (without using the build rules) 18# on framework-all.jar. 19 20 21echo "THIS SCRIPT IS BROKEN DUE TO CHANGES TO FILE PATHS TO DEPENDENT FILES. FIX IT WHEN YOU NEED TO USE IT." 1>&2 22 23exit 99 24 25 26source "${0%/*}"/../common.sh 27 28out=out 29 30mkdir -p $out 31 32# Build the tool and target jar. 33run m hoststubgen framework-all 34 35base_args=( 36 @../hoststubgen/hoststubgen-standard-options.txt 37 38 --in-jar $ANDROID_BUILD_TOP/out/soong/.intermediates/frameworks/base/framework-all/android_common/combined/framework-all.jar 39 --policy-override-file ../hoststubgen/framework-policy-override.txt "${@}" 40 41 # This file will contain all classes as an annotation file, with "keep all" policy. 42 --gen-keep-all-file $out/framework-all-keep-all-policy.txt 43 44 # This file will contains dump of all classes in the input jar. 45 --gen-input-dump-file $out/framework-all-dump.txt 46) 47 48do_it() { 49 local out_file_stem="$1" 50 shift 51 local extra_args=("${@}") 52 53 run hoststubgen \ 54 "${base_args[@]}" \ 55 "${extra_args[@]}" \ 56 --out-stub-jar ${out_file_stem}_stub.jar \ 57 --out-impl-jar ${out_file_stem}_impl.jar \ 58 $HOSTSTUBGEN_OPTS 59 60 # Extract the jar files, so we can look into them. 61 run extract ${out_file_stem}_*.jar 62} 63 64#----------------------------------------------------------------------------- 65# framework-all, with all hidden APIs. 66#----------------------------------------------------------------------------- 67 68# No extra args. 69do_it $out/framework-all_host 70 71#----------------------------------------------------------------------------- 72# framework-test-api, only public/system/test-APIs in the stub. 73#----------------------------------------------------------------------------- 74 75do_it $out/framework-test-api_host \ 76 --intersect-stub-jar $SOONG_INT/frameworks/base/api/android_test_stubs_current/android_common/combined/*.jar 77