blob: 6b436333f841732d399584571af91b3b8a3861e8 [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="servlet/build.xml" target="distjars" inheritAll="false"/>
<ant antfile="spring/build.xml" target="distjars" inheritAll="false"/>
<ant antfile="struts2/plugin/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"/>
<copy toDir="${build.dir}/dist">
<fileset dir="servlet/build" includes="*.jar" excludes="*-with-deps.jar"/>
</copy>
<copy toDir="${build.dir}/dist">
<fileset dir="spring/build" includes="*.jar" excludes="*-with-deps.jar"/>
</copy>
<copy toDir="${build.dir}/dist">
<fileset dir="struts2/plugin/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" 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/**/*,build,.svn,.svn/**/*,**/.svn,classes,classes/**/*"/>
</zip>
</target>
<target name="test.dist"
depends="jar, test.compile"
description="Execute JUnit tests against distribution jar.">
<java fork="true"
classname="junit.textui.TestRunner"
failonerror="true"
taskname="junit">
<classpath>
<pathelement location="${build.dir}/test"/>
<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>
<target name="javadoc"
description="Generate Javadocs.">
<mkdir dir="${build.dir}/javadoc"/>
<javadoc packagenames="${javadoc.packagenames}"
destdir="${build.dir}/javadoc"
author="false"
protected="true"
windowtitle="Guice ${version} API">
<sourcepath>
<pathelement location="${src.dir}"/>
<pathelement location="${servlet.src.dir}"/>
<pathelement location="${spring.src.dir}"/>
<pathelement location="${assistedinject.src.dir}"/>
<pathelement location="${jmx.src.dir}"/>
<pathelement location="${jndi.src.dir}"/>
<pathelement location="${throwingproviders.src.dir}"/>
<pathelement location="${multibindings.src.dir}"/>
<pathelement location="${lifecycle.src.dir}"/>
</sourcepath>
<classpath refid="compile.classpath"/>
<classpath>
<fileset dir="servlet/lib/build" includes="*.jar"/>
</classpath>
<link href="http://aopalliance.sourceforge.net/doc"/>
<link href="http://java.sun.com/javase/6/docs/api"/>
<link href="http://www.springframework.org/docs/api/"/>
</javadoc>
<!-- generate core javadocs, used only for its left-side nav -->
<mkdir dir="${build.dir}/javadoc-core"/>
<javadoc packagenames="${javadoc.packagenames}"
destdir="${build.dir}/javadoc-core"
author="false"
protected="true"
windowtitle="Guice ${version} Core API"
sourcepath="${src.dir}">
<classpath refid="compile.classpath"/>
<link href="http://aopalliance.sourceforge.net/doc"/>
<link href="http://java.sun.com/javase/6/docs/api"/>
</javadoc>
<!-- setup the left-side navigation frames to toggle between core and all classes -->
<move file="${build.dir}/javadoc/overview-frame.html" tofile="${build.dir}/javadoc/overview-frame-with-extensions.html"/>
<copy file="${build.dir}/javadoc-core/overview-frame.html" tofile="${build.dir}/javadoc/overview-frame.html"/>
<replace file="${build.dir}/javadoc/overview-frame.html" token="&lt;A HREF=&quot;allclasses-frame.html&quot; target=&quot;packageFrame&quot;&gt;All Classes&lt;/A&gt;&lt;/FONT&gt;"
value="&lt;A HREF=&quot;allclasses-frame.html&quot; target=&quot;packageFrame&quot;&gt;&lt;b&gt;Core&lt;/b&gt;&lt;/A&gt;
&amp;nbsp;
&lt;a href='overview-frame-with-extensions.html'&gt;Show Extensions&lt;/a&gt;
&lt;/FONT&gt;"/>
<replace file="${build.dir}/javadoc/overview-frame-with-extensions.html" token="&lt;A HREF=&quot;allclasses-frame.html&quot; target=&quot;packageFrame&quot;&gt;All Classes&lt;/A&gt;&lt;/FONT&gt;"
value="&lt;A HREF=&quot;allclasses-frame-with-extensions.html&quot; target=&quot;packageFrame&quot;&gt;&lt;b&gt;All&lt;/b&gt;&lt;/A&gt;
&amp;nbsp;
&lt;a href='overview-frame.html'&gt;Hide Extensions&lt;/a&gt;
&lt;/FONT&gt;"/>
<move file="${build.dir}/javadoc/allclasses-frame.html" tofile="${build.dir}/javadoc/allclasses-frame-with-extensions.html"/>
<copy file="${build.dir}/javadoc-core/allclasses-frame.html" tofile="${build.dir}/javadoc/allclasses-frame.html"/>
<replace file="${build.dir}/javadoc/allclasses-frame.html" token="All Classes" value="Core Classes"/>
<move file="${build.dir}/javadoc-core/overview-summary.html" tofile="${build.dir}/javadoc/overview-summary.html"/>
</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.1.jar&quot;/&gt;" value=""/>
<replace file="build/no_aop/common.xml" token="&lt;zipfileset src=&quot;${common.basedir}/lib/build/cglib-2.2.1-snapshot.jar&quot;/&gt;" value=""/>
</target>
<target name="clean.all"
depends="clean"
description="Remove generated files.">
<ant dir="servlet" antfile="build.xml" target="clean"/>
<ant dir="spring" antfile="build.xml" target="clean"/>
<ant dir="struts2/plugin" 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"/>
</target>
</project>