xref: /aosp_15_r20/external/pytorch/android/build_test_app.sh (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1*da0073e9SAndroid Build Coastguard Worker#!/bin/bash
2*da0073e9SAndroid Build Coastguard Workerset -eux
3*da0073e9SAndroid Build Coastguard Worker
4*da0073e9SAndroid Build Coastguard WorkerPYTORCH_DIR="$(cd $(dirname $0)/..; pwd -P)"
5*da0073e9SAndroid Build Coastguard WorkerPYTORCH_ANDROID_DIR=$PYTORCH_DIR/android
6*da0073e9SAndroid Build Coastguard Worker
7*da0073e9SAndroid Build Coastguard Workerecho "PYTORCH_DIR:$PYTORCH_DIR"
8*da0073e9SAndroid Build Coastguard Worker
9*da0073e9SAndroid Build Coastguard Workersource "$PYTORCH_ANDROID_DIR/common.sh"
10*da0073e9SAndroid Build Coastguard Worker
11*da0073e9SAndroid Build Coastguard Workercheck_android_sdk
12*da0073e9SAndroid Build Coastguard Workercheck_gradle
13*da0073e9SAndroid Build Coastguard Workerparse_abis_list "$@"
14*da0073e9SAndroid Build Coastguard Workerbuild_android
15*da0073e9SAndroid Build Coastguard Worker
16*da0073e9SAndroid Build Coastguard Worker# To set proxy for gradle add following lines to ./gradle/gradle.properties:
17*da0073e9SAndroid Build Coastguard Worker# systemProp.http.proxyHost=...
18*da0073e9SAndroid Build Coastguard Worker# systemProp.http.proxyPort=8080
19*da0073e9SAndroid Build Coastguard Worker# systemProp.https.proxyHost=...
20*da0073e9SAndroid Build Coastguard Worker# systemProp.https.proxyPort=8080
21*da0073e9SAndroid Build Coastguard Worker
22*da0073e9SAndroid Build Coastguard Workerif [ "$CUSTOM_ABIS_LIST" = true ]; then
23*da0073e9SAndroid Build Coastguard Worker  NDK_DEBUG=1 $GRADLE_PATH -PnativeLibsDoNotStrip=true -PABI_FILTERS=$ABIS_LIST -p $PYTORCH_ANDROID_DIR clean test_app:assembleDebug
24*da0073e9SAndroid Build Coastguard Workerelse
25*da0073e9SAndroid Build Coastguard Worker  NDK_DEBUG=1 $GRADLE_PATH -PnativeLibsDoNotStrip=true -p $PYTORCH_ANDROID_DIR clean test_app:assembleDebug
26*da0073e9SAndroid Build Coastguard Workerfi
27*da0073e9SAndroid Build Coastguard Worker
28*da0073e9SAndroid Build Coastguard Workerfind $PYTORCH_ANDROID_DIR -type f -name *apk
29*da0073e9SAndroid Build Coastguard Worker
30*da0073e9SAndroid Build Coastguard Workerfind $PYTORCH_ANDROID_DIR -type f -name *apk | xargs echo "To install apk run: $ANDROID_HOME/platform-tools/adb install -r "
31