• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?xml version="1.0"?>
2
3<project name="guice" default="compile">
4  <!-- common definitions are stored in common.xml. -->
5  <import file="common.xml"/>
6
7  <path id="compile.classpath">
8    <fileset dir="${lib.dir}" includes="*.jar"/>
9    <fileset dir="${lib.dir}/build" includes="*.jar"/>
10  </path>
11
12  <path id="javadoc.classpath">
13    <path refid="compile.classpath"/>
14    <fileset dir="extensions">
15      <include name="*/lib/*.jar"/>
16    </fileset>
17    <pathelement location="${build.dir}/classes"/>
18  </path>
19
20
21  <target name="jar" depends="jar.withdeps, manifest" description="Build jar.">
22    <jar jarfile="${build.dir}/dist/guice-${version}.jar"
23        manifest="${build.dir}/META-INF/MANIFEST.MF">
24      <zipfileset src="${build.dir}/${ant.project.name}-with-deps.jar"/>
25    </jar>
26  </target>
27
28  <target name="dist" depends="distjars, javadoc"
29       description="Build entire distribution.">
30    <ant antfile="extensions/servlet/build.xml" target="distjars" inheritAll="false"/>
31    <ant antfile="extensions/spring/build.xml" target="distjars" inheritAll="false"/>
32    <ant antfile="extensions/struts2/build.xml" target="distjars" inheritAll="false"/>
33    <ant antfile="extensions/assistedinject/build.xml" target="distjars" inheritAll="false"/>
34    <ant antfile="extensions/jmx/build.xml" target="distjars" inheritAll="false"/>
35    <ant antfile="extensions/jndi/build.xml" target="distjars" inheritAll="false"/>
36    <ant antfile="extensions/throwingproviders/build.xml" target="distjars" inheritAll="false"/>
37    <ant antfile="extensions/dagger-adapter/build.xml" target="distjars" inheritAll="false"/>
38    <ant antfile="extensions/persist/build.xml" target="distjars" inheritAll="false"/>
39    <ant antfile="extensions/grapher/build.xml" target="distjars" inheritAll="false"/>
40    <ant antfile="extensions/testlib/build.xml" target="distjars" inheritAll="false"/>
41
42    <copy toDir="${build.dir}/dist">
43      <fileset dir="extensions/servlet/build" includes="*.jar"/>
44    </copy>
45    <copy toDir="${build.dir}/dist">
46      <fileset dir="extensions/spring/build" includes="*.jar"/>
47    </copy>
48    <copy toDir="${build.dir}/dist">
49      <fileset dir="extensions/struts2/build" includes="*.jar"/>
50    </copy>
51    <copy toDir="${build.dir}/dist">
52      <fileset dir="extensions/assistedinject/build" includes="*.jar"/>
53    </copy>
54    <copy toDir="${build.dir}/dist">
55      <fileset dir="extensions/jmx/build" includes="*.jar"/>
56    </copy>
57    <copy toDir="${build.dir}/dist">
58      <fileset dir="extensions/jndi/build" includes="*.jar"/>
59    </copy>
60    <copy toDir="${build.dir}/dist">
61      <fileset dir="extensions/throwingproviders/build" includes="*.jar"/>
62    </copy>
63    <copy toDir="${build.dir}/dist">
64      <fileset dir="extensions/dagger-adapter/build" includes="*.jar"/>
65    </copy>
66    <copy toDir="${build.dir}/dist">
67      <fileset dir="extensions/persist/build" includes="*.jar"/>
68    </copy>
69    <copy toDir="${build.dir}/dist">
70      <fileset dir="extensions/grapher/build" includes="*.jar"/>
71    </copy>
72    <copy toDir="${build.dir}/dist">
73      <fileset dir="extensions/testlib/build" includes="*.jar"/>
74    </copy>
75
76    <copy toDir="${build.dir}/dist" file="COPYING"/>
77    <copy toDir="${build.dir}/dist">
78      <fileset dir="${lib.dir}"
79        includes="*.jar"/>
80    </copy>
81    <copy toDir="${build.dir}/dist">
82      <fileset dir="${build.dir}" includes="javadoc/**/*"/>
83    </copy>
84
85    <zip destfile="${build.dir}/guice-${version}.zip">
86      <zipfileset dir="${build.dir}/dist" prefix="guice-${version}" excludes="*-src.jar"/>
87    </zip>
88    <zip destfile="${build.dir}/guice-${version}-src.zip">
89      <zipfileset dir="." prefix="guice-${version}-src"
90          excludes="build/**,**/.svn/**,classes/**,.settings/**,bin/**,latest-api-diffs/**,latest-javadoc/**,.classpath,.project"/>
91    </zip>
92  </target>
93
94  <target name="test.dist"
95    description="Execute JUnit tests against distribution jar.">
96    <antcall target="test.dist.run">
97      <param name="jvmarg-value" value="-Dguice_include_stack_traces="/>
98    </antcall>
99    <antcall target="test.dist.run">
100      <param name="jvmarg-value" value="-Dguice_include_stack_traces=OFF"/>
101    </antcall>
102    <antcall target="test.dist.run">
103      <param name="jvmarg-value" value="-Dguice_include_stack_traces=COMPLETE"/>
104    </antcall>
105  </target>
106
107  <target name="test.dist.run"
108    depends="jar, test.withdeps"
109    description="Execute JUnit tests against distribution jar with the given jvmarg.">
110    <java fork="true"
111        classname="junit.textui.TestRunner"
112        failonerror="true"
113        taskname="junit">
114      <classpath>
115        <pathelement location="${build.dir}/guice-${version}-tests.jar"/>
116        <pathelement location="${build.dir}/dist/guice-${version}.jar"/>
117        <pathelement location="lib/javax.inject.jar"/>
118        <pathelement location="lib/aopalliance.jar"/>
119        <pathelement location="lib/guava-19.0.jar"/>
120        <pathelement location="lib/build/guava-testlib-19.0.jar"/>
121        <pathelement location="lib/build/junit.jar"/>
122        <pathelement location="lib/build/servlet-api-2.5.jar"/>
123        <pathelement location="lib/build/truth-0.36.jar"/>
124        <pathelement location="lib/build/easymock.jar"/>
125        <pathelement location="lib/build/javax.inject-tck.jar"/>
126        <pathelement location="lib/build/bnd-0.0.384.jar"/>
127        <pathelement location="lib/build/felix-2.0.5.jar"/>
128      </classpath>
129      <arg value="com.google.inject.AllTests"/>
130      <jvmarg value="${jvmarg-value}"/>
131      <syspropertyset>
132        <propertyref name="version"/>
133        <propertyref name="build.dir"/>
134        <propertyref name="lib.dir"/>
135      </syspropertyset>
136    </java>
137  </target>
138
139  <property name="old.api" value="4.1"/>
140  <property name="new.api" value="latest"/>
141  <target name="jdiff" depends="compile">
142    <property name="jdiff.home" value="lib/build/jdiff"/>
143    <property name="jdiff.tmp" value="build/docs/latest-api-diffs"/>
144    <delete dir="${jdiff.tmp}"/>
145    <mkdir dir="${jdiff.tmp}"/>
146
147    <!-- Generate API for current version. -->
148    <javadoc packagenames="com.google.*"
149             docletpath="${jdiff.home}/jdiff.jar${path.separator}${jdiff.home}/xerces.jar"
150             maxmemory="1024M"
151             classpathref="javadoc.classpath">
152      <fileset dir="${src.dir}" defaultexcludes="yes">
153        <include name="com/google/**"/>
154        <exclude name="com/google/inject/internal/**"/>
155      </fileset>
156      <fileset dir="${servlet.src.dir}"/>
157      <fileset dir="${spring.src.dir}"/>
158      <fileset dir="${assistedinject.src.dir}"/>
159      <fileset dir="${jmx.src.dir}"/>
160      <fileset dir="${jndi.src.dir}"/>
161      <fileset dir="${throwingproviders.src.dir}"/>
162      <fileset dir="${daggeradapter.src.dir}"/>
163      <fileset dir="${persist.src.dir}"/>
164      <fileset dir="${struts2.src.dir}"/>
165      <fileset dir="${grapher.src.dir}"/>
166      <fileset dir="${testlib.src.dir}"/>
167
168      <doclet name="jdiff.JDiff" path="${jdiff.home}/jdiff.jar:${jdiff.home}/xerces.jar">
169        <param name="-apidir" value="${jdiff.tmp}" />
170        <param name="-apiname" value="${new.api}" />
171      </doclet>
172    </javadoc>
173
174    <!-- Do a diff against the previous version. -->
175    <javadoc packagenames="com.google.*"
176             destdir="${jdiff.tmp}"
177             docletpath="${jdiff.home}/jdiff.jar${path.separator}${jdiff.home}/xerces.jar"
178             maxmemory="512M"
179             sourcefiles="${jdiff.home}/Null.java"
180             classpathref="javadoc.classpath">
181      <doclet name="jdiff.JDiff">
182        <param name="-oldapi" value="${old.api}"/>
183        <param name="-oldapidir" value="latest-api-diffs"/>
184        <param name="-javadocold" value="http://google.github.io/guice/api-docs/${old.api}/javadoc/"/>
185        <param name="-newapi" value="${new.api}"/>
186        <param name="-newapidir" value="${jdiff.tmp}"/>
187        <param name="-javadocnew" value="http://google.github.io/guice/api-docs/${new.api}/javadoc/"/>
188        <param name="-stats"/>
189        <param name="-docchanges"/>
190      </doclet>
191    </javadoc>
192  </target>
193
194  <target name="javadoc" depends="compile">
195    <javadoc packagenames="com.google.*"
196             destdir="build/docs/javadoc"
197             maxmemory="512M"
198             classpathref="javadoc.classpath"
199             additionalparam="-Xdoclint:none -notimestamp"
200             windowtitle="Guice ${new.api} API"
201             author="false"
202             protected="true">
203      <group title="Guice Core" packages="com.google.inject:com.google.inject.util:com.google.inject.spi:com.google.inject.name:com.google.inject.matcher:com.google.inject.binder:com.google.inject.multibindings:"/>
204      <fileset dir="${src.dir}" defaultexcludes="yes">
205        <include name="com/google/inject/**"/>
206        <exclude name="com/google/inject/internal/**"/>
207      </fileset>
208
209      <group title="Servlet Extension" packages="com.google.inject.servlet"/>
210      <fileset dir="${servlet.src.dir}"/>
211
212      <group title="AssistedInject Extension" packages="com.google.inject.assistedinject"/>
213      <fileset dir="${assistedinject.src.dir}"/>
214
215      <group title="Dagger Adapter" packages="com.google.inject.daggeradapter"/>
216      <fileset dir="${daggeradapter.src.dir}"/>
217
218      <group title="ThrowingProviders Extension" packages="com.google.inject.throwingproviders"/>
219      <fileset dir="${throwingproviders.src.dir}"/>
220
221      <group title="Test Libraries Extension" packages="com.google.inject.testing.*"/>
222      <fileset dir="${testlib.src.dir}"/>
223
224      <group title="Grapher Extension" packages="com.google.inject.grapher:com.google.inject.grapher.*"/>
225      <fileset dir="${grapher.src.dir}"/>
226
227      <group title="Persist Extension" packages="com.google.inject.persist:com.google.inject.persist.*"/>
228      <fileset dir="${persist.src.dir}"/>
229
230      <group title="Spring Extension" packages="com.google.inject.spring"/>
231      <fileset dir="${spring.src.dir}"/>
232
233      <group title="Struts2 Extension" packages="com.google.inject.struts2"/>
234      <fileset dir="${struts2.src.dir}"/>
235
236      <group title="JNDI Extension" packages="com.google.inject.jndi"/>
237      <fileset dir="${jndi.src.dir}"/>
238
239      <group title="JMX Extension" packages="com.google.inject.tools.jmx"/>
240      <fileset dir="${jmx.src.dir}"/>
241
242      <link href="http://aopalliance.sourceforge.net/doc/"/>
243      <link href="http://docs.oracle.com/javase/7/docs/api/"/>
244      <link href="http://atinject.googlecode.com/svn/trunk/javadoc/"/>
245      <link href="http://docs.guava-libraries.googlecode.com/git/javadoc/"/>
246      <link href="https://tomcat.apache.org/tomcat-5.5-doc/servletapi/"/>
247    </javadoc>
248  </target>
249
250  <target name="no_aop"
251          description="Create a copy of the Guice source that doesn't do bytecode generation.">
252    <taskdef name="munge" classname="MungeTask" classpath="lib/build/munge.jar"/>
253    <mkdir dir="build/no_aop"/>
254    <munge todir="build/no_aop">
255      <fileset dir=".">
256        <!-- exclude generated files -->
257        <exclude name="build/**"/>
258        <exclude name="classes/**"/>
259        <exclude name="latest-api-diffs/**"/>
260        <exclude name="javadoc/**"/>
261        <exclude name="latest-javadoc/**"/>
262        <!-- exclude AOP-specific libraries -->
263        <exclude name="lib/aopalliance.jar"/>
264        <exclude name="lib/build/asm-*.jar"/>
265        <exclude name="lib/build/cglib-*.jar"/>
266        <!-- exclude AOP-specific classes -->
267        <exclude name="**/LineNumbers.java"/>
268        <exclude name="**/InterceptorBindingProcessor.java"/>
269        <exclude name="**/ProxyFactory.java"/>
270        <exclude name="**/ProxyFactoryTest.java"/>
271        <exclude name="**/InterceptorStackCallback.java"/>
272        <exclude name="**/InterceptorBinding.java"/>
273        <exclude name="**/MethodAspect.java"/>
274        <exclude name="**/MethodInterceptionTest.java"/>
275        <exclude name="**/BytecodeGenTest.java"/>
276        <exclude name="**/IntegrationTest.java"/>
277        <exclude name="**/MethodInterceptionTest.java"/>
278      </fileset>
279      <arg value="-DNO_AOP" />
280    </munge>
281    <replace file="build/no_aop/common.xml" value="">
282      <replacetoken><![CDATA[<zipfileset src="${common.basedir}/lib/build/asm-6.0.jar"/>]]></replacetoken>
283    </replace>
284    <replace file="build/no_aop/common.xml" value="">
285      <replacetoken><![CDATA[<zipfileset src="${common.basedir}/lib/build/cglib-3.2.6.jar"/>]]></replacetoken>
286    </replace>
287    <replace file="build/no_aop/common.xml" value="">
288      <replacetoken><![CDATA[<zipfileset src="${common.basedir}/lib/build/cglib-3.2.6.jar"><include name="LICENSE"/><include name="NOTICE"/></zipfileset>]]></replacetoken>
289    </replace>
290    <replace file="build/no_aop/common.xml" value='Bundle-Name" value="$${ant.project.name} (no_aop)'>
291      <replacetoken><![CDATA[Bundle-Name" value="${ant.project.name}]]></replacetoken>
292    </replace>
293  </target>
294
295  <target name="clean.all"
296      depends="clean"
297      description="Remove generated files.">
298    <ant dir="extensions/servlet" antfile="build.xml" target="clean"/>
299    <ant dir="extensions/spring" antfile="build.xml" target="clean"/>
300    <ant dir="extensions/struts2" antfile="build.xml" target="clean"/>
301    <ant dir="extensions/assistedinject" antfile="build.xml" target="clean"/>
302    <ant dir="extensions/jmx" antfile="build.xml" target="clean"/>
303    <ant dir="extensions/jndi" antfile="build.xml" target="clean"/>
304    <ant dir="extensions/throwingproviders" antfile="build.xml" target="clean"/>
305    <ant dir="extensions/dagger-adapter" antfile="build.xml" target="clean"/>
306    <ant dir="extensions/persist" antfile="build.xml" target="clean"/>
307    <ant dir="extensions/grapher" antfile="build.xml" target="clean"/>
308    <ant dir="extensions/testlib" antfile="build.xml" target="clean"/>
309  </target>
310
311</project>
312