cromwellian@google.com | 6d1abb3 | 2012-06-13 22:32:29 +0000 | [diff] [blame] | 1 | <project name="elemental" default="build" basedir="."> |
| 2 | <property name="gwt.root" location=".." /> |
| 3 | <property name="project.tail" value="elemental" /> |
| 4 | <property name="test.args" value="-ea" /> |
| 5 | <property name="test.jvmargs" value="-ea" /> |
| 6 | |
| 7 | <import file="${gwt.root}/common.ant.xml" /> |
| 8 | |
| 9 | <!-- Platform shouldn't matter here, just picking one --> |
| 10 | <property.ensure name="gwt.dev.jar" location="${gwt.build.lib}/gwt-dev.jar" /> |
| 11 | <property.ensure name="gwt.user.jar" location="${gwt.build.lib}/gwt-user.jar" /> |
| 12 | |
Manuel Carrasco Moñino | fe28714 | 2014-08-06 11:32:15 +0200 | [diff] [blame] | 13 | <target name="check.generated" description="Check whether elemental code has been generated"> |
| 14 | <condition property="generated"> |
| 15 | <available file="idl/generated/src" type="dir" /> |
| 16 | </condition> |
| 17 | </target> |
| 18 | |
cromwellian@google.com | 6d1abb3 | 2012-06-13 22:32:29 +0000 | [diff] [blame] | 19 | <target name="generate" description="Generate Elemental bindings from IDL"> |
| 20 | <exec executable="idl/build" dir="." failonerror="true"/> |
| 21 | </target> |
| 22 | |
| 23 | <target name="compile" description="Compile all class files"> |
| 24 | <mkdir dir="${javac.out}" /> |
skybrian@google.com | daebbcb | 2012-06-15 16:42:27 +0000 | [diff] [blame] | 25 | <gwt.javac srcdir="src:idl/generated/src" excludes="**/super/**"> |
cromwellian@google.com | 6d1abb3 | 2012-06-13 22:32:29 +0000 | [diff] [blame] | 26 | <classpath> |
| 27 | <pathelement location="${gwt.dev.jar}" /> |
| 28 | <pathelement location="${gwt.user.jar}" /> |
| 29 | </classpath> |
| 30 | </gwt.javac> |
| 31 | </target> |
| 32 | |
Manuel Carrasco Moñino | fe28714 | 2014-08-06 11:32:15 +0200 | [diff] [blame] | 33 | <target name="compile.tests" if="generated" depends="check.generated" description="Compile Tests"> |
| 34 | <echo message="${javac.junit.out}" /> |
| 35 | <mkdir dir="${javac.junit.out}" /> |
Brian Slesinsky | 924fa4b | 2014-10-03 10:17:12 -0700 | [diff] [blame] | 36 | <gwt.javac srcdir="src:idl/generated/src:tests" destdir="${javac.junit.out}" excludes="**/super/**"> |
Manuel Carrasco Moñino | fe28714 | 2014-08-06 11:32:15 +0200 | [diff] [blame] | 37 | <classpath> |
| 38 | <pathelement location="${javac.out}"/> |
| 39 | <pathelement location="${gwt.dev.jar}" /> |
| 40 | <pathelement location="${gwt.user.jar}" /> |
| 41 | <pathelement location="${gwt.tools.lib}/junit/junit-4.8.2.jar" /> |
| 42 | </classpath> |
Brian Slesinsky | 924fa4b | 2014-10-03 10:17:12 -0700 | [diff] [blame] | 43 | </gwt.javac> |
Manuel Carrasco Moñino | fe28714 | 2014-08-06 11:32:15 +0200 | [diff] [blame] | 44 | </target> |
| 45 | |
cromwellian@google.com | 6d1abb3 | 2012-06-13 22:32:29 +0000 | [diff] [blame] | 46 | <target name="build" depends="generate, compile" |
| 47 | description="Creates gwt-elemental.jar"> |
| 48 | <mkdir dir="${gwt.build.lib}" /> |
| 49 | <gwt.jar> |
| 50 | <fileset dir="src" excludes="**/package.html" /> |
| 51 | <fileset dir="idl/generated/src"/> |
| 52 | <fileset dir="${javac.out}" /> |
| 53 | </gwt.jar> |
| 54 | </target> |
| 55 | |
Manuel Carrasco Moñino | 77c7a8e | 2014-10-07 13:38:15 +0200 | [diff] [blame] | 56 | <macrodef name="run-tests"> |
| 57 | <attribute name="output"/> |
| 58 | <attribute name="args"/> |
| 59 | <attribute name="classes"/> |
| 60 | <sequential> |
| 61 | <fileset id="tests" dir="${javac.junit.out}" includes="@{classes}" /> |
| 62 | <gwt.junit test.name="test" |
| 63 | test.args="@{args}" |
| 64 | test.jvmargs="${test.jvmargs}" |
| 65 | test.out="@{output}" |
| 66 | test.cases="tests"> |
| 67 | <extraclasspaths> |
| 68 | <pathelement location="${gwt.root}/elemental/src" /> |
| 69 | <pathelement location="${gwt.root}/elemental/idl/generated/src" /> |
| 70 | <pathelement location="${gwt.root}/elemental/tests" /> |
| 71 | <pathelement location="${gwt.dev.jar}" /> |
| 72 | <pathelement location="${gwt.user.jar}" /> |
| 73 | </extraclasspaths> |
| 74 | </gwt.junit> |
| 75 | </sequential> |
| 76 | </macrodef> |
| 77 | |
| 78 | <target name="test.dev.htmlunit" if="generated" depends="compile.tests" |
Manuel Carrasco Moñino | 8c52eb6 | 2016-02-17 10:47:54 +0100 | [diff] [blame] | 79 | unless="test.dev.htmlunit.disable" |
Manuel Carrasco Moñino | 77c7a8e | 2014-10-07 13:38:15 +0200 | [diff] [blame] | 80 | description="Run tests with HtmlUnit in dev mode"> |
Daniel Kurka | 02981cd | 2015-09-05 00:48:26 +0200 | [diff] [blame] | 81 | <run-tests output="${junit.out}/dev" args="${test.args} -devMode" classes="**/AllTests.class"/> |
Manuel Carrasco Moñino | fe28714 | 2014-08-06 11:32:15 +0200 | [diff] [blame] | 82 | </target> |
| 83 | |
Manuel Carrasco Moñino | 77c7a8e | 2014-10-07 13:38:15 +0200 | [diff] [blame] | 84 | <target name="test.web.htmlunit" if="generated" depends="compile.tests" |
Manuel Carrasco Moñino | 8c52eb6 | 2016-02-17 10:47:54 +0100 | [diff] [blame] | 85 | unless="test.web.htmlunit.disable" |
Manuel Carrasco Moñino | 77c7a8e | 2014-10-07 13:38:15 +0200 | [diff] [blame] | 86 | description="Run tests with HtmlUnit in prod mode"> |
| 87 | <run-tests output="${junit.out}/web" args="${test.args} -prod" classes="**/AllTests.class"/> |
| 88 | </target> |
| 89 | |
Manuel Carrasco Moñino | 29fe72a | 2014-10-08 08:08:02 +0200 | [diff] [blame] | 90 | <target name="test.nongwt" if="generated" depends="compile.tests" |
Manuel Carrasco Moñino | 8c52eb6 | 2016-02-17 10:47:54 +0100 | [diff] [blame] | 91 | unless="test.nongwt.disable" |
Manuel Carrasco Moñino | 29fe72a | 2014-10-08 08:08:02 +0200 | [diff] [blame] | 92 | description="Run tests in the JVM"> |
| 93 | <run-tests output="${junit.out}/nongwt" args="" classes="**/*JreTest.class"/> |
| 94 | </target> |
| 95 | |
Manuel Carrasco Moñino | 8c52eb6 | 2016-02-17 10:47:54 +0100 | [diff] [blame] | 96 | <target name="test" |
| 97 | unless="test.elemental.disable" |
| 98 | description="Run all Elemental tests"> |
Manuel Carrasco Moñino | 29fe72a | 2014-10-08 08:08:02 +0200 | [diff] [blame] | 99 | <antcall target="test.nongwt" /> |
Manuel Carrasco Moñino | 77c7a8e | 2014-10-07 13:38:15 +0200 | [diff] [blame] | 100 | <antcall target="test.web.htmlunit" /> |
| 101 | <antcall target="test.dev.htmlunit" /> |
| 102 | </target> |
| 103 | |
| 104 | <macrodef name="compileModule"> |
| 105 | <element name="module" /> |
| 106 | <sequential> |
| 107 | <java classname="com.google.gwt.dev.CompileModule" fork="yes" failonerror="true"> |
| 108 | <classpath> |
| 109 | <pathelement location="${gwt.root}/elemental/src" /> |
| 110 | <pathelement location="${gwt.root}/elemental/idl/generated/src" /> |
| 111 | <pathelement location="${gwt.dev.jar}" /> |
| 112 | <pathelement location="${gwt.user.jar}" /> |
| 113 | </classpath> |
| 114 | <jvmarg value="-Xmx512M" /> |
| 115 | <module /> |
| 116 | <arg value="-strict" /> |
Manuel Carrasco Moñino | 77c7a8e | 2014-10-07 13:38:15 +0200 | [diff] [blame] | 117 | <arg value="-out" /> |
| 118 | <arg value="${project.build}/bin" /> |
| 119 | </java> |
| 120 | </sequential> |
| 121 | </macrodef> |
cromwellian@google.com | 6d1abb3 | 2012-06-13 22:32:29 +0000 | [diff] [blame] | 122 | |
| 123 | <target name="clean" |
| 124 | description="Cleans this project's intermediate and output files"> |
skybrian@google.com | daebbcb | 2012-06-15 16:42:27 +0000 | [diff] [blame] | 125 | <delete dir="idl/generated" /> |
| 126 | <delete dir="idl/database" /> |
cromwellian@google.com | 6d1abb3 | 2012-06-13 22:32:29 +0000 | [diff] [blame] | 127 | <delete dir="${project.build}" /> |
Manuel Carrasco Moñino | fe28714 | 2014-08-06 11:32:15 +0200 | [diff] [blame] | 128 | <delete dir="${javac.junit.out}" /> |
cromwellian@google.com | 6d1abb3 | 2012-06-13 22:32:29 +0000 | [diff] [blame] | 129 | <delete file="${project.lib}" /> |
| 130 | </target> |
| 131 | </project> |