Skip to content

Commit 04a34fe

Browse files
authored
Don't assign ANDROID_HOME if set already (pytorch#15198)
based on https://github.com/pytorch/executorch/blob/4bf7e12cce28c2a9695bb34a0028f3cf25c9b829/docs/source/using-executorch-android.md users might set up ANDROID_HOME by themselves. However the current script doesn't use that. Fix the script and have it users the one user specified
1 parent 2d3a765 commit 04a34fe

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/build_android_library.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ build_aar() {
8282
find cmake-out-android-so -type f -name "*.so" -exec "$ANDROID_NDK"/toolchains/llvm/prebuilt/*/bin/llvm-strip {} \;
8383
fi
8484
pushd extension/android/
85-
ANDROID_HOME="${ANDROID_SDK:-/opt/android/sdk}" ./gradlew build
85+
ANDROID_HOME="${ANDROID_HOME:-${ANDROID_SDK:-/opt/android/sdk}}"
8686
# Use java unit test as sanity check
87-
ANDROID_HOME="${ANDROID_SDK:-/opt/android/sdk}" ./gradlew :executorch_android:testDebugUnitTest
87+
ANDROID_HOME="${ANDROID_HOME:-${ANDROID_SDK:-/opt/android/sdk}}" ./gradlew :executorch_android:testDebugUnitTest
8888
popd
8989
if [ ! -z $BUILD_AAR_DIR ]; then
9090
cp extension/android/executorch_android/build/outputs/aar/executorch_android-debug.aar "${BUILD_AAR_DIR}/executorch.aar"

0 commit comments

Comments
 (0)