File: build.xml

package info (click to toggle)
libjgoodies-common-java 1.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,584 kB
  • sloc: java: 2,527; xml: 184; makefile: 7
file content (290 lines) | stat: -rw-r--r-- 11,959 bytes parent folder | download
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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
<?xml version="1.0"?>
<!--
   $Id: build.xml,v 1.5 2011/08/04 08:42:15 lentzsch Exp $

   This is a build file for use with the Jakarta Ant build tool, see
   http://jakarta.apache.org/ant/index.html

   To build, go to the directory where this file is located and run
     ant <target>
   with one of the following targets:
   
     clean               removes temporary files and directories
     compile             compiles the core classes and tests
     javadoc             creates the API documentation
     test                compiles and runs the unit tests
     jar                 creates a library jar
     create-dist-dir     creates a distribution tree: docs, sources, jar
     create-dist-zip     creates a zipped distribution
     create-maven-bundle creates a Maven bundle
     create-all          creates the distribution zip and Maven bundle
     
   To compile, you MUST set the property "build.boot.classpath",
   for example in your user build.properties file a line like:
   build.boot.classpath=C:/Java/Jdk1.5.0_11/jre/lib/rt.jar
   
   To run the unit tests you MUST set the junit.jar property,
   for example in your user build.properties file. 

-->

