Google guice ant script : Big Project Ant Script « Ant « Java






Google guice ant script


<?xml version="1.0"?>

<project name="guice" default="compile">

  <property name="DynamicImport-Package" value="org.aopalliance.intercept"/>
  <property name="exclude.imports" value="!com.google.common.*,!net.sf.*,!org.objectweb.*"/>

  <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"/>
      </classpath>
      <arg value="com.google.inject.AllTests"/>    
      <syspropertyset>
        <propertyref name="guice.custom.loader"/>
      </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>


File: \extensions\grapher\build.xml


<?xml version="1.0"?>

<project name="guice-grapher" basedir="." default="jar">

  <import file="../../common.xml"/>
  
  <path id="compile.classpath">
    <fileset dir="${lib.dir}" includes="*.jar"/>
    <fileset dir="${lib.dir}/build" includes="*.jar"/>
    <fileset dir="../../build/dist" includes="*.jar"/>
  </path>

  <target name="jar" depends="jar.withdeps, manifest" description="Build jar.">
    <jar destfile="${build.dir}/${ant.project.name}-${version}.jar"
        manifest="${build.dir}/META-INF/MANIFEST.MF">
      <zipfileset src="${build.dir}/${ant.project.name}-with-deps.jar"
          excludes="com/google/inject/internal/**"/>
    </jar>
  </target>

</project>

File: \extensions\grapher\build.properties


lib.dir=../../lib
src.dir=src
test.dir=test
build.dir=build
test.class=com.google.inject.grapher.AllTests
module=com.google.inject.grapher

 








Related examples in the same category

1.Ant script for xmlgraphics-commons
2.nutch ant script
3.rhino ant build script
4.apache solr ant script
5.Tomcat ant build script
6.OFBiz ant build script
7.Apache Lenya Build System
8.Apache pivot ant build script
9.XmlSchema ant script
10.xml security
11.velocity tools ant script
12.weka build script
13.xml bean ant script
14.xml graphics common ant script
15.uPortal ant script
16.SmartGWT ant script
17.Build file to fetch maven2 tasks; extracted from (Ant's) fetch.xml
18.Build file to fetch optional libraries for Apache Ant
19.Ant build script
20.Build script for apache-cassandra-0.5.1-src
21.apache-log4j-site\build.xml
22.apache-roller-src-4.0.1
23.Build script from apache dbutils
24.Fop build script
25.GWT ant script
26.hadoop ant build script
27.jakarta jmeter ant script
28.jakarta oro ant script
29.jakarta regexp ant script
30.jedit build script
31.jibx ant build script
32.lucene ant build script