xref: /aosp_15_r20/external/tink/kokoro/testutils/update_android_sdk.sh (revision e7b1675dde1b92d52ec075b0a92829627f2c52a5)
1#!/bin/bash
2
3# Copyright 2021 Google LLC
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
18set -x
19
20if [[ -z "${KOKORO_ROOT}" ]] ; then
21  exit 0
22fi
23
24readonly PLATFORM="$(uname | tr '[:upper:]' '[:lower:]')"
25
26if [[ "${PLATFORM}" == 'darwin' ]]; then
27  export JAVA_OPTS="-Djava.net.preferIPv6Addresses=true"
28fi
29
30# Install build-tools and other SDK dependencies.
31#
32# Discard STDOUT due to noisy progress bar which can't be silenced.
33(yes || true) | "${ANDROID_HOME}/tools/bin/sdkmanager" \
34  "build-tools;30.0.3" \
35  "platform-tools" \
36  "platforms;android-23" \
37  "platforms;android-26" \
38  "platforms;android-29" \
39  "platforms;android-30" \
40  "platforms;android-31" \
41  > /dev/null
42