<project default="create-all" basedir="." name="JGoodies Common" >

    <!-- ***************************************************************** -->
    <!-- Give users a chance to override build properties.                 -->
    <!-- ***************************************************************** -->
    <property file="${user.home}/common.build.properties" />
    <property file="${user.home}/build.properties" />
    <property file="${basedir}/build.properties" />
    <property file="${basedir}/default.properties" />
 
 
    <!-- ***************************************************************** -->
    <!-- P A T H S                                                         -->
    <!-- ***************************************************************** -->
    <path id="classpath.core">
        <pathelement location="${build.core.dir}" 	/> 
    </path>
    
    <path id="classpath.tests">
        <pathelement location="${build.core.dir}" 	/> 
        <pathelement location="${build.test.dir}" 	/> 
        <pathelement location="${junit4.jar}" 		/> 
        <pathelement location="${hamcrest.jar}"		/> 
    </path>
  
    
    <!-- ***************************************************************** -->
    <!-- C L E A N                                                         -->
    <!-- ***************************************************************** -->
	<target name="clean"  
		    description="Removes all temporary files and directories." >

		<delete dir="${build.dir}" />
		<delete dir="${dist.dir}"  />
	</target>
	

    <!-- ***************************************************************** -->
    <!-- P R E P A R A T I O N                                             -->
    <!-- ***************************************************************** -->
	<target name="prepare" 
	        description="Prepares the build and distribution targets." >

        <tstamp>
           <format property="DATE" pattern="yyyy-MM-dd hh:mm:ss" />
        </tstamp>
        
		<mkdir dir="${build.core.dir}"		/>

        <available
            property="junit.task.present"
            classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"
        />
        <available
            property="junit.jar.present"
            file="${junit4.jar}"
        />
	</target>
	
	
    <!-- ***************************************************************** -->
    <!-- C O M P I L A T I O N                                             -->
    <!-- ***************************************************************** -->
	<target name="compile" 
	        depends="compile-core, compile-tests" 
	        description="Compiles the framework and tests." />
	        
    <!-- ***************************************************************** -->
	<target name="compile-core" depends="prepare"
	        description="Compiles the core sources." >
		<javac 
			srcdir       ="${src.core.dir}" 
			destdir      ="${build.core.dir}"
        	encoding     ="${build.encoding}"
        	executable   ="${build.compile.executable}"
        	fork         ="${build.compile.fork}"
			debug        ="${build.compile.debug}"
			depend       ="${build.compile.depend}"
			deprecation  ="${build.compile.deprecation}"
			nowarn       ="${build.compile.nowarn}" 
			optimize     ="${build.compile.optimize}"
            source       ="${build.compile.source}"
			target       ="${build.compile.target}"
			verbose      ="${build.compile.verbose}"
			bootclasspath="${build.boot.classpath}" 
			includeAntRuntime="false" />
	</target>
	
	
    <!-- ***************************************************************** -->
    <target name="compile-tests" depends="compile-core" if="junit.jar.present"
            description="Compiles the unit tests." >
        <mkdir dir="${build.test.dir}"/>
        <javac 
            srcdir       ="${src.test.dir}" 
            destdir      ="${build.test.dir}"
            encoding     ="${build.encoding}"
            executable   ="${build.compile.executable}"
            fork         ="${build.compile.fork}"
            debug        ="${build.compile.debug}"
            depend       ="${build.compile.depend}"
            deprecation  ="${build.compile.deprecation}"
            nowarn       ="${build.compile.nowarn}" 
            optimize     ="${build.compile.optimize}"
            source       ="${build.compile.source}"
            target       ="${build.compile.target}"
            verbose      ="${build.compile.verbose}"
            bootclasspath="${build.boot.classpath}"
            classpathref ="classpath.tests" 
			includeAntRuntime="false" />
    </target>   
    
	
    <!-- ***************************************************************** -->
    <!-- J A V A D O C                                                     -->
    <!-- ***************************************************************** -->
    <target name="javadoc" depends="prepare" 
            description="Creates the API documentation using JavaDoc." >
		<mkdir dir="${build.javadocs.dir}"	/>
        <javadoc 
        	sourcepath="${src.core.dir}"
            packagenames="${javadoc.packages}"
        	destdir="${build.javadocs.dir}"
        	encoding="${build.encoding}"
            access="protected" 
            author="true" 
            version="true" 
            use="true" 
            overview="${javadoc.overview}"
            windowtitle="${Name} ${spec.version} API" 
            doctitle="${Name} ${spec.version} API"
            bottom="${copyright.message}" >
         </javadoc>
    </target>
    
    
    <!-- ***************************************************************** -->
    <!-- U N I T   T E S T S                                               -->
    <!-- ***************************************************************** -->
	<target name="test" depends="compile-tests" if="junit.task.present"
	        description="Compiles and runs the unit tests." >
        <mkdir dir="${build.reports.dir}"/>
        <junit printsummary="yes" haltonfailure="no" >
            <classpath refid="classpath.tests"/>
            <formatter type="plain" />
            <batchtest fork="yes" todir="${build.reports.dir}">
                <fileset dir="${src.test.dir}" includes="**/*Test.java" />
            </batchtest>
        </junit>
	</target>
		
    
    <!-- ***************************************************************** -->
    <!-- J A R                                       				       -->
    <!-- ***************************************************************** -->
	<target name="jar" depends="compile-core"
	        description="Creates the library jar." >
		<jar 
			destfile="${build.core.jar}" >
			<fileset dir="${build.core.dir}" />
            <manifest>
                <attribute name ="Built-By" 
                           value="${user.name}"/>
                <attribute name ="Specification-Title"
                           value="${spec.title}" />
                <attribute name ="Specification-Vendor"
                           value="${spec.vendor}" />
                <attribute name ="Specification-Version"
                           value="${spec.version}" />
         		<attribute name ="Implementation-Title"
                           value="${impl.title}" />
                <attribute name ="Implementation-Vendor"
                           value="${impl.vendor}" />
                <attribute name ="Implementation-Version"
                           value="${impl.version} ${DATE}" />
           </manifest>
		</jar>
	</target>
	
	
    <!-- ***************************************************************** -->
    <!-- C R E A T E                                                       -->
    <!-- ***************************************************************** -->
    <target name="create-all" depends="create-dist-zip, create-maven-bundle"
            description="Creates the distribution zip and Maven bundle." >
    </target>   

  
    <target name="create-dist-dir" depends="clean, compile, javadoc, test, jar"
            description="Creates the distribution directory tree." >
    
        <mkdir dir="${dist.dir}" />
		
		<!-- Compile the documentation. -->
		<copy todir="${dist.docs.dir}" >
			<fileset dir="${docs.dir}"  
			         excludes="**/*.psd, **/*.sxw"     />
		</copy>
        <move todir="${dist.docs.dir}" file="${build.javadocs.dir}" />
		
        <!-- Copy the source directories. -->
        <copy todir="${dist.src.dir}" >
            <fileset dir="${src.dir}" 
                     excludes="unused,
                               unused/**/*"      />
        </copy>
        
		<!-- Copy the distribution files. -->
		<copy todir="${dist.dir}" >
			<fileset dir="${top.dir}" 
				     includes="*.txt, *.html, *.xml, *.properties" 
				     excludes="todo.txt" />
			<filterset>
				<filter token="impl.version"      value="${impl.version}"      />
				<filter token="version.name"      value="${version.name}"      />
				<filter token="copyright.message" value="${copyright.message}" />
				<filter token="copyright.short"   value="${copyright.short}"   />
			</filterset>
		</copy>

		<!-- Copy the library jar file. -->
		<copy tofile="${dist.core.jar}" file="${build.core.jar}" />
	  
	</target>

    <!-- ***************************************************************** -->
    <target name="create-dist-zip" depends="create-dist-dir"
            description="Packages the distribution as a zip file." >
            
        <zip 
            destfile="${dist.zip}" 
            basedir="${dist.root.dir}"
            includes="${dist.subdir}/**/*" />
    </target>
    
    <!-- ***************************************************************** -->
    <target name="create-maven-bundle" depends="create-dist-dir"
            description="Creates a Maven bundle for the Ibiblio upload." >
            
        <!-- Copy the Maven pom template. -->
        <copy 
        	tofile="${dist.maven.pom}" 
        	file="${build.maven.pom.template}" >
			<filterset>
				<filter token="impl.version"      value="${impl.version}"      />
				<filter token="shortname"         value="${shortname}"      />
			</filterset>
    	</copy>
        
        <copy tofile="${dist.maven.bin.jar}" file="${build.core.jar}" />
        <jar 
            destfile="${dist.maven.src.jar}"
            basedir="${dist.src.dir}" />   
        <jar 
            destfile="${dist.maven.bundle}" 
            basedir="${build.maven.dir}" />
    </target>
    
        
</project>