Subversion Repositories DevTools

Rev

Rev 227 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<project name="PACKAGE" default="make_package" basedir=".">

    <!--
        Import files that specify versions of this and other packages
     -->
    <import file="auto.xml" optional="true"/> <!-- Created by the ABT -->
    <import file="${ant.project.name}depends.xml"/>  <!-- Non ABT use -->


    <!--
      Common properties using within the build
    -->
        <description>Example of Building with ant</description>

        <property name="env" environment="env" value="not used"/>

        <property name="src.dir"         value="${basedir}/src"/>
        <property name="build.dir"       value="${basedir}/build"/>
        <property name="classes.dir"     value="${build.dir}/classes"/>
        <property name="jar.dir"         value="${build.dir}/jar"/>
        <property name="pkg.dir"         value="${build.dir}/pkg"/>     

    <!--
      Provide access to components in dependent packages
      The package versions are specified as properties in the
      'depends' file and are used here by the 'using' task.
    -->
        <import file="${env.GBE_DPKG}/ant-using/${ant-using}/ant-using.xml"/>
    <usingall/>


 <!--
      B U I L D
      This target is required by the Automated Build Environment
      The target should setup the 'sandbox'
      In many cases this will be empty
     -->
      <target name="build" 
                     depends="" 
                     description="Setup build sandbox">
        </target>

        <!--
          M A K E _ P A C K A G E
        This target is required by the Automated Build Environment
        It should:
          1) Compile / Build stuff
          2) Package up the build artefacts that are being exported
          3) Create the 'descpkg' file

      In this example the process is broken into three other targets for
      the purpose of illustrating the steps.
          -->
        <target name="make_package" 
                         depends="clean,compile,package">
        </target>

    <!--
      R U N _ T E S T S
      This target is optional in the Automated Build Environment
      If the Release Manager entry advertises that the package has unit 
      tests, then this target must exist

      It should run automated unit tests which conform to the Unit Test 
      Automation Paper
      It does not have to be dependent on the build process as this will 
      already have been performed.
     -->

    <target name="run_tests" 
                     depends="test_1"  
                     description="Run automated unit tests">
    </target>
     
<!-- End of Mandatory Target ======================================= -->
<!-- The following targets are used by the mandatory targets         -->

        <target name="compile" 
              depends=""  description="Compile stuff">
        <mkdir dir="${classes.dir}"/>
        <javac srcdir="${src.dir}" destdir="${classes.dir}"/>

        <mkdir dir="${jar.dir}"/>
        <jar destfile="${jar.dir}/${packagename}.jar"
             basedir="${classes.dir}">
            <manifest>
                <attribute name="Main-Class" value="HelloWorld"/>
            </manifest>
        </jar>
        </target>


    <!--
      Create the package image
      This must be in the directory ${basedir}/build/pkg, as other 
      build tools will assume that directory as the location of 
      the package.

      Note: The structure of the package is not free-form.
            Jar files should go into a 'jar' subdirectory
            No files should be places in the package root directory
     -->
        <target name="package" 
               depends=""  
               description="Package build artifacts">

        <mkdir dir="${pkg.dir}/jar"/>
            <copy todir="${pkg.dir}/jar">
                    <fileset dir="${jar.dir}" includes="**/*"/>
                </copy>
                <summarise-manifest/>
    
        </target>

        <!--
          -    This target executes all unit tests in MyPackageTestSuite
          -    It depends on the junit framework.
          -     Further details regarding how to unit test under ANT are
          -     present in the ANT manual
          -->
       <target name = "test_1">
                <junit printsummary="yes" fork="yes" haltonfailure="no">
                        <classpath>
                                <pathelement location="${build.dir}/classes" />
                        </classpath>
                        <formatter type="xml"/>
                        <test name="com.vixtechnology.MyPackage.tests.MyPackageTestSuite"/>
                </junit>
        </target>

</project>