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