Merge pull request #4010 from rgilles/master

Isolate the complied Java classes into a target folder.
This commit is contained in:
Wouter van Oortmerssen 2016-09-09 15:28:37 -07:00 committed by GitHub
commit edd77ae2f3
1 changed files with 18 additions and 3 deletions

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
#
# Copyright 2014 Google Inc. All rights reserved.
#
@ -16,14 +16,29 @@
echo Compile then run the Java test.
java -version
testdir=$(readlink -fn `dirname $0`)
thisdir=$(readlink -fn `pwd`)
targetdir=${testdir}/target
if [[ "$testdir" != "$thisdir" ]]; then
echo error: must be run from inside the ${testdir} directory
echo you ran it from ${thisdir}
exit 1
fi
javac -classpath ${testdir}/../java:${testdir}:${testdir}/namespace_test JavaTest.java
java -classpath ${testdir}/../java:${testdir}:${testdir}/namespace_test JavaTest
find .. -type f -name "*.class" -exec rm {} \;
if [[ -e "${targetdir}" ]]; then
echo "clean target"
rm -rf ${targetdir}
fi
mkdir ${targetdir}
javac -d ${targetdir} -classpath ${testdir}/../java:${testdir}:${testdir}/namespace_test JavaTest.java
java -classpath ${targetdir} JavaTest
rm -rf ${targetdir}