Files
openide/jvm/jvm-analysis-java-tests/testData/codeInspection/apiUsage/compile.sh
Bart van Helvert 01c04210bf [jvm] IDEA-281946 Convert Java15ApiUsageInspection to UAST
GitOrigin-RevId: f1045e0633514d2ca3ce50edd58c06f80ebc2662
2021-11-25 09:26:06 +00:00

41 lines
947 B
Bash

#!/usr/bin/env bash
set +x
# java 1.8
JAVAC="$JAVA_HOME"/bin/javac
BASE_PATH=$(dirname $0)
CLASSES="${BASE_PATH}"/classes
SOURCES="${BASE_PATH}"/src
function error() {
echo "$@" && false
}
function javac_defined() {
[ -x "${JAVAC}" ] || error "Java compiler not defined"
}
function javac_of_1_8() {
"${JAVAC}" -version |& grep -e '1\.8' &> /dev/null || error "compiler of version 1.8 required"
}
function remove_classes() {
rm -r "${CLASSES}" || error "Unable to remove the '${CLASSES}' directory"
}
function create_classes_dir() {
mkdir -p "${CLASSES}" || error "Unable to create the '${CLASSES}' directory"
}
function compile() {
"${JAVAC}" -g -source 1.8 -target 1.8 -d "${CLASSES}" "${SOURCES}"/* || error "Unable to compile"
}
javac_defined &&
javac_of_1_8 &&
remove_classes &&
create_classes_dir &&
compile &&
echo "The classes '$(find ${CLASSES} -type f -name "*.class" | tr '\n' ' ')' compiled successfully"