File: build.xml

package info (click to toggle)
jmdns 3.5.5-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 1,284 kB
  • sloc: java: 10,336; xml: 765; sh: 4; makefile: 2
file content (187 lines) | stat: -rw-r--r-- 7,414 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
<!-- Build the Fulfillment stuff -->
<project name="jmdns" default="help" basedir=".">
	<target name="init">
		<mkdir dir="${dest}" />
		<tstamp />
	</target>

	<!-- Configure the context PATH for this application -->
	<property name="src" value="./src/main/java" />
	<property name="tools" value="./src/sample/java" />
	<property name="samples" value="./src/sample/java" />
	<property name="lib" value="./lib" />
	<property name="test" value="./src/test/java" />
	<property name="build" value="./build" />
	<property name="dest" value="${build}/classes" />
	<property name="reports" value="${build}/reports" />
	<property name="buildlib" value="${build}/lib" />
	<property name="doc" value="${build}/docs" />
	<property name="jdk" value="1.6" />
	<property name="version" value="3.4.2" />
	<property name="release" value="${build}/jmdns-${version}" />

	<target name="help" description="Prints brief help message to screen">
		<echo message="usage:" />
		<echo message="  ant TARGET where TARGET is one of the following:" />
		<echo message="      build   --- Compiles the JmDNS sources. Including the tools" />
		<echo message="      test    --- Compiles the JmDNS tests and runs them against JmDNS" />
		<echo message="      tools   --- Compiles the tools: The browser and main class" />
		<echo message="      samples --- Compiles the samples in the samples package" />
		<echo message="      jar     --- Creates the jmdns.jar file " />
		<echo message="      bundle  --- Creates OSGi javax.jmdns_${version}.jar bundle" />
		<echo message="      javadoc --- Creates the javadoc docs " />
		<echo message="      release --- Creates a release " />
		<echo message="      clean   --- Cleanup time! " />
		<echo message="      help    --- This message " />
	</target>

	<!-- Executable Targets -->

	<target name="build" depends="init" description="compile the generated source">
		<javac target="${jdk}" srcdir="${src}" destdir="${dest}" debug="true">
			<compilerarg value="-Xlint" />
			<include name="javax/**/*.java" />
		</javac>
	</target>

	<target name="tools" depends="build" description="Main program">
		<javac target="${jdk}" srcdir="${tools}" destdir="${dest}">
			<compilerarg value="-Xlint" />
			<include name="com/**/tools/*.java" />
		</javac>
	</target>

	<target name="samples" depends="build" description="Sample programs">
		<javac target="${jdk}" srcdir="${samples}" destdir="${dest}">
			<compilerarg value="-Xlint" />
			<include name="samples/*.java" />
		</javac>
	</target>

	<target name="jar" depends="build" description="Jar the files">
		<mkdir dir="${buildlib}" />
		<jar destfile="${buildlib}/jmdns.jar" manifest="${lib}/jmdns.manifest">
			<fileset dir="${dest}" defaultexcludes="yes">
				<include name="**/*.class" />
				<exclude name="**/test/*.class" />
			</fileset>
		</jar>
	</target>

	<target name="bundle" description="Creates an OSGi bundle" depends="jar">
		<get src="http://www.aqute.biz/repo/biz/aQute/bnd/0.0.401/bnd-0.0.401.jar" dest="${lib}/bnd.jar" ignoreerrors="true" />
		<taskdef resource="aQute/bnd/ant/taskdef.properties" classpath="${lib}/bnd.jar" />
		<echo file="${build}/jmdns.bnd" append="false">
				Bundle-Version: ${version}
				Bundle-Name: JmDNS is a java implementation of the IETF draft RFP multicast extensions for DNS
				Bundle-SymbolicName: javax.jmdns
				Bundle-Vendor: jmdns.sourceforge.net
				Bundle-RequiredExecutionEnvironment: J2SE-${jdk}
				<!-- Hide non API packages -->
				Private-Package: com.strangeberry.jmdns.tools,samples
				<!-- Do not import anything -->
				Import-Package:
				<!-- whenever API is changed, increment this version number according to OSGi spec: -->
				<!-- API breakage: incr major, Feature addition: incr: minor -->
				Export-Package: javax.jmdns;version=${version}
			</echo>
		<bndwrap definitions="${build}" jars="${buildlib}/jmdns.jar" output="${buildlib}/javax.jmdns_${version}.jar" />
	</target>

	<target name="javadoc" depends="build" description="Create the java doc">
		<mkdir dir="${doc}" />
		<javadoc destdir="${doc}" author="true" version="true" header="JmDNS ${version}" windowtitle="JmDNS">
			<fileset dir="${src}" defaultexcludes="yes">
				<include name="javax/**/*.java" />
			</fileset>
			<fileset dir="${samples}" defaultexcludes="yes">
				<include name="com/**/*.java" />
			</fileset>
			<doctitle><![CDATA[<h1>JmDNS</h1>]]></doctitle>
		</javadoc>
	</target>

	<target name="release" depends="build,tools,javadoc,jar,bundle" description="Create a release">
		<delete dir="${release}" includeEmptyDirs="true"  failonerror="false" />
		<mkdir dir="${release}" />
		<copy todir="${release}">
			<fileset dir="." includes="CHANGELOG.txt" />
			<fileset dir="." includes="NOTICE.txt" />
			<fileset dir="." includes="LICENSE" />
			<fileset dir="." includes="build.xml" />
			<fileset dir="." includes="fulllogging.properties" />
		</copy>
		<mkdir dir="${release}/lib" />
		<copy todir="${release}/lib">
			<fileset dir="${buildlib}" includes="jmdns.jar" />
		</copy>
		<mkdir dir="${release}/src" />
		<copy todir="${release}/src">
			<fileset dir="${src}" includes="**/*.java" />
			<fileset dir="${test}" includes="**/*.java" />
			<fileset dir="${samples}" includes="**/*.java" />
		</copy>
		<mkdir dir="${release}/docs" />
		<copy todir="${release}/docs">
			<fileset dir="${doc}" includes="**/*" />
		</copy>
		<zip destfile="${release}.zip">
			<fileset dir="${release}" includes="**/*" />
		</zip>
		<tar destfile="${release}.tar">
			<tarfileset dir="${release}" includes="**/*" />
		</tar>
		<gzip destfile="${release}.tgz" src="${release}.tar" />
	</target>

	<target name="clean">
		<delete dir="${build}" includeEmptyDirs="true"  failonerror="false" />
	</target>

	<!-- Configure custom Ant tasks for the Manager application -->
	<path id="jmdns.classpath">
		<fileset dir="${lib}">
			<include name="*.jar" />
		</fileset>
		<fileset dir="${buildlib}">
			<include name="*.jar" />
		</fileset>
	</path>

	<target name="test" depends="build, jar">
		<mkdir dir="${reports}" />
		<get src="http://repo2.maven.org/maven2/junit/junit/4.8.1/junit-4.8.1.jar" usetimestamp="yes" dest="${lib}/junit.jar" ignoreerrors="true" />
		<get src="http://repo2.maven.org/maven2/org/easymock/easymock/3.0/easymock-3.0.jar" usetimestamp="yes" dest="${lib}/easymock.jar" ignoreerrors="true" />
		<get src="http://repo2.maven.org/maven2/cglib/cglib-nodep/2.2/cglib-nodep-2.2.jar" usetimestamp="yes" dest="${lib}/cglib-nodep.jar" ignoreerrors="true" />
		<get src="http://repo2.maven.org/maven2/org/objenesis/objenesis/1.2/objenesis-1.2.jar" usetimestamp="yes" dest="${lib}/objenesis.jar" ignoreerrors="true" />

		<javac target="${jdk}" srcdir="${test}" destdir="${dest}">
			<compilerarg value="-Xlint" />
			<classpath refid="jmdns.classpath" />
		</javac>

		<junit printsummary="yes" haltonfailure="no" showoutput="yes">
			<classpath>
				<pathelement path="${dest}" />
				<fileset dir="${lib}">
					<include name="**/*.jar" />
				</fileset>
			</classpath>

			<batchtest fork="yes" todir="${reports}">
				<formatter type="xml" />
				<formatter type="brief" usefile="false" />
				<fileset dir="${test}">
					<include name="**/*.java" />
				</fileset>
			</batchtest>
		</junit>
		<junitreport todir="${reports}">
			<fileset dir="${reports}">
				<include name="TEST-*.xml" />
			</fileset>
			<report todir="${reports}" />
		</junitreport>
	</target>

</project>