Run EmulJava8Suite in Java 8 builds
The build relied on javac.source to be set to 1.8 when building with
Java 8; it now uses the ant.java.version which reflects the version
of the JDK currently being used to run Ant.
Compilation of tests is split in 2 to adjust javac -source and -target
accordingly.
Change-Id: I3bbcd8cde4f1425de8212283b285828b8ec56a2c
diff --git a/common.ant.xml b/common.ant.xml
index 3cbf7c6..f3a9b6e 100755
--- a/common.ant.xml
+++ b/common.ant.xml
@@ -27,6 +27,11 @@
message="This build file is in an inconsistent state (${ant.file} != ${test.ant.file})."/>
<!-- Global Properties -->
+ <condition property="isJava8">
+ <not>
+ <equals arg1="${ant.java.version}" arg2="1.7" />
+ </not>
+ </condition>
<property environment="env"/>
<condition property="gwt.version" value="${env.GWT_VERSION}" else="0.0.0">
<isset property="env.GWT_VERSION"/>
diff --git a/user/build.xml b/user/build.xml
index 79f2fcf..ec7870d 100755
--- a/user/build.xml
+++ b/user/build.xml
@@ -14,24 +14,18 @@
<property name="test.timeout" value="5"/>
<property name="emma.merged.out" value="${junit.out}/emma-coverage"/>
- <condition property="gwt.junit.user.excludes"
- value="com/google/gwt/langtest/**,**/super/**,**/java8/**,**/*Java8Suite.java"
- else="com/google/gwt/langtest/**,**/super/**">
- <equals arg1="${javac.source}" arg2="1.7" />
- </condition>
-
<property name="gwt.junit.testcase.web.includes" value="${gwt.junit.testcase.includes}"/>
<condition property="gwt.junit.testcase.web.excludes"
value="**/*JreSuite.class,**/OptimizedOnly*,**/*Java8Suite.class"
else="**/*JreSuite.class,**/OptimizedOnly*">
- <equals arg1="${javac.source}" arg2="1.7" />
+ <isfalse value="${isJava8}" />
</condition>
<property name="gwt.junit.testcase.dev.includes" value="${gwt.junit.testcase.includes}"/>
<condition property="gwt.junit.testcase.dev.excludes"
value="**/*JsInteropSuite.class,**/*JreSuite.class,**/OptimizedOnly*,**/*Java8Suite.class"
else="**/*JsInteropSuite.class,**/*JreSuite.class,**/OptimizedOnly*">
- <equals arg1="${javac.source}" arg2="1.7" />
+ <isfalse value="${isJava8}" />
</condition>
<property name="gwt.tck.testcase.dev.includes"
@@ -142,10 +136,15 @@
Compiles the test code for this project
-->
<target name="compile.tests"
- depends="compile.dev.tests, compile.emma.if.enabled"
+ depends="-compile.tests.java7, -compile.tests.java8"
unless="compile.tests.complete">
+ </target>
+
+ <target name="-compile.tests.java7"
+ depends="compile.dev.tests, compile.emma.if.enabled">
<mkdir dir="${javac.junit.out}"/>
- <gwt.javac srcdir="test" destdir="${javac.junit.out}" excludes="${gwt.junit.user.excludes}">
+ <gwt.javac srcdir="test" destdir="${javac.junit.out}"
+ excludes="com/google/gwt/langtest/**,**/super/**,**/java8/**,**/*Java8Suite.java">
<classpath>
<pathelement location="${javac.out}"/>
<pathelement location="${gwt.tools.lib}/junit/junit-4.8.2.jar"/>
@@ -157,6 +156,19 @@
</gwt.javac>
</target>
+ <target name="-compile.tests.java8" if="isJava8" depends="-compile.tests.java7">
+ <gwt.javac srcdir="test" destdir="${javac.junit.out}" source="1.8" target="1.8"
+ includes="**/java8/**,**/*Java8Suite.java">
+ <classpath>
+ <pathelement location="${javac.junit.out}"/>
+ <pathelement location="${javac.out}"/>
+ <pathelement location="${gwt.tools.lib}/junit/junit-4.8.2.jar"/>
+ <pathelement location="${gwt.tools.lib}/selenium/selenium-java-client-driver.jar"/>
+ <path refid="test.extraclasspath"/>
+ </classpath>
+ </gwt.javac>
+ </target>
+
<target name="build" depends="compile"
description="Build and package this project">
<mkdir dir="${gwt.build.lib}"/>