File build.xml of Package bcel5_3

<?xml version="1.0"?>

<!--
   Build file for BCEL
   $Id: build.xml 152851 2003-04-25 08:25:37Z mdahm $

Notes:
   This is a build file for use with the Jakarta Ant build tool.

Prerequisites:

   jakarta-ant from http://jakarta.apache.org/ant/index.html

Build Instructions:
   To build, run

   ant <target>

   in the directory where this file is located with the target you want.

Available targets:

 - compile  -> compile source classes and places result in "classes" directory
 - jar      -> Create file "lib/bcel.jar"
 - test<x>  -> Run example number x
 - test     -> Run all examples
 - mini     -> Run Mini compiler and test results
 - apidocs  -> Build API documentation (javadoc) in "docs/api"
-->

<project default="jar" basedir=".">
  
  <!-- Allow any user specific values to override the defaults -->
  <property file="${user.home}/build.properties" />
  <!-- Allow user defaults for this project -->
  <property file="build.properties" />
  <!-- Set default values for the build -->
  <property file="default.properties" />
  
  <target name="init">
    <property name="name"         value="bcel"/>
    <property name="packages"     value="org.apache.bcel.*"/>
    <property name="src.dir"      value="${basedir}/src/java"/>
    <property name="build.dir"    value="${basedir}/bin"/>
    <property name="examples.dir" value="${basedir}/examples"/>
    <property name="mini.dir"     value="${examples.dir}/Mini"/>
    <property name="docs.dir"     value="${basedir}/docs"/>
    <property name="apidocs.dir"  value="${docs.dir}/api"/>
    <property name="build.dest"   value="${build.dir}/classes"/>
    <property name="lib.dir"      value="${basedir}/lib"/>
    <property name="class.path"   value="${lib.dir}/Regex.jar:${build.dest}"/>

    <!-- Use jikes compiler, if you don't have it comment out the next lines -->
    <!-- property name="build.compiler.emacs" value="true"/ -->
    <!-- property name="build.compiler" value="jikes"/ -->
  </target>

  <!-- Compile the sources -->
  <target name="compile" depends="init">
    <mkdir dir="${build.dest}"/>
    <javac srcdir="${src.dir}" destdir="${build.dest}" classpath="${class.path}" debug="true" encoding="ISO-8859-1" />
  </target>

  <!-- Just an alias -->
  <target name="build" depends="compile"/>

  <!-- Jar the library -->
  <target name="jar" depends="examples">
    <jar jarfile="${build.dir}/${name}.jar" 
         basedir="${build.dest}"
	 manifest="${basedir}/manifest.txt"
	 includes="org/**,listclass.class"
    />
  </target>

  <!-- Compile the examples -->
  <target name="examples" depends="compile">
    <javac srcdir="${examples.dir}" destdir="${build.dest}" classpath="${class.path}"  encoding="ISO-8859-1" />
  </target>

  <!-- Creates the API documentation -->
  <target name="apidocs" depends="init">
    <mkdir dir="${apidocs.dir}"/>
    <javadoc packagenames="${packages}"
             sourcepath="${src.dir}"
             destdir="${apidocs.dir}"
             author="true"
             version="true"
             use="true"
             windowtitle="${name} API"
             doctitle="${name}"
             encoding="ISO-8859-1"
    />
  </target>

  <target name="test1" depends="examples"> 
    <echo message="Display class file contents"/>

    <java classname="listclass" classpath="${class.path}">
	<arg value="-code"/>
	<arg value="java.lang.String"/>
    </java>
  </target>

  <target name="test2" depends="examples">
    <echo message="Decompile class file to Jasmin format (see java/lang/String.j)"/>

    <java classname="JasminVisitor" classpath="${class.path}">
	<arg value="java.lang.String"/>
    </java>
  </target>

  <target name="test3" depends="examples">
    <echo message="Create Hello World class from scratch"/>
    <java classname="HelloWorldBuilder" classpath="${class.path}"/>

    <echo message="Running Hello World"/>
    <java classname="HelloWorld" classpath="."/>
  </target>

  <target name="test4" depends="examples">
    <echo message="Run fancy classloader example"/>

    <java classname="org.apache.bcel.util.JavaWrapper" fork="true"
          classpath="${class.path}">
	<arg value="ProxyCreator"/>
    </java>
  </target>

  <target name="test" depends="test1,test2,test3,test4"/>

  <target name="mini" depends="examples">
    <echo message="Run Mini compiler"/>

    <java classname="Mini.MiniC" classpath="${class.path}" fork="true" dir="${mini.dir}">
	<arg value="fac.mini"/>
	<arg value="fib.mini"/>
	<arg value="max.mini"/>
    </java>

    <echo message="Faculty"/>
    <java classname="fac" classpath="${mini.dir}" />
    <echo message="Fibonacci"/>
    <java classname="fib" classpath="${mini.dir}" />
    <echo message="Maximum of numbers"/>
    <java classname="max" classpath="${mini.dir}" />
  </target>

  <!-- Clean everything up -->
  <target name="clean" depends="init">
    <delete dir="${build.dir}"/>
    <delete>
      <fileset dir="${docs.dir}"
	       includes="manual.blg,manual.bbl,manual.dvi,manual.log"/>
      <fileset dir="${docs.dir}" includes="**/*.aux"/>
      <fileset dir="${basedir}" includes="**/*~"/>
    </delete>

  </target>

  <!-- can rename this target when we get the docs sorted out -->

  <!-- ================================================================== -->
  <!-- D O C S                                                            -->
  <!-- ================================================================== -->
  
  <target 
    name="check_for_jdom">
    
    <available 
      property="jdom.present"
      classname="org.jdom.JDOMException">
      <classpath>
        <pathelement location="${jakarta.site2}/lib/${jdom.jar}"/>
      </classpath>
    </available>
  </target>
    
  <target 
    depends="check_for_jdom" 
    name="docs-prepare-error" 
    unless="jdom.present">
    
    <echo>
      The Jakarta-Site2 module is not present! Please check
      to make sure that you have checked it out from CVS.

      &lt;http://jakarta.apache.org/site/jakarta-site2.html&gt;
    </echo>
  </target>

  <target 
    name="xdocs"
    depends="docs-prepare-error"
    description="--> generates the HTML documentation"
    if="jdom.present">

    <taskdef 
      name="anakia"
      classname="org.apache.velocity.anakia.AnakiaTask">
      <classpath>
        <fileset dir="${jakarta.site2}/lib">
          <include name="*.jar"/>
        </fileset>
      </classpath>
    </taskdef>
        
    <anakia 
      basedir="${docs.src}" 
      destdir="${docs.dest}/"
      extension=".html" 
      style="./site.vsl"
      projectFile="stylesheets/project.xml"
      excludes="**/stylesheets/** empty.xml"
      includes="**/*.xml"
      lastModifiedCheck="true"
      templatePath="${jakarta.site2}/xdocs/stylesheets">
    </anakia>

    <copy 
      todir="${docs.dest}/images" 
      filtering="no">
      
      <fileset dir="${docs.src}/images">
        <include name="**/*.gif"/>
        <include name="**/*.jpeg"/>
        <include name="**/*.jpg"/>
      </fileset>
    </copy>
  </target>

  <!-- ================================================================== -->
  <!-- D I S T R I B U T I O N S                                          -->
  <!-- ================================================================== -->

  <target 
    name="dist"
    depends="init,jar,apidocs,xdocs">

    <property name="distDir" value="${build.dir}/${final.name}"/>

    <!-- B I N A R Y  D I S T R I B U T I O N -->

    <echo>
      +-------------------------------------------------------+
      | C R E A T I N G  B I N A R Y  D I S T R I B U T I O N |
      +-------------------------------------------------------+
    </echo>
    
    <mkdir dir="${distDir}"/>

    <!-- Copy README and LICENSE -->
    <copy todir="${distDir}" file="README.JustIce"/>
    <copy todir="${distDir}" file="TODO.JustIce"/>
    <copy todir="${distDir}" file="LICENSE.txt"/>

    <!-- Copy Jars -->
    <copy todir="${distDir}">
      <fileset dir="${build.dir}">
        <include name="**/*.jar"/>
      </fileset>
    </copy>

    <!-- Copy lib directory -->
    <copy todir="${distDir}/lib">
      <fileset dir="${lib.dir}">
        <include name="*.jar"/>
      </fileset>
    </copy>

    <!-- Copy documentation -->
    <copy todir="${distDir}/docs">
      <fileset dir="${docs.dest}">
        <include name="**"/>
      </fileset>
    </copy>

    <!-- Copy examples -->
    <copy todir="${distDir}/examples">
      <fileset dir="${examples.dir}">
        <include name="**/*.java"/>
      </fileset>
    </copy>

    <!-- Create a tar.gz file -->
    <tar longfile="gnu" tarfile="${final.name}.tar">
      <tarfileset dir="${build.dir}">
        <include name="${final.name}/**"/>
      </tarfileset>
    </tar>
    
    <gzip zipfile="${final.name}.tar.gz" src="${final.name}.tar"/>
    <delete file="${final.name}.tar"/>
    
    <!-- Create a zip file -->
    <zip zipfile="${final.name}.zip">
      <zipfileset dir="${build.dir}">
        <include name="${final.name}/**"/>
      </zipfileset>
    </zip>

    <!-- S O U R C E  D I S T R I B U T I O N -->

    <echo>
      +-------------------------------------------------------+
      | C R E A T I N G  S O U R C E  D I S T R I B U T I O N |
      +-------------------------------------------------------+
    </echo>

    <delete>
      <fileset dir="${distDir}">
        <include name="**/bcel*.jar"/>
      </fileset>
    </delete>
    
    <copy todir="${distDir}" file="default.properties"/>
    <copy todir="${distDir}" file="build.xml"/>

    <!-- Copy Sources -->
    <copy todir="${distDir}/src/java">
      <fileset dir="${src.dir}">
        <include name="**/*.java"/>
      </fileset>
    </copy>

    <!-- Copy examples -->
    <copy todir="${distDir}/examples">
      <fileset dir="${examples.dir}">
        <include name="**/*.java"/>
      </fileset>
    </copy>

    <!-- Create a tar.gz file -->
    <tar longfile="gnu" tarfile="${final.name}-src.tar">
      <tarfileset dir="${build.dir}">
        <include name="${final.name}/**"/>
      </tarfileset>
    </tar>
    
    <gzip zipfile="${final.name}-src.tar.gz" src="${final.name}-src.tar"/>
    <delete file="${final.name}-src.tar"/>
    
    <!-- Create a zip file -->
    <zip zipfile="${final.name}-src.zip">
      <zipfileset dir="${build.dir}">
        <include name="${final.name}/**"/>
      </zipfileset>
    </zip>

  </target>

</project>
openSUSE Build Service is sponsored by