| <?xml version="1.0"?> |
| |
| <!-- |
| |
| You must: |
| * have JAVA_HOME set to a recent JDK 6 installation |
| * have JAVA5_HOME set to a recent JDK 1.5.0 installation, |
| or specify this with -Djava5home= |
| * have unzipped $JAVA_HOME/src.zip to $JAVA_HOME/src, |
| or specify this with -Djavasrc= |
| * specify -Drelease=r09 (for example) on the ant command line |
| |
| If you build the GWT target, you must: |
| * have GWT_HOME set to a recent GWT SDK directory, or specify this with |
| -Dgwthome= |
| --> |
| |
| <!-- |
| Currently, guava source files are required to be UTF-8 encoded, but |
| non-ASCII characters are permitted only in comments, so that they |
| can also be built by tools that use the historic -encoding=ISO-8859-1 |
| (which works only because *any* byte sequence is valid ISO-8859-1.) |
| Hopefully the comment restriction will be lifted in a future release. |
| --> |
| |
| <project name="guava" default="compile"> |
| |
| <property environment="env"/> |
| |
| <!-- these properties can be overridden at the command line with |
| -Dname=value, or in IDEA in the ant properties dialog --> |
| |
| <property name="release" value="unknown"/> |
| <property name="java5home" value="${env.JAVA5_HOME}" /> |
| <property name="javasrc" value="${env.JAVA_HOME}/src" /> |
| <property name="gwthome" value="lib" /> |
| <property name="fulljavadoc" value="true" /> |
| |
| <target name="compile" description="Compile Java source."> |
| <mkdir dir="build/classes"/> |
| |
| <property name="java5bootclasspath" value="${java5home}/jre/lib/rt.jar"/> |
| |
| <available file="${java5bootclasspath}" property="isJava5HomeSetRight"/> |
| <fail unless="isJava5HomeSetRight" |
| message="JAVA5_HOME must be set to a valid JDK 1.5 installation, containing a jre/lib/rt.jar file"/> |
| |
| <javac srcdir="src" |
| debug="on" |
| destdir="build/classes" |
| encoding="UTF-8" |
| source="1.5" |
| target="1.5" |
| bootclasspath="${java5bootclasspath}" |
| extdirs=""> |
| <compilerarg value="-Xlint:all"/> |
| <compilerarg value="-XDignore.symbol.file"/> |
| <classpath> |
| <pathelement location="lib/jsr305.jar"/> |
| </classpath> |
| </javac> |
| </target> |
| |
| <target name="jar" depends="compile" description="Build jar."> |
| <mkdir dir="build/dist/guava-${release}"/> |
| <jar jarfile="build/dist/guava-${release}/guava-${release}.jar"> |
| <fileset dir="build/classes"/> |
| </jar> |
| </target> |
| |
| <target name="javadoc" description="Generate Javadocs"> |
| <delete dir="build/javadoc"/> |
| <mkdir dir="build/javadoc"/> |
| |
| <javadoc packagenames="com.google.common.*" |
| destdir="build/javadoc" |
| encoding="UTF-8" |
| docencoding="UTF-8" |
| charset="UTF-8" |
| additionalparam="-XDignore.symbol.file" |
| author="true" |
| protected="true" |
| use="${fulljavadoc}" |
| linksource="${fulljavadoc}" |
| windowtitle="Guava: Google Core Libraries for Java - ${release}"> |
| <sourcepath> |
| <pathelement location="src"/> |
| <pathelement location="${javasrc}"/> |
| </sourcepath> |
| <!-- workaround for http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6442982 --> |
| <classpath> |
| <pathelement location="lib/jsr305.jar"/> |
| </classpath> |
| <link href="http://jsr-305.googlecode.com/svn/trunk/javadoc"/> |
| <link href="http://download.oracle.com/javase/6/docs/api"/> |
| </javadoc> |
| |
| <!-- remove dumb comments inserted by javadoc so that we only see svn diffs |
| when things actually change. --> |
| <replaceregexp |
| match="^.*(META NAME=.date|generated by javadoc ).*$\n" |
| replace="" |
| flags="gmi"> |
| <fileset dir="build/javadoc" includes="**/*.html"/> |
| </replaceregexp> |
| </target> |
| |
| <target name="jdiff" description="Generate JDiff report"> |
| <mkdir dir="build/javadoc/jdiff"/> |
| <javadoc doclet="jdiff.JDiff" |
| docletpath="lib/jdiff.jar" |
| additionalparam="-XDignore.symbol.file -apiname 'Guava ${release}' -apidir build/javadoc/jdiff" |
| packagenames="com.google.common.*" |
| destdir="build/javadoc/jdiff" |
| encoding="UTF-8"> |
| <sourcepath> |
| <pathelement location="src"/> |
| </sourcepath> |
| <classpath> |
| <pathelement location="lib/jsr305.jar"/> |
| </classpath> |
| </javadoc> |
| |
| <!-- remove dumb comments inserted by jdiff so that we only see svn diffs when things actually change. --> |
| <replaceregexp match="^.!--\s+(on|Command line arguments) .* -->$\n" |
| replace="" flags="gm" file="build/javadoc/jdiff/Guava_${release}.xml"/> |
| </target> |
| |
| <target name="zipsrc" description="Build zip of source."> |
| <mkdir dir="build/dist/guava-${release}"/> |
| <jar jarfile="build/dist/guava-${release}/guava-src-${release}.zip"> |
| <fileset dir="src"/> |
| </jar> |
| </target> |
| |
| <target name="dist" depends="jar, gwtjar, zipsrc, javadoc" |
| description="Build entire distribution."> |
| <copy toDir="build/dist/guava-${release}" file="AUTHORS"/> |
| <copy toDir="build/dist/guava-${release}" file="CONTRIBUTORS"/> |
| <copy toDir="build/dist/guava-${release}" file="COPYING"/> |
| <copy toDir="build/dist/guava-${release}" file="README"/> |
| <copy toDir="build/dist/guava-${release}"> |
| <fileset dir="build" includes="javadoc/**/*" excludes="javadoc/jdiff/**/*"/> |
| </copy> |
| |
| <zip destfile="build/guava-${release}.zip" |
| basedir="build/dist"/> |
| </target> |
| |
| <target name="gwt.compile" |
| description="Compile GWT source." |
| depends="compile"> |
| <mkdir dir="build/gwt-classes"/> |
| <javac srcdir="gwt-src" |
| debug="on" |
| destdir="build/gwt-classes" |
| encoding="UTF-8" |
| source="1.5" |
| target="1.5"> |
| <compilerarg value="-Xlint:all"/> |
| <classpath> |
| <pathelement location="build/classes" /> |
| <pathelement location="lib/jsr305.jar"/> |
| <pathelement location="${gwthome}/gwt-user.jar"/> |
| <pathelement location="${gwthome}/gwt-dev.jar"/> |
| </classpath> |
| </javac> |
| </target> |
| |
| <target name="gwtjar" |
| description="Build a jar of GWT source and classfiles of GWT-only classes." |
| depends="jar, gwt.compile"> |
| <mkdir dir="build/dist/guava-${release}"/> |
| <jar jarfile="build/dist/guava-${release}/guava-${release}-gwt.jar"> |
| <!-- Includes the @GwtCompatible non-emulated source. --> |
| <fileset dir="src"> |
| <and> |
| <contains text="@GwtCompatible"/> |
| <not> |
| <contains text="emulated = true"/> |
| </not> |
| </and> |
| </fileset> |
| <fileset dir="gwt-src"/> |
| <fileset dir="build/gwt-classes"/> |
| <fileset dir="gwt-super"/> |
| </jar> |
| </target> |
| |
| <target name="gwt.javadoc" description="Generate Javadocs for GWT sources."> |
| <delete dir="build/gwt-javadoc"/> |
| <mkdir dir="build/gwt-javadoc"/> |
| |
| <delete dir="build/gwt-javadoc-src"/> |
| <mkdir dir="build/gwt-javadoc-src"/> |
| |
| <!-- Flatten the regular source and supersource in the same directory |
| tree. --> |
| <copy toDir="build/gwt-javadoc-src"> |
| <fileset dir="src"> |
| <and> |
| <contains text="@GwtCompatible"/> |
| <not> |
| <contains text="emulated = true"/> |
| </not> |
| </and> |
| </fileset> |
| </copy> |
| <!-- Exclude the CustomFieldSerializers because they are not part of |
| the API. They are public only for GWT. --> |
| <copy toDir="build/gwt-javadoc-src"> |
| <fileset dir="gwt-src" excludes="**/*_CustomFieldSerializer.java"/> |
| </copy> |
| <copy toDir="build/gwt-javadoc-src"> |
| <fileset dir="gwt-super/com/google/common/base/super"/> |
| </copy> |
| <copy toDir="build/gwt-javadoc-src"> |
| <fileset dir="gwt-super/com/google/common/collect/super"/> |
| </copy> |
| <copy toDir="build/gwt-javadoc-src"> |
| <fileset dir="gwt-super/com/google/common/net/super"/> |
| </copy> |
| <copy toDir="build/gwt-javadoc-src"> |
| <fileset dir="gwt-super/com/google/common/primitives/super"/> |
| </copy> |
| |
| <javadoc packagenames="com.google.common.*" |
| destdir="build/gwt-javadoc" |
| encoding="UTF-8" |
| docencoding="UTF-8" |
| charset="UTF-8" |
| use="true" |
| author="true" |
| protected="true" |
| linksource="true" |
| windowtitle="Guava: Google Core Libraries for GWT - ${release}"> |
| <sourcepath> |
| <pathelement location="build/gwt-javadoc-src"/> |
| <pathelement location="${javasrc}"/> |
| </sourcepath> |
| |
| <!-- workaround for http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6442982 --> |
| <classpath> |
| <pathelement location="lib/jsr305.jar"/> |
| <pathelement location="${gwthome}/gwt-user.jar"/> |
| <pathelement location="${gwthome}/gwt-dev.jar"/> |
| </classpath> |
| |
| <link href="http://jsr-305.googlecode.com/svn/trunk/javadoc"/> |
| <link href="http://download.oracle.com/javase/6/docs/api"/> |
| <link href="http://google-web-toolkit.googlecode.com/svn/javadoc/2.1"/> |
| </javadoc> |
| |
| <!-- remove dumb comments inserted by javadoc so that we only see svn diffs |
| when things actually change. --> |
| <replaceregexp |
| match="^.*(META NAME=.date|generated by javadoc ).*$\n" |
| replace="" |
| flags="gmi"> |
| <fileset dir="build/gwt-javadoc" includes="**/*.html"/> |
| </replaceregexp> |
| |
| <!-- Clean up the temp directory so that it isn't part of the final |
| codebase. --> |
| <delete dir="build/gwt-javadoc-src"/> |
| </target> |
| |
| <target name="gwt.test.compile" |
| description="Compile the GWT test sources with javac." |
| depends="gwtjar"> |
| <mkdir dir="build/gwt-test-classes"/> |
| <javac srcdir="gwt-test" |
| debug="on" |
| destdir="build/gwt-test-classes" |
| encoding="UTF-8" |
| source="1.5" |
| target="1.5"> |
| <compilerarg value="-Xlint:all"/> |
| <classpath> |
| <pathelement location="build/classes" /> |
| <pathelement location="build/gwt-classes" /> |
| <pathelement location="lib/jsr305.jar"/> |
| <pathelement location="${gwthome}/gwt-user.jar"/> |
| <pathelement location="${gwthome}/gwt-dev.jar"/> |
| </classpath> |
| </javac> |
| </target> |
| |
| <macrodef name="test.gwtc"> |
| <attribute name="testmodule" /> |
| <sequential> |
| <java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler"> |
| <classpath> |
| <!-- The source and classfiles under test.--> |
| <pathelement location="build/dist/guava-${release}/guava-${release}-gwt.jar" /> |
| <pathelement location="build/dist/guava-${release}/guava-${release}.jar" /> |
| |
| <pathelement location="gwt-test" /> |
| <pathelement location="build/gwt-test-classes" /> |
| <pathelement location="lib/jsr305.jar"/> |
| <pathelement location="${gwthome}/gwt-user.jar"/> |
| <pathelement location="${gwthome}/gwt-dev.jar"/> |
| </classpath> |
| <!-- add jvmarg -Xss16M or similar if you see a StackOverflowError --> |
| <jvmarg value="-Xmx256M"/> |
| <arg line="-war"/> |
| <arg value="war"/> |
| <arg value="@{testmodule}"/> |
| </java> |
| </sequential> |
| </macrodef> |
| |
| <target name="all.gwtc.tests" |
| description="Tests by compiling the modules in GWT" |
| depends="gwtjar, gwt.test.compile"> |
| <test.gwtc testmodule="com.google.common.base.testModule" /> |
| <test.gwtc testmodule="com.google.common.collect.testModule" /> |
| <test.gwtc testmodule="com.google.common.net.testModule" /> |
| <test.gwtc testmodule="com.google.common.primitives.testModule" /> |
| </target> |
| |
| <target name="clean" |
| description="Remove generated files."> |
| <delete dir="build"/> |
| </target> |
| |
| </project> |