test_gradle.sh 983 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/bash -e
  2. SDK_DIR=$1
  3. echo "OpenCV Android SDK path: ${SDK_DIR}"
  4. ANDROID_HOME=${ANDROID_HOME:-${ANDROID_SDK_ROOT:-${ANDROID_SDK?Required ANDROID_HOME/ANDROID_SDK/ANDROID_SDK_ROOT}}}
  5. ANDROID_NDK=${ANDROID_NDK_HOME-${ANDROID_NDK:-${NDKROOT?Required ANDROID_NDK_HOME/ANDROID_NDK/NDKROOT}}}
  6. echo "Android SDK: ${ANDROID_HOME}"
  7. echo "Android NDK: ${ANDROID_NDK}"
  8. if [ ! -d "${ANDROID_HOME}" ]; then
  9. echo "FATAL: Missing Android SDK directory"
  10. exit 1
  11. fi
  12. if [ ! -d "${ANDROID_NDK}" ]; then
  13. echo "FATAL: Missing Android NDK directory"
  14. exit 1
  15. fi
  16. export ANDROID_HOME=${ANDROID_HOME}
  17. export ANDROID_SDK=${ANDROID_HOME}
  18. export ANDROID_SDK_ROOT=${ANDROID_HOME}
  19. export ANDROID_NDK=${ANDROID_NDK}
  20. export ANDROID_NDK_HOME=${ANDROID_NDK}
  21. echo "Cloning OpenCV Android SDK ..."
  22. rm -rf "test-gradle"
  23. cp -rp "${SDK_DIR}" "test-gradle"
  24. echo "Cloning OpenCV Android SDK ... Done!"
  25. echo "Run gradle ..."
  26. (cd "test-gradle/samples"; ./gradlew -i assemble)
  27. echo "#"
  28. echo "# Done!"
  29. echo "#"