blob: 8ee1c4ced90a8b0beddd2d0e32d4e58b9cf987f9 [file] [log] [blame]
<?xml version="1.0"?>
<project name="guice" default="compile">
<import file="common.xml"/>
<path id="compile.classpath">
<fileset dir="${lib.dir}" includes="*.jar"/>
<fileset dir="${lib.dir}/build" includes="*.jar"/>
</path>
<target name="jar" depends="jar.withdeps, manifest" description="Build jar.">
<jar jarfile="${build.dir}/dist/guice-${version}.jar"
manifest="${build.dir}/META-INF/MANIFEST.MF">
<zipfileset src="${build.dir}/${ant.project.name}-with-deps.jar"/>
</jar>
</target>
<target name="dist" depends="distjars, javadoc"
description="Build entire distribution.">
<ant antfile="extensions/servlet/build.xml" target="distjars" inheritAll="false"/>
<ant antfile="extensions/spring/build.xml" target="distjars" inheritAll="false"/>
<ant antfile="extensions/struts2/build.xml" target="distjars" inheritAll="false"/>
<ant antfile="extensions/assistedinject/build.xml" target="distjars" inheritAll="false"/>
<ant antfile="extensions/jmx/build.xml" target="distjars" inheritAll="false"/>
<ant antfile="extensions/jndi/build.xml" target="distjars" inheritAll="false"/>
<ant antfile="extensions/throwingproviders/build.xml" target="distjars" inheritAll="false"/>
<ant antfile="extensions/multibindings/build.xml" target="distjars" inheritAll="false"/>
<ant antfile="extensions/persist/build.xml" target="distjars" inheritAll="false"/>
<ant antfile="extensions/grapher/build.xml" target="distjars" inheritAll="false"/>
<copy toDir="${build.dir}/dist">
<fileset dir="extensions/servlet/build" includes="*.jar" excludes="*-with-deps.jar"/>
</copy>
<copy toDir="${build.dir}/dist">
<fileset dir="extensions/spring/build" includes="*.jar" excludes="*-with-deps.jar"/>
</copy>
<copy toDir="${build.dir}/dist">
<fileset dir="extensions/struts2/build" includes="*.jar" excludes="*-with-deps.jar"/>
</copy>
<copy toDir="${build.dir}/dist">
<fileset dir="extensions/assistedinject/build" includes="*.jar" excludes="*-with-deps.jar"/>
</copy>
<copy toDir="${build.dir}/dist">
<fileset dir="extensions/jmx/build" includes="*.jar" excludes="*-with-deps.jar"/>
</copy>
<copy toDir="${build.dir}/dist">
<fileset dir="extensions/jndi/build" includes="*.jar" excludes="*-with-deps.jar"/>
</copy>
<copy toDir="${build.dir}/dist">
<fileset dir="extensions/throwingproviders/build" includes="*.jar" excludes="*-with-deps.jar"/>
</copy>
<copy toDir="${build.dir}/dist">
<fileset dir="extensions/multibindings/build" includes="*.jar" excludes="*-with-deps.jar"/>
</copy>
<copy toDir="${build.dir}/dist">
<fileset dir="extensions/persist/build" includes="*.jar" excludes="*-with-deps.jar"/>
</copy>
<copy toDir="${build.dir}/dist">
<fileset dir="extensions/grapher/build" includes="*.jar" excludes="*-with-deps.jar"/>
</copy>
<copy toDir="${build.dir}/dist" file="COPYING"/>
<copy toDir="${build.dir}/dist">
<fileset dir="${lib.dir}"
includes="*.jar"/>
</copy>
<copy toDir="${build.dir}/dist">
<fileset dir="${build.dir}" includes="javadoc/**/*"/>
</copy>
<zip destfile="${build.dir}/guice-${version}.zip">
<zipfileset dir="${build.dir}/dist" prefix="guice-${version}" excludes="*-src.jar"/>
</zip>
<zip destfile="${build.dir}/guice-${version}-src.zip">
<zipfileset dir="." prefix="guice-${version}-src"
excludes="build/**,**/.svn/**,classes/**,.settings/**,bin/**,latest-api-diffs/**,latest-javadoc/**,.classpath,.project"/>
</zip>
</target>
<target name="test.dist"
depends="jar, test.compile-with-deps"
description="Execute JUnit tests against distribution jar.">
<java fork="true"
classname="junit.textui.TestRunner"
failonerror="true"
taskname="junit">
<classpath>
<pathelement location="${build.dir}/guice-${version}-tests.jar"/>
<pathelement location="${build.dir}/dist/guice-${version}.jar"/>
<pathelement location="lib/aopalliance.jar"/>
<pathelement location="lib/build/junit.jar"/>
<pathelement location="lib/build/servlet-api-2.5.jar"/>
<pathelement location="lib/build/easymock.jar"/>
<pathelement location="lib/javax.inject.jar"/>
<pathelement location="lib/build/javax.inject-tck.jar"/>
<pathelement location="lib/build/bnd-0.0.384.jar"/>
<pathelement location="lib/build/felix-2.0.5.jar"/>
</classpath>
<arg value="com.google.inject.AllTests"/>
<syspropertyset>
<propertyref name="guice.custom.loader"/>
<propertyref name="version"/>
<propertyref name="build.dir"/>
<propertyref name="lib.dir"/>
</syspropertyset>
</java>
</target>
<property name="old.api" value="2.0"/>
<property name="new.api" value="3.0"/>
<target name="jdiff">
<property name="jdiff.home" value="lib/build/jdiff"/>
<property name="jdiff.tmp" value="build/docs/latest-api-diffs"/>
<delete dir="${jdiff.tmp}"/>
<mkdir dir="${jdiff.tmp}"/>
<!-- Generate API for current version. -->
<javadoc packagenames="com.google.*"
docletpath="${jdiff.home}/jdiff.jar${path.separator}${jdiff.home}/xerces.jar"
maxmemory="512M"
classpath="lib/javax.inject.jar${path.separator}lib/aopalliance.jar">
<fileset dir="${src.dir}" defaultexcludes="yes">
<include name="com/google/**"/>
<exclude name="com/google/inject/internal/**"/>
</fileset>
<fileset dir="${servlet.src.dir}"/>
<fileset dir="${spring.src.dir}"/>
<fileset dir="${assistedinject.src.dir}"/>
<fileset dir="${jmx.src.dir}"/>
<fileset dir="${jndi.src.dir}"/>
<fileset dir="${throwingproviders.src.dir}"/>
<fileset dir="${multibindings.src.dir}"/>
<fileset dir="${persist.src.dir}"/>
<fileset dir="${struts2.src.dir}"/>
<fileset dir="${grapher.src.dir}"/>
<doclet name="jdiff.JDiff"
path="${jdiff.home}/jdiff.jar:${jdiff.home}/xerces.jar">
<param name="-apidir" value="${jdiff.tmp}" />
<param name="-apiname" value="${new.api}" />
</doclet>
</javadoc>
<!-- Do a diff against the previous version. -->
<javadoc packagenames="com.google.*"
destdir="${jdiff.tmp}"
docletpath="${jdiff.home}/jdiff.jar${path.separator}${jdiff.home}/xerces.jar"
maxmemory="512M"
sourcefiles="${jdiff.home}/Null.java"
classpath="lib/javax.inject.jar${path.separator}lib/aopalliance.jar">
<doclet name="jdiff.JDiff">
<param name="-oldapi" value="${old.api}"/>
<param name="-oldapidir" value="latest-api-diffs"/>
<param name="-javadocold" value="http://google-guice.googlecode.com/svn/trunk/latest-api-diffs/${old.api}/javadoc/"/>
<param name="-newapi" value="${new.api}"/>
<param name="-newapidir" value="${jdiff.tmp}"/>
<param name="-javadocnew" value="http://google-guice.googlecode.com/svn/trunk/latest-api-diffs/${new.api}/javadoc/"/>
<param name="-stats"/>
<param name="-docchanges"/>
</doclet>
</javadoc>
</target>
<target name="javadoc">
<javadoc packagenames="com.google.*"
destdir="build/docs"
docletpath="lib/build/doclava.jar"
bootclasspath="${java.home}/lib/rt.jar"
maxmemory="512M"
classpath="lib/javax.inject.jar${path.separator}lib/aopalliance.jar">
<fileset dir="${src.dir}" defaultexcludes="yes">
<include name="com/google/**"/>
<exclude name="com/google/inject/internal/**"/>
</fileset>
<fileset dir="${servlet.src.dir}"/>
<fileset dir="${spring.src.dir}"/>
<fileset dir="${assistedinject.src.dir}"/>
<fileset dir="${jmx.src.dir}"/>
<fileset dir="${jndi.src.dir}"/>
<fileset dir="${throwingproviders.src.dir}"/>
<fileset dir="${multibindings.src.dir}"/>
<fileset dir="${persist.src.dir}"/>
<fileset dir="${grapher.src.dir}"/>
<!-- TODO: this breaks Doclava for some reason
<fileset dir="${struts2.src.dir}"/> -->
<doclet name="com.google.doclava.Doclava">
<param name="-hdf"/> <param name="project.name"/> <param name="Guice"/>
<param name="-since"/> <param name="lib/build/guice-1.0.xml"/> <param name="Guice_1.0" />
<param name="-since"/> <param name="lib/build/guice-2.0.xml"/> <param name="Guice_2.0" />
<param name="-apiversion" value="Guice_${new.api}"/>
<param name="-assetsdir" value="javadoc/assets"/>
<param name="-apixml" value="build/docs/guice-${new.api}.xml"/>
<!-- TODO: fix doclava federation
http://aopalliance.sourceforge.net/doc
http://www.springframework.org/docs/api/
<param name="-federate"/><param name="JDK"/><param name="http://download.oracle.com/javase/6/docs/api/index.html?"/>
<param name="-federationxml"/><param name="JDK"/><param name="http://doclava.googlecode.com/svn/static/api/openjdk-6.xml"/>
-->
</doclet>
</javadoc>
<move todir="build/docs/javadoc"><fileset dir="build/docs/reference"/></move>
</target>
<target name="no_aop"
description="Create a copy of the Guice source that doesn't do bytecode generation.">
<taskdef name="munge" classname="MungeTask" classpath="lib/build/munge.jar"/>
<mkdir dir="build/no_aop"/>
<munge todir="build/no_aop">
<fileset dir=".">
<!-- exclude generated files -->
<exclude name="build/**"/>
<exclude name="classes/**"/>
<exclude name="latest-api-diffs/**"/>
<exclude name="javadoc/**"/>
<exclude name="latest-javadoc/**"/>
<!-- exclude AOP-specific libraries -->
<exclude name="lib/aopalliance.jar"/>
<exclude name="lib/build/asm-*.jar"/>
<exclude name="lib/build/cglib-*.jar"/>
<!-- exclude AOP-specific classes -->
<exclude name="**/LineNumbers.java"/>
<exclude name="**/InterceptorBindingProcessor.java"/>
<exclude name="**/ProxyFactory.java"/>
<exclude name="**/ProxyFactoryTest.java"/>
<exclude name="**/InterceptorStackCallback.java"/>
<exclude name="**/InterceptorBinding.java"/>
<exclude name="**/MethodAspect.java"/>
<exclude name="**/MethodInterceptionTest.java"/>
<exclude name="**/BytecodeGenTest.java"/>
<exclude name="**/IntegrationTest.java"/>
<exclude name="**/MethodInterceptionTest.java"/>
</fileset>
<arg value="-DNO_AOP" />
</munge>
<replace file="build/no_aop/common.xml" token="&lt;zipfileset src=&quot;${common.basedir}/lib/build/asm-3.3.1.jar&quot;/&gt;" value=""/>
<replace file="build/no_aop/common.xml" token="&lt;zipfileset src=&quot;${common.basedir}/lib/build/cglib-2.2.2.jar&quot;/&gt;" value=""/>
</target>
<target name="clean.all"
depends="clean"
description="Remove generated files.">
<ant dir="extensions/servlet" antfile="build.xml" target="clean"/>
<ant dir="extensions/spring" antfile="build.xml" target="clean"/>
<ant dir="extensions/struts2" antfile="build.xml" target="clean"/>
<ant dir="extensions/assistedinject" antfile="build.xml" target="clean"/>
<ant dir="extensions/jmx" antfile="build.xml" target="clean"/>
<ant dir="extensions/jndi" antfile="build.xml" target="clean"/>
<ant dir="extensions/throwingproviders" antfile="build.xml" target="clean"/>
<ant dir="extensions/multibindings" antfile="build.xml" target="clean"/>
<ant dir="extensions/persist" antfile="build.xml" target="clean"/>
<ant dir="extensions/grapher" antfile="build.xml" target="clean"/>
</target>
</project>