Subversion Repositories DevTools

Rev

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

Rev Author Line No. Line
4995 dpurdie 1
<project name="PACKAGE" default="make_package" basedir=".">
227 dpurdie 2
 
4995 dpurdie 3
    <!--
4
        Import files that specify versions of this and other packages
5
     -->
6
    <import file="auto.xml" optional="true"/> <!-- Created by the ABT -->
7
    <import file="${ant.project.name}depends.xml"/>  <!-- Non ABT use -->
227 dpurdie 8
 
9
 
4995 dpurdie 10
    <!--
11
      Common properties using within the build
12
    -->
13
   	<description>Example of Building with ant</description>
227 dpurdie 14
 
4995 dpurdie 15
	<property name="env" environment="env" value="not used"/>
227 dpurdie 16
 
4995 dpurdie 17
   	<property name="src.dir"         value="${basedir}/src"/>
18
   	<property name="build.dir"       value="${basedir}/build"/>
19
   	<property name="classes.dir"     value="${build.dir}/classes"/>
20
   	<property name="jar.dir"         value="${build.dir}/jar"/>
21
   	<property name="pkg.dir"         value="${build.dir}/pkg"/>	
227 dpurdie 22
 
4995 dpurdie 23
    <!--
24
      Provide access to components in dependent packages
25
      The package versions are specified as properties in the
26
      'depends' file and are used here by the 'using' task.
27
    -->
28
	<import file="${env.GBE_DPKG}/ant-using/${ant-using}/ant-using.xml"/>
29
    <usingall/>
227 dpurdie 30
 
31
 
4995 dpurdie 32
 <!--
33
      B U I L D
34
      This target is required by the Automated Build Environment
35
      The target should setup the 'sandbox'
36
      In many cases this will be empty
37
     -->
38
      <target name="build" 
39
		     depends="" 
40
		     description="Setup build sandbox">
41
	</target>
227 dpurdie 42
 
4995 dpurdie 43
	<!--
44
	  M A K E _ P A C K A G E
45
        This target is required by the Automated Build Environment
46
        It should:
47
          1) Compile / Build stuff
48
          2) Package up the build artefacts that are being exported
49
          3) Create the 'descpkg' file
227 dpurdie 50
 
4995 dpurdie 51
      In this example the process is broken into three other targets for
52
      the purpose of illustrating the steps.
53
	  -->
54
	<target name="make_package" 
55
			 depends="clean,compile,package">
56
	</target>
227 dpurdie 57
 
4995 dpurdie 58
    <!--
59
      R U N _ T E S T S
60
      This target is optional in the Automated Build Environment
61
      If the Release Manager entry advertises that the package has unit 
62
      tests, then this target must exist
227 dpurdie 63
 
4995 dpurdie 64
      It should run automated unit tests which conform to the Unit Test 
65
      Automation Paper
66
      It does not have to be dependent on the build process as this will 
67
      already have been performed.
68
     -->
227 dpurdie 69
 
4995 dpurdie 70
    <target name="run_tests" 
71
		     depends="test_1"  
72
		     description="Run automated unit tests">
73
    </target>
74
 
75
<!-- End of Mandatory Target ======================================= -->
76
<!-- The following targets are used by the mandatory targets         -->
227 dpurdie 77
 
4995 dpurdie 78
	<target name="compile" 
79
              depends=""  description="Compile stuff">
80
        <mkdir dir="${classes.dir}"/>
81
        <javac srcdir="${src.dir}" destdir="${classes.dir}"/>
227 dpurdie 82
 
4995 dpurdie 83
        <mkdir dir="${jar.dir}"/>
84
        <jar destfile="${jar.dir}/${packagename}.jar"
85
             basedir="${classes.dir}">
86
            <manifest>
87
                <attribute name="Main-Class" value="HelloWorld"/>
88
            </manifest>
89
        </jar>
90
	</target>
91
 
92
 
93
    <!--
94
      Create the package image
95
      This must be in the directory ${basedir}/build/pkg, as other 
96
      build tools will assume that directory as the location of 
97
      the package.
98
 
99
      Note: The structure of the package is not free-form.
100
            Jar files should go into a 'jar' subdirectory
101
            No files should be places in the package root directory
102
     -->
103
	<target name="package" 
104
               depends=""  
105
               description="Package build artifacts">
106
 
107
        <mkdir dir="${pkg.dir}/jar"/>
108
	    <copy todir="${pkg.dir}/jar">
109
		    <fileset dir="${jar.dir}" includes="**/*"/>
110
		</copy>
111
		<summarise-manifest/>
112
 
113
	</target>
114
 
115
	<!--
116
	  -    This target executes all unit tests in MyPackageTestSuite
117
	  -    It depends on the junit framework.
118
	  -	Further details regarding how to unit test under ANT are
119
	  -	present in the ANT manual
120
	  -->
121
       <target name = "test_1">
122
		<junit printsummary="yes" fork="yes" haltonfailure="no">
123
			<classpath>
124
				<pathelement location="${build.dir}/classes" />
125
			</classpath>
126
			<formatter type="xml"/>
127
			<test name="com.vixtechnology.MyPackage.tests.MyPackageTestSuite"/>
128
		</junit>
129
	</target>
130
 
131
</project> 
132