File: build.xml

package info (click to toggle)
amap-align 2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny, squeeze
  • size: 1,380 kB
  • ctags: 399
  • sloc: cpp: 3,471; java: 549; xml: 434; makefile: 62; sh: 6
file content (238 lines) | stat: -rw-r--r-- 8,794 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238

<!--
  - 
  -  file: build.xml
  - 
  -  Copyright (c) 2007, Michael E. Smoot 
  - 
  -  This program is free software; you can redistribute it and/or modify it 
  -  under the terms of the GNU General Public License as published by the 
  -  Free Software Foundation; either version 2 of the License, or (at your 
  -  option) any later version.
  -  
  -  This program is distributed in the hope that it will be useful, but 
  -  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
  -  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
  -  for more details.
  -  
  -  You should have received a copy of the GNU General Public License along 
  -  with this program; if not, write to the Free Software Foundation, Inc., 
  -  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  - 
  -->

<project name="AmapDisplay" default="all" basedir=".">

  <!-- =================================================================== -->
  <!-- Initialization target                                               -->
  <!-- =================================================================== -->
  <target name="init">
    <tstamp/>
    <property name="name" value="AmapDisplay"/>
    <property name="version" value="0.1"/>

    <echo message="Building ${name} version ${version} ..."/>

	<property name="main.class" value="amap.AmapDisplay"/>

    <!-- Inheritable properties -->
    <property name="debug" value="on"/>
    <property name="optimize" value="off"/>
    <property name="deprecation" value="off"/>
    <property name="fork" value="false"/>

    <!-- Define the directories -->
    <property name="root.dir" value="."/>
    <property name="lib.dir" value="${root.dir}/lib"/>
    <property name="src.dir" value="${root.dir}/src"/>
    <property name="tests.dir" value="${root.dir}/tests"/>
    <property name="build.dir" value="${root.dir}/build"/>
    <property name="javadoc.dir" value="${root.dir}/API"/>
    <property name="log.dir" value="${build.dir}/logs" />
    <property name="junit.report.dir" value="${log.dir}/junit-reports" />

    <!-- Define the relevant files -->
    <property name="project.jar" value="${name}.jar"/>
    <property name="test.jar" value="${name}-tests.jar"/>

    <!-- Define the class path - Defaults to everything in the lib.dir -->
    <path id="project.class.path">
      <fileset dir="${lib.dir}">
        <include name="*.jar"/>
      </fileset>
    </path>

    <!-- Put the classpath in manifest form -->
    <pathconvert property="manifest.class.path.string"
                 pathsep=" ">
      <path refid="project.class.path"/>
      <mapper type="regexp" from="${lib.dir}/(.*)" to="${lib}/\1"/>
    </pathconvert>

    <!-- Define the junit class path - It needs to find what we just built --> 
    <path id="junit.class.path" >
      <fileset dir="${root.dir}">
        <include name="*.jar"/>
      </fileset>
      <fileset dir="${lib.dir}">
        <include name="*.jar"/>
      </fileset>
    </path>

    <!-- Make sure tests is in the right place -->
    <condition property="tests.ok">
      <and>
        <available file="${tests.dir}" />
      </and>
    </condition>

  </target>

  <!-- =================================================================== -->
  <!-- Compiles the project                                                -->
  <!-- =================================================================== -->
  <target name="compile" 
          depends="init" >
    <mkdir dir="${build.dir}"/>
    <mkdir dir="${log.dir}"/>
    <javac srcdir="${src.dir}"
           classpathref="project.class.path"
           destdir="${build.dir}"
           debug="${debug}"
           deprecation="${deprecation}" 
           optimize="${optimize}"
           fork="${fork}">
<!--
       <compilerarg line="-Xlint:all -Xlint:-path"/>
-->
     </javac>
     <echo message="Successfully ran compile task!"/>
  </target>


  <!-- =================================================================== -->
  <!-- Creates the project jar file                                        -->
  <!-- =================================================================== -->
  <target name="jar" 
          depends="compile" >
    <mkdir dir="${lib.dir}"/>
	
    <jar destfile="${project.jar}" >
      <fileset dir="${build.dir}"
               includes="**"/>
      <manifest> 
        <attribute name="Main-Class" value="${main.class}"/>
        <attribute name="Class-Path" value="${manifest.classpath.string}"/>
      </manifest>
    </jar>
    <echo message="Successfully ran jar task!"/>
  </target>

  <!-- =================================================================== -->
  <!-- Compiles the tests                                                  -->
  <!-- Note that this compilation occurs AFTER the distribution jar has    -->
  <!-- been created, so that the tests aren't distributed.                 -->
  <!-- =================================================================== -->
  <target name="compile-tests"
          depends="jar" 
          if="tests.ok">
    <javac srcdir="${tests.dir}"
           classpathref="project.class.path"
           destdir="${build.dir}"
           debug="${debug}"
           deprecation="${deprecation}" 
           optimize="${optimize}"
           fork="${fork}">
      <compilerarg line="-Xlint:all -Xlint:-path"/>
    </javac>
    <echo message="Successfully ran compile-tests task!"/>
  </target>

  <!-- =================================================================== -->
  <!-- Creates the project-tests.jar file                                  -->
  <!-- =================================================================== -->
  <target name="jar-tests"
          depends="compile-tests"
          if="tests.ok">
    <jar jarfile="${test.jar}"
         basedir="${build.dir}" >
    </jar>
    <echo message="Successfully ran jar-tests task!"/>
  </target>



  <!-- =================================================================== -->
  <!-- Runs the unit tests.                                                --> 
  <!-- =================================================================== -->
  <target name="test"
          depends="jar-tests"
          if="tests.ok">
    <junit printsummary="yes"
           haltonfailure="no"
           maxmemory="256m" >
      <classpath refid="junit.class.path"/>
      <formatter type="plain" 
                 usefile="true" />
      <formatter type="xml" 
                 usefile="true" />
      <batchtest fork="yes" 
                 todir="${log.dir}" 
                 failureProperty="junit.test.failure"
                 errorProperty="junit.test.failure">
        <fileset dir="${tests.dir}"
                 includes="**/*Test.java"
                 excludes="**/AllTests.java" />
      </batchtest> 
    </junit>
    <mkdir dir="${junit.report.dir}"/>
    <junitreport todir="${junit.report.dir}">
      <fileset dir="${log.dir}">
        <include name="TEST-*.xml"/>
      </fileset>
      <report format="frames" todir="${junit.report.dir}"/>
    </junitreport>
    <fail message="TEST FAILURE!!! Details: ${junit.report.dir}/index.html"
          if="junit.test.failure"/>
    <echo message="Successfully ran test task!"/>
  </target>

  <!-- =================================================================== -->
  <!-- Creates the API documentation                                       -->
  <!-- =================================================================== -->
  <target name="docs" 
          depends="init" > 
    <mkdir dir="${javadoc.dir}"/>
    <javadoc sourcepath="${src.dir}"
             destdir="${javadoc.dir}"
             packagenames="*"
             classpathref="project.class.path"
             author="true"
             version="true"
             use="true"
             splitindex="true"
             noindex="false"
             windowtitle="${name} API"
             doctitle="${name}" />
    <echo message="Successfully ran docs task!"/>
  </target>

  <!-- =================================================================== -->
  <!-- Do everything                                                       --> 
  <!-- =================================================================== -->
  <target name="all" depends="jar,docs,test" /> 

  <!-- =================================================================== -->
  <!-- Clean up, get back to original state                                -->
  <!-- =================================================================== -->
  <target name="clean" 
          depends="init">
    <delete dir="${build.dir}"/>
    <delete dir="${javadoc.dir}"/>
    <delete file="${project.jar}"/>
    <delete file="${test.jar}"/>
    <echo message="Successfully ran clean task!"/>
  </target>

</project>