aboutsummaryrefslogtreecommitdiff
path: root/factory
diff options
context:
space:
mode:
authorcushon <cushon@google.com>2019-01-28 14:24:51 -0800
committerRon Shapiro <shapiro.rd@gmail.com>2019-01-30 20:37:14 -0500
commit8dc495bbf8cb3911d0de6b7a16f9b0937e8c7024 (patch)
tree1e17dfc500f0d13c09c83c8539976c7a4f92a676 /factory
parent9cf999995c4b95efa521e383325dcf5823aa5978 (diff)
downloadauto-8dc495bbf8cb3911d0de6b7a16f9b0937e8c7024.tar.gz
Use --release 7 for auto Java 7 tests, and don't run on JDK 7
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=231288987
Diffstat (limited to 'factory')
-rwxr-xr-xfactory/src/it/functional/java7_compat_test.sh36
1 files changed, 16 insertions, 20 deletions
diff --git a/factory/src/it/functional/java7_compat_test.sh b/factory/src/it/functional/java7_compat_test.sh
index c3365e18..4089cf1e 100755
--- a/factory/src/it/functional/java7_compat_test.sh
+++ b/factory/src/it/functional/java7_compat_test.sh
@@ -1,25 +1,28 @@
#!/bin/bash
-# Test that the code generated by AutoFactory can run on Java 7.
+# Test that the code generated by AutoFactory is compatible with Java 7.
# The AutoFactory processor itself runs on Java 8, but the code it
# generates is supposed to be able to run on Java 7.
#
# Users can achieve that by compiling like this:
-# javac -source 7 -target 7 -bootclasspath .../rt.jar
-# where javac is the one from Java 8 or later and .../rt.jar is
-# the one from Java 7.
+# javac --release 7
#
-# So this test basically does the same thing, using a large functional
-# test as input. If that test compiles and runs, it is a good sign
-# that user code will too.
+# So this test does the same thing, using a large functional test as input.
+# If that test compiles, it is a good sign that user code will compile and run.
# Exit if any command fails.
set -e
-# Arguments are the fully-qualified name of the test class, followed by
-# the path to each source file.
+# Arguments are
+# * the path to the JDK
+# * the fully-qualified name of the test class
+# * the path to each source file.
+
+JAVABASE="$1"
+shift
+
TEST_CLASS="$1"
if [ -z "${TEST_CLASS}" ]; then
- echo "Usage: $0 TEST_CLASS" >&2
+ echo "Usage: $0 JAVABASE TEST_NAME" >&2
exit 1
fi
shift
@@ -27,21 +30,14 @@ shift
MY_DIR=$(dirname "${TEST_BINARY}")
SOURCE_FILES=$(for f in "$@"; do echo "${MY_DIR}/${f}"; done)
-JDK8=third_party/java/jdk/jdk-64
-JDK7=third_party/java/jdk/jdk7-64
-JDK8_JAVAC="${JDK8}"/bin/javac
-JDK7_JAVA="${JDK7}"/bin/java
+JAVAC="${JAVABASE}"/bin/javac
CLASS_PATH="${MY_DIR}"/java7_compat_test_java_deps.jar
-BOOT_PATH="${JDK7}"/jre/lib/rt.jar
PROCESSOR_PATH=\
third_party/java/auto/auto_factory_ide.jar:\
third_party/java/dagger/dagger_components_ide.jar
-"${JDK8_JAVAC}" -d "${TEST_TMPDIR}" \
- -encoding utf8 -source 7 -target 7 \
- -bootclasspath "${BOOT_PATH}" \
+"${JAVAC}" -d "${TEST_TMPDIR}" \
+ -encoding utf8 --release 7 \
-classpath "${CLASS_PATH}" \
-processorpath "${PROCESSOR_PATH}" \
${SOURCE_FILES}
-"${JDK7_JAVA}" -classpath "${TEST_TMPDIR}:${CLASS_PATH}" \
- org.junit.runner.JUnitCore "${TEST_CLASS}"