blob: a42192cbd077844ea1bbbb6f8833d64d0d8b9dcc [file] [log] [blame]
<project name="user" default="build" basedir=".">
<property name="gwt.root" location=".." />
<property name="project.tail" value="user" />
<property name="test.args" value="" />
<!-- BrowserManagerServer_Stub compiled using rmic, which doesn't generate full source code -->
<property name="emma.filter.exclude" value="*BrowserManagerServer_Stub*" />
<import file="${gwt.root}/common.ant.xml" />
<property name="test.timeout" value="3" />
<property name="emma.merged.out" value="${junit.out}/emma-coverage" />
<property name="gwt.junit.testcase.web.includes" value="${gwt.junit.testcase.includes}" />
<property name="gwt.junit.testcase.web.excludes" value="" />
<!-- CoverageTest.java fails due to a javac bug in sun/OpenJDK's Java. See the file contents for details -->
<property name="gwt.junit.testcase.hosted.emma.includes" value="**/*Suite.class,com/google/gwt/dev/jjs/test/*Test.class" />
<property name="gwt.junit.testcase.hosted.emma.excludes" value="**/CoverageTest.class,**/CompilerSuite.class" />
<!-- Only IFrameLinker actually supports -noserver mode; run the other linker tests if and when they are supported -->
<property name="gwt.junit.testcase.noserver.includes" value="**/IFrameLinkerTest.class" />
<property name="gwt.junit.testcase.noserver.excludes" value="" />
<!--
Whether I18NSuite should test e.g. Foo$InnerMsgs_fr.properties (if the
value is "dollar") or Foo_Inner_fr.properties (for "bar")
-->
<property name="gwt.i18n.test.InnerClassChar" value="dollar"/>
<!--
Classpaths added for test cases
-->
<path id="test.extraclasspath">
<pathelement location="${gwt.build}/out/dev/bin-test" />
<pathelement location="test-super" />
<pathelement location="test_i18n_${gwt.i18n.test.InnerClassChar}" />
</path>
<!-- Platform shouldn't matter here, just picking one -->
<property.ensure name="gwt.dev.jar" location="${gwt.build.lib}/gwt-dev.jar" />
<target name="compile" description="Compile all class files">
<mkdir dir="${javac.out}" />
<gwt.javac>
<classpath>
<pathelement location="${gwt.tools.lib}/tomcat/servlet-api-2.5.jar" />
<pathelement location="${gwt.tools.lib}/junit/junit-3.8.1.jar" />
<pathelement location="${gwt.tools.lib}/jfreechart/jfreechart-1.0.3.jar" />
<pathelement location="${gwt.tools.lib}/selenium/selenium-java-client-driver.jar" />
<pathelement location="${gwt.tools.lib}/w3c/sac/sac-1.3.jar" />
<pathelement location="${gwt.tools.lib}/w3c/flute/flute-1.3.jar" />
<pathelement location="${gwt.dev.jar}" />
</classpath>
</gwt.javac>
<!-- Build the BrowserManagerServer_Stub to allow remote browser testing -->
<rmic base="${javac.out}"
classname="com.google.gwt.junit.remote.BrowserManagerServer"
stubversion="1.2"/>
</target>
<!--
Compile test code for dev to pick up TypeOracleTestUtils and others.
-->
<target name="compile.dev.tests" description="Compiles test dependencies in dev/core">
<gwt.ant dir="../dev" target="compile.tests" />
</target>
<target name="compile.tests" depends="compile.dev.tests, compile.emma" description="Compiles the test code for this project">
<mkdir dir="${javac.junit.out}" />
<gwt.javac srcdir="test" excludes="com/google/gwt/langtest/**" destdir="${javac.junit.out}">
<classpath>
<pathelement location="${javac.out}" />
<pathelement location="${gwt.build}/out/dev/bin-test" />
<pathelement location="${gwt.tools.lib}/tomcat/servlet-api-2.5.jar" />
<pathelement location="${gwt.tools.lib}/junit/junit-3.8.1.jar" />
<pathelement location="${gwt.tools.lib}/selenium/selenium-java-client-driver.jar" />
<pathelement location="${gwt.dev.jar}" />
</classpath>
</gwt.javac>
</target>
<target name="build" depends="compile" description="Build and package this project">
<mkdir dir="${gwt.build.lib}" />
<gwt.jar>
<fileset dir="src" excludes="**/package.html" />
<fileset dir="super" excludes="**/package.html" />
<fileset dir="${javac.out}" />
<zipfileset src="${gwt.tools.lib}/tomcat/servlet-api-2.5.jar" excludes="**/*.java"/>
<zipfileset src="${gwt.tools.lib}/w3c/sac/sac-1.3.jar" />
<zipfileset src="${gwt.tools.lib}/w3c/flute/flute-1.3.jar" />
</gwt.jar>
</target>
<target name="checkstyle" description="Static analysis of source">
<gwt.checkstyle>
<fileset dir="src" />
<fileset dir="super/com/google/gwt/emul" />
<fileset dir="super/com/google/gwt/junit/translatable" />
</gwt.checkstyle>
</target>
<target name="remoteweb-test" depends="test.remoteweb">
<echo message="DEPRECATED: remoteweb-test has been renamed test.remoteweb"/>
</target>
<target name="test.remoteweb" description="Run a remoteweb test at the given host and path" if="gwt.remote.browsers">
<echo message="Performing remote browser testing at ${gwt.remote.browsers}" />
<property name="test.remoteweb.args" value="${test.args}" />
<fileset id="test.remoteweb.tests" dir="${javac.junit.out}" includes="${gwt.junit.testcase.web.includes}" excludes="${gwt.junit.testcase.web.excludes}" />
<gwt.junit test.args="${test.args} -out www -web -runStyle RemoteWeb:${gwt.remote.browsers} -batch module -precompile parallel" test.out="${junit.out}/remoteweb" test.cases="test.remoteweb.tests" >
<extraclasspaths>
<path refid="test.extraclasspath" />
</extraclasspaths>
</gwt.junit>
</target>
<target name="selenium-test" depends="test.selenium">
<echo message="DEPRECATED: selenium-test has been renamed test.selenium"/>
</target>
<target name="test.selenium" description="Run a remote test using Selenium RC test at the given host and path" if="gwt.selenium.hosts">
<echo message="Performing remote browser testing using Selenium RC at ${gwt.selenium.hosts}" />
<property name="test.selenium.args" value="${test.args}" />
<fileset id="test.selenium.tests" dir="${javac.junit.out}" includes="${gwt.junit.testcase.web.includes}" excludes="${gwt.junit.testcase.web.excludes}" />
<gwt.junit test.args="${test.args} -out www -web -runStyle Selenium:${gwt.selenium.hosts} -batch module -precompile parallel" test.out="${junit.out}/selenium" test.cases="test.selenium.tests" >
<extraclasspaths>
<path refid="test.extraclasspath" />
</extraclasspaths>
</gwt.junit>
</target>
<target name="test.hosted.emma" depends="compile, compile.tests" description="Run all hosted-mode tests in emma mode.">
<fileset id="test.hosted.emma.tests" dir="${javac.junit.out}" includes="${gwt.junit.testcase.hosted.emma.includes}" excludes="${gwt.junit.testcase.hosted.emma.excludes}" />
<gwt.junit test.args="${test.args}" test.out="${junit.out}/${build.host.platform}-hosted-mode-emma" test.cases="test.hosted.emma.tests" >
<extraclasspaths>
<path refid="test.extraclasspath" />
<pathelement location="${gwt.tools.redist}/emma/emma.jar" />
</extraclasspaths>
</gwt.junit>
</target>
<target name="test.hosted" depends="compile, compile.tests, -test.hosted.includes" description="Run only hosted-mode tests for this project.">
<property name="gwt.junit.testcase.hosted.includes" value="${gwt.junit.testcase.includes}" />
<property name="gwt.junit.testcase.hosted.excludes" value="${gwt.junit.testcase.excludes}" />
<fileset id="test.hosted.tests" dir="${javac.junit.out}" includes="${gwt.junit.testcase.hosted.includes}" excludes="${gwt.junit.testcase.hosted.excludes}" />
<gwt.junit test.args="${test.args}" test.out="${junit.out}/${build.host.platform}-hosted-mode" test.cases="test.hosted.tests" >
<extraclasspaths>
<path refid="test.extraclasspath" />
</extraclasspaths>
</gwt.junit>
</target>
<target name="-test.hosted.includes" if="emma.enabled">
<property name="gwt.junit.testcase.hosted.includes" value="${gwt.junit.testcase.hosted.emma.includes}" />
<property name="gwt.junit.testcase.hosted.excludes" value="${gwt.junit.testcase.hosted.emma.excludes}" />
</target>
<target name="test.noserver" depends="compile, compile.tests" description="Run noserver hosted-mode tests for this project.">
<fileset id="test.noserver.tests" dir="${javac.junit.out}" includes="${gwt.junit.testcase.noserver.includes}" excludes="${gwt.junit.testcase.noserver.excludes}" />
<gwt.junit test.args="${test.args} -web -noserver" test.out="${junit.out}/${build.host.platform}-noserver-mode" test.cases="test.noserver.tests">
<extraclasspaths>
<path refid="test.extraclasspath" />
</extraclasspaths>
</gwt.junit>
</target>
<target name="test.web" depends="compile, compile.tests" description="Run only web-mode tests for this project.">
<fileset id="test.web.tests" dir="${javac.junit.out}" includes="${gwt.junit.testcase.web.includes}" excludes="${gwt.junit.testcase.web.excludes}" />
<gwt.junit test.args="${test.args} -out www -web" test.out="${junit.out}/${build.host.platform}-web-mode" test.cases="test.web.tests">
<extraclasspaths>
<path refid="test.extraclasspath" />
</extraclasspaths>
</gwt.junit>
</target>
<target name="test.web.disableClassMetadata" depends="compile, compile.tests" description="Run only web-mode tests for this project.">
<fileset id="test.web.disableClassMetadata.tests" dir="${javac.junit.out}" includes="${gwt.junit.testcase.web.includes}" excludes="${gwt.junit.testcase.web.excludes}" />
<gwt.junit test.args="${test.args} -XdisableClassMetadata -out www -web" test.out="${junit.out}/${build.host.platform}-web-mode-disableClassMetadata" test.cases="test.web.disableClassMetadata.tests" >
<extraclasspaths>
<path refid="test.extraclasspath" />
</extraclasspaths>
</gwt.junit>
</target>
<target name="test.web.draft" depends="compile, compile.tests" description="Run only web-mode tests for this project, not batching tests on purpose.">
<fileset id="test.web.draft.tests" dir="${javac.junit.out}" includes="${gwt.junit.testcase.web.includes}" excludes="${gwt.junit.testcase.web.excludes}" />
<gwt.junit test.args="${test.args} -draftCompile -out www -web" test.out="${junit.out}/${build.host.platform}-web-mode-draft" test.cases="test.web.draft.tests" >
<extraclasspaths>
<path refid="test.extraclasspath" />
</extraclasspaths>
</gwt.junit>
</target>
<target name="test" depends="compile, compile.tests" description="Run hosted-mode, web-mode, remoteweb, and selenium tests for this project.">
<property.ensure name="distro.built" location="${gwt.dev.staging.jar}" message="GWT must be built before performing any tests. This can be fixed by running ant in the ${gwt.root} directory." />
<property name="emma.compiled" value="true" />
<!--
Run hosted and web mode tests for the platform on which this build
is executing
-->
<limit failonerror="true" hours="${test.timeout}">
<parallel threadsPerProcessor="${gwt.threadsPerProcessor}">
<!-- selenium-test is a no-op unless gwt.selenium.hosts is defined -->
<antcall target="test.selenium"/>
<!-- remoteweb-test is a no-op unless gwt.remote.browsers is defined -->
<antcall target="test.remoteweb"/>
<antcall target="test.hosted"/>
<antcall target="test.hosted.emma"/>
<antcall target="test.noserver"/>
<antcall target="test.web"/>
<antcall target="test.web.disableClassMetadata"/>
<antcall target="test.web.draft"/>
</parallel>
</limit>
</target>
<target name="emma.merge" description="Merges coverage data for the entire project">
<delete dir="${emma.merged.out}" />
<mkdir dir="${emma.merged.out}" />
<emma>
<merge outfile="${emma.merged.out}/merged.emma" >
<fileset dir="${junit.out}" >
<include name="**/*.emma" />
<exclude name="${emma.merged.out}/merged.emma" />
</fileset>
</merge>
</emma>
<emma>
<report sourcepath="${project.classpath.src}">
<fileset file="${javac.emma.out}/metadata.emma" />
<fileset file="${emma.merged.out}/merged.emma" />
<txt outfile="${emma.merged.out}/coverage.txt" />
<html outfile="${emma.merged.out}/coverage.html" />
<xml outfile="${emma.merged.out}/coverage.xml" />
</report>
</emma>
</target>
<target name="clean" description="Cleans this project's intermediate and output files">
<delete dir="${project.build}" />
<delete file="${project.lib}" />
</target>
<target name="presubmit" depends="test, checkstyle" description="runs the gwt api checker, user checkstyle, and user tests">
<gwt.ant dir=".." target="apicheck-nobuild"/>
</target>
</project>