home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 February / CMCD0205.ISO / Software / Freeware / Programare / jgraph / jgraph-5.2.1-java1.4-open-src.jar / build.xml next >
Encoding:
Text File  |  2004-12-20  |  7.2 KB  |  219 lines

  1. <!--
  2.  
  3.  @(#)build.xml    1.0 03-JUL-04
  4.  
  5.  Copyright (c) 2001-2004 Gaudenz Alder
  6.  
  7. -->
  8.  
  9. <!-- ===================== Project Properties =========================== -->
  10.  
  11. <project name="jgraph" default="all" basedir=".">
  12.  
  13.     <property name="app.name"       value="JGraph"/>
  14.     <property name="app.jar"           value="jgraph.jar"/>
  15.     <property name="app.version"    value="5.2.1"/>
  16.  
  17. <!-- ===================== Project Environment =========================== -->
  18.  
  19.     <property name="source.home"    value="${basedir}/src"/>
  20.     <property name="example.home"   value="${basedir}/example"/>
  21.     <property name="example.class"  value="org.jgraph.example.Main"/>
  22.  
  23. <!--  ==================== Compilation Options ==================== -->
  24.  
  25.     <property name="compile.debug"       value="false"/>
  26.     <property name="compile.deprecation" value="false"/>
  27.     <property name="compile.optimize"    value="true"/>
  28.  
  29. <!-- ===================== Build Environment =========================== -->
  30.  
  31.     <property name="build.home"    value="${basedir}/build"/>
  32.     <property name="dist.home"     value="${basedir}/dist-java${java.specification.version}"/>
  33.     <property name="dist.name"     value="${ant.project.name}-${app.version}-java${java.specification.version}"/>
  34.     <property name="ant.jar"       value="jars/ant.jar"/>
  35.     <property name="xerces.jar"    value="jars/xercesImpl.jar"/>
  36.     <property name="xml.jar"       value="jars/xml-apis.jar"/>
  37.  
  38. <!--  ==================== All ==================== -->
  39.  
  40.     <target name="all" depends="dist"
  41.         description="Clean up and produce all distributions"/>
  42.  
  43. <!--  ==================== Clean ==================== -->
  44.  
  45.     <target name="clean" description="Delete all generated files and directories">
  46.         <delete dir="${build.home}/"/>
  47.         <delete dir="${dist.home}/"/>
  48.     </target>
  49.  
  50. <!--  ==================== Init ==================== -->
  51.  
  52.     <target name="init" description="Initialize the build Java ${java.specification.version} Build">
  53.         <tstamp/>
  54.         <mkdir dir="${build.home}"/>
  55.         <mkdir dir="${build.home}/classes"/>
  56.         <mkdir dir="${build.home}/doc"/>
  57.         <mkdir dir="${build.home}/doc/api"/>
  58.         <mkdir dir="${build.home}/lib"/>
  59.     </target>
  60.  
  61. <!--  ==================== Generate ==================== -->
  62.  
  63.     <target name="generate" depends="init" description="Generate the build tree">
  64.         <copy todir="${build.home}/src">
  65.             <fileset dir="${source.home}" includes="**/*.java,**/*.html"/>
  66.         </copy>
  67.  
  68.         <!-- Examples -->
  69.         <copy todir="${build.home}/example">
  70.             <fileset dir="${example.home}" includes="**/*.java,**/*.gif"/>
  71.         </copy>
  72.         
  73.     </target>
  74.  
  75. <!--  ==================== Compile ==================== -->
  76.  
  77.     <target name="compile" depends="generate" description="Compile the build tree">
  78.  
  79.         <!-- Compile sources -->
  80.         <javac srcdir="${build.home}/src"
  81.             debug="${compile.debug}"
  82.             deprecation="${compile.deprecation}"
  83.             optimize="${compile.optimize}"
  84.             destdir="${build.home}/classes">
  85.             <classpath>
  86.                 <pathelement path="${build.home}/classes"/>
  87.             </classpath>
  88.         </javac>
  89.  
  90.     </target>
  91.  
  92. <!--  ==================== Apidoc ==================== -->
  93.  
  94.     <target name="apidoc" depends="init" description="Generate the api specification (javadoc)">
  95.         <javadoc packagenames="org.jgraph.*"
  96.                  sourcepath="${build.home}/src"
  97.                  classpath="${build.home}/classes" 
  98.                  destdir="${build.home}/doc/api"
  99.                  use="true"
  100.                  author="false"
  101.                  version="false"
  102.                  windowtitle="${app.name} v${app.version} API Specification"
  103.                  doctitle="${app.name} v${app.version} API Specification">
  104.             <header><![CDATA[<p><b>${app.name}</b><br>v${app.version}</p>]]></header>
  105.             <bottom><![CDATA[<font size=1>Copyright (C) 2001-2004 <a href="http://www.jgraph.com/"
  106.                 target="_blank">Gaudenz Alder</a>. All rights reserved.</font>]]></bottom>
  107.             <link href="http://java.sun.com/j2se/${java.specification.version}/docs/api"/>
  108.         </javadoc>
  109.     </target>
  110.  
  111. <!--  ==================== Doc ==================== -->
  112.  
  113.     <target name="doc" depends="apidoc" description="Generate all documentation"/>
  114.  
  115. <!--  ==================== Jar ==================== -->
  116.  
  117.     <target name="jar" depends="compile, doc" description="Build all Java archives (JARs)">
  118.         <jar jarfile="${build.home}/lib/${app.jar}" basedir="${build.home}/classes"/>
  119.     </target>
  120.  
  121. <!--  ==================== Build ==================== -->
  122.  
  123.     <target name="build" depends="jar"
  124.         description="Run all tasks to completely populate the build directory"/>
  125.  
  126. <!--  ==================== Distclean ==================== -->
  127.  
  128.     <target name="distclean" description="Clean up the distribution files only">
  129.         <delete dir="${dist.home}/"/>
  130.     </target>
  131.  
  132. <!--  ==================== Dist ==================== -->
  133.  
  134.         <target name="dist" depends="build" description="Produce fresh distributions">
  135.         <mkdir dir="${dist.home}"/>
  136.     
  137.         <!-- ==================== Binary Distribution ==================== -->
  138.         <mkdir dir="${dist.home}/${dist.name}"/>
  139.     
  140.           <copy file="${basedir}/ChangeLog" todir="${dist.home}/${dist.name}"/>
  141.           <copy file="${basedir}/LICENSE" todir="${dist.home}/${dist.name}"/>
  142.         <copy file="${basedir}/LICENSE2" todir="${dist.home}/${dist.name}"/>
  143.           <copy file="${basedir}/README" todir="${dist.home}/${dist.name}"/>
  144.           <copy file="${build.home}/lib/${app.jar}" todir="${dist.home}/${dist.name}/lib"/>
  145.  
  146.         <copy todir="${dist.home}/${dist.name}/doc">
  147.             <fileset dir="${build.home}/doc/api" includes="**/*"/>
  148.         </copy>
  149.  
  150.         <mkdir dir="${dist.home}/${dist.name}/example"/>
  151.         <copy todir="${dist.home}/${dist.name}/example">
  152.             <fileset dir="${example.home}" includes="**/*"/>
  153.         </copy>
  154.  
  155.         <!-- Compress -->
  156.         <zip destfile="${dist.home}/${dist.name}.zip"
  157.             basedir="${dist.home}/${dist.name}"
  158.         />
  159.  
  160.         <!-- ==================== Source Distribution ==================== -->
  161.         <!-- Extends binary distribution -->        
  162.         <copy todir="${dist.home}/${dist.name}-src">
  163.             <fileset dir="${dist.home}/${dist.name}" includes="**/*"/>
  164.         </copy>
  165.  
  166.         <!-- Add source tree -->
  167.         <copy todir="${dist.home}/${dist.name}-src/src">
  168.             <fileset dir="${build.home}/src" includes="**/*"/>
  169.         </copy>
  170.  
  171.         <!-- Add build file -->
  172.           <copy file="${basedir}/build.xml" todir="${dist.home}/${dist.name}-src"/>
  173.           <copy file="${ant.jar}" todir="${dist.home}/${dist.name}-src/jars"/>
  174.           <copy file="${xerces.jar}" todir="${dist.home}/${dist.name}-src/jars"/>
  175.            <copy file="${xml.jar}" todir="${dist.home}/${dist.name}-src/jars"/>
  176.  
  177.         <!--  Compress -->
  178.         <zip destfile="${dist.home}/${dist.name}-src.zip"
  179.             basedir="${dist.home}/${dist.name}-src"
  180.         />
  181.     </target>
  182.  
  183. <!--  ==================== Example ==================== -->
  184.  
  185.     <target name="compile-example" depends="compile" description="Compile the main example">
  186.         <mkdir dir="${build.home}/example"/>
  187.  
  188.         <!-- Compile examples -->
  189.         <javac srcdir="${example.home}"
  190.             debug="${compile.debug}"
  191.             deprecation="${compile.deprecation}"
  192.             optimize="${compile.optimize}"
  193.             destdir="${build.home}/example">
  194.             <classpath>
  195.                 <pathelement path="${build.home}/classes"/>
  196.                 <pathelement path="${build.home}/example"/>
  197.             </classpath>
  198.         </javac>
  199.  
  200.     </target>
  201.     
  202. <!--  ==================== Test ==================== -->
  203.  
  204.     <target name="example" depends="compile-example" description="Run the main example">
  205.  
  206.         <!-- Run main example -->
  207.         <java fork="true" classname="${example.class}">
  208.             <arg value="test.png"/>
  209.             <classpath>
  210.                 <pathelement path="${build.home}/classes"/>
  211.                 <pathelement path="${build.home}/example"/>
  212.             </classpath>
  213.         </java>
  214.  
  215.     </target>
  216.  
  217. </project>
  218.  
  219.