#!/bin/bash
WEB_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
INSTR_DIR="${WEB_ROOT}/../instr"
+JAVA=${JAVA_HOME}/bin/java
+JAVAC=${JAVA_HOME}/bin/javac
#####################
echo Compiling...
-find "${WEB_ROOT}/prod" -name "*.java" | xargs javac -Xlint:deprecation
-find "${WEB_ROOT}/test" -name "*.java" | xargs javac -classpath ${WEB_ROOT}/prod:${CLASSPATH} -Xlint:deprecation
+find "${WEB_ROOT}/prod" -name "*.java" | xargs ${JAVAC} -Xlint:deprecation
+find "${WEB_ROOT}/test" -name "*.java" | xargs ${JAVAC} -classpath ${WEB_ROOT}/prod:${CLASSPATH} -Xlint:deprecation
#####################
echo Cleaning old coverage files...
#####################
echo Instrumenting...
-java -classpath "${CLASSPATH}" -jar `pwd`/jcov/jcov.jar Instr -t template.xml -o "${INSTR_DIR}" -type all "${WEB_ROOT}/prod"
+${JAVA} -classpath "${CLASSPATH}" -jar `pwd`/jcov/jcov.jar Instr -t template.xml -o "${INSTR_DIR}" -type all "${WEB_ROOT}/prod"
#####################
echo Running unit tests...
done
echo First run: locale es_ES, timezone Europe/Madrid
-java -Duser.language=es -Duser.country=ES -Duser.timezone=Europe/Madrid -Djcov.template=${WEB_ROOT}/template.xml -Djcov.file=${WEB_ROOT}/result.xml -classpath "${INSTR_DIR}:${WEB_ROOT}/test:${CLASSPATH}:/usr/share/java/junit.jar:${WEB_ROOT}/jcov/jcov_file_saver.jar" org.junit.runner.JUnitCore ${TESTS}
+${JAVA} -Duser.language=es -Duser.country=ES -Duser.timezone=Europe/Madrid -Djcov.template=${WEB_ROOT}/template.xml -Djcov.file=${WEB_ROOT}/result.xml -classpath "${INSTR_DIR}:${WEB_ROOT}/test:${CLASSPATH}:/usr/share/java/junit.jar:${WEB_ROOT}/jcov/jcov_file_saver.jar" org.junit.runner.JUnitCore ${TESTS}
-echo Second run: server default locale and timezone
-java -Djcov.template=${WEB_ROOT}/template.xml -Djcov.file=${WEB_ROOT}/result.xml -classpath "${INSTR_DIR}:${WEB_ROOT}/test:${CLASSPATH}:/usr/share/java/junit.jar:${WEB_ROOT}/jcov/jcov_file_saver.jar" org.junit.runner.JUnitCore ${TESTS}
+#echo Second run: server default locale and timezone
+#java -Djcov.template=${WEB_ROOT}/template.xml -Djcov.file=${WEB_ROOT}/result.xml -classpath "${INSTR_DIR}:${WEB_ROOT}/test:${CLASSPATH}:/usr/share/java/junit.jar:${WEB_ROOT}/jcov/jcov_file_saver.jar" org.junit.runner.JUnitCore ${TESTS}
#####################
echo Generating HTML Report...
-java -jar "${WEB_ROOT}/jcov/jcov.jar" RepGen -sourcepath "${WEB_ROOT}/prod" -log.level FINE result.xml
+${JAVA} -jar "${WEB_ROOT}/jcov/jcov.jar" RepGen -sourcepath "${WEB_ROOT}/prod" -log.level FINE result.xml