Anton Hansson | 5d3a4ed | 2020-06-24 12:34:27 +0100 | [diff] [blame] | 1 | #!/bin/bash -ex |
| 2 | |
| 3 | # This script updates the prebuilt test_framework-sdkextension.jar, which is |
| 4 | # required when the "new APIs" added change. |
| 5 | |
| 6 | function gettop() { |
| 7 | local p=$(pwd) |
| 8 | while [[ ! -e "${p}/build/envsetup.sh" ]]; do |
| 9 | p="${p}/.." |
| 10 | done |
| 11 | echo $(readlink -f $p) |
| 12 | } |
| 13 | |
| 14 | function is_aosp() { |
| 15 | grep -q 'https://android-review.googlesource.com' $(gettop)/.repo/manifests/default.xml |
| 16 | } |
| 17 | |
| 18 | if [[ -z "$OUT" ]]; then |
| 19 | echo "lunch first" |
| 20 | exit 1 |
| 21 | fi |
| 22 | |
| 23 | dir=$(dirname $(readlink -f $BASH_SOURCE)) |
| 24 | bps="${dir}/../framework/Android.bp" |
| 25 | # AOSP does not use combined stubs, so needs special treatment. |
| 26 | if is_aosp; then |
| 27 | bps="$bps $(gettop)/frameworks/base/Android.bp" |
| 28 | fi |
| 29 | |
| 30 | for bp in $bps; do |
| 31 | if ! test -e $bp; then |
| 32 | echo $bp does not exist |
| 33 | exit 1 |
| 34 | elif test -e "${bp}.bak"; then |
| 35 | echo "skipping ${bp} modification because ${bp}.bak exists" |
| 36 | continue |
| 37 | fi |
| 38 | cp $bp "${bp}.bak" |
| 39 | sed -i -e 's|":framework-sdkextensions-sources"|":framework-sdkextensions-sources",":test_framework-sdkextensions-sources"|' $bp |
| 40 | done |
| 41 | |
| 42 | $(gettop)/build/soong/soong_ui.bash --make-mode framework-sdkextensions |
| 43 | |
| 44 | for bp in $bps; do mv "${bp}.bak" $bp ; touch $bp; done |
| 45 | cp "${OUT}/apex/com.android.sdkext/javalib/framework-sdkextensions.jar" "${dir}/test_framework-sdkextensions.jar" |