1#!/bin/bash 2LOCAL_DIR="$( dirname "${BASH_SOURCE}" )" 3 4APP_DIR_IN_CTS="^hostsidetests\\/appsecurity\\/test-apps\\/SplitApp" 5BUILD_LIBS_SCRIPT="${APP_DIR_IN_CTS}\\/build_libs\\.sh\$" 6APP_LIBS_ANDROID_MK="${APP_DIR_IN_CTS}\\/libs/Android\\.mk\$" 7NATIVE_MK_PATTERN="${APP_DIR_IN_CTS}\\/libs\\/.*\\/Android\\.mk\$" 8MANIFEST_PATTERN="${APP_DIR_IN_CTS}\\/libs\\/.*\\/AndroidManifest\\.xml\$" 9JNI_PATTERN="${APP_DIR_IN_CTS}\\/jni\\/.*\$" 10LIB_SO_PATTERN="${APP_DIR_IN_CTS}\\/libs\\/.*\\/libsplitappjni.*\\.so\$" 11 12MODIFY_JNI=0 13MODIFY_ANDROID_MK=0 14MODIFY_BUILD_LIBS_SCRIPT=0 15LIB_SO_LIST="" 16MK_LIST="" 17MANIFEST_LIST="" 18for f in $* 19do 20 echo "${f}" | grep -q "${BUILD_LIBS_SCRIPT}" && MODIFY_BUILD_LIBS_SCRIPT=1 21 echo "${f}" | grep -q "${APP_LIBS_ANDROID_MK}" && MODIFY_ANDROID_MK=1 22 23 echo "${f}" | grep -q "${NATIVE_MK_PATTERN}" && MK_LIST="${MK_LIST}\n ${f}" 24 25 echo "${f}" | grep -q "${MANIFEST_PATTERN}" && MANIFEST_LIST="${MANIFEST_LIST}\n ${f}" 26 27 echo "${f}" | grep -q "${JNI_PATTERN}" && MODIFY_JNI=1 28 echo "${f}" | grep -q "${LIB_SO_PATTERN}" && LIB_SO_LIST="${LIB_SO_LIST}\n ${f}" 29done 30 31NUMBER_OF_ERRORS=0 32if [[ ${MODIFY_ANDROID_MK} -ne 0 && ${MODIFY_BUILD_LIBS_SCRIPT} -eq 0 ]] 33then 34 ((NUMBER_OF_ERRORS++)) 35 echo -e "Please modify ${BUILD_LIBS_SCRIPT//\\/} instead of\n" \ 36 "\033[0;31;47m${APP_LIBS_ANDROID_MK//\\/}\033[0m?" 37fi 38if [[ -n "${MK_LIST}" && ${MODIFY_BUILD_LIBS_SCRIPT} -eq 0 ]] 39then 40 ((NUMBER_OF_ERRORS++)) 41 echo -e "Please modify ${BUILD_LIBS_SCRIPT//\\/} instead of" \ 42 "\033[0;31;47m${MK_LIST}\033[0m?" 43fi 44if [[ -n "${MANIFEST_LIST}" && ${MODIFY_BUILD_LIBS_SCRIPT} -eq 0 ]] 45then 46 ((NUMBER_OF_ERRORS++)) 47 echo -e "Please modify ${BUILD_LIBS_SCRIPT//\\/} instead of" \ 48 "\033[0;31;47m${MANIFEST_LIST}\033[0m?" 49fi 50if [[ -n "${LIB_SO_LIST}" && ${MODIFY_BUILD_LIBS_SCRIPT} -eq 0 && ${MODIFY_JNI} -eq 0 ]] 51then 52 ((NUMBER_OF_ERRORS++)) 53 echo -e "Please modify ${JNI_PATTERN//\\/} files instead of" \ 54 "\033[0;31;47m${LIB_SO_LIST}\033[0m?" 55fi 56if [[ ${NUMBER_OF_ERRORS} -gt 0 ]] 57then 58 echo "Please make sure to modify the file by running build_libs.sh.${NUMBER_OF_ERRORS}" 59fi 60 61exit ${NUMBER_OF_ERRORS} 62 63