summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorWouter van Oortmerssen <wvo@google.com>2016-09-09 15:28:37 -0700
committerGitHub <noreply@github.com>2016-09-09 15:28:37 -0700
commitedd77ae2f39a4c4ab4c2e964ed7e411ccf6c6fb3 (patch)
treed36df63a17fd79b660f849e835cadf2ac2fa4cc8 /tests
parent8e3fa336eb894317cd828163d1677265da3a3483 (diff)
parent582fd90c4a351d167c98fc6d7d23ed9b6ed0c89f (diff)
downloadflatbuffers-edd77ae2f39a4c4ab4c2e964ed7e411ccf6c6fb3.tar.gz
flatbuffers-edd77ae2f39a4c4ab4c2e964ed7e411ccf6c6fb3.tar.bz2
flatbuffers-edd77ae2f39a4c4ab4c2e964ed7e411ccf6c6fb3.zip
Merge pull request #4010 from rgilles/master
Isolate the complied Java classes into a target folder.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/JavaTest.sh21
1 files changed, 18 insertions, 3 deletions
diff --git a/tests/JavaTest.sh b/tests/JavaTest.sh
index 344bd1c0..40e854b5 100755
--- a/tests/JavaTest.sh
+++ b/tests/JavaTest.sh
@@ -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}