-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.xml
205 lines (158 loc) · 6.32 KB
/
build.xml
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
<?xml version="1.0" encoding="UTF-8"?>
<!--
JNITasks: Ant tasks for JNI projects.
Copyright (C) 2013-2014 Alexander Barker. All Rights Received.
https://github.com/kwhat/jnitasks/
JNITasks is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
JNITasks 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 Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<project name="JNITasks" default="all" basedir=".">
<!-- Project Settings -->
<property file="build.num" />
<tstamp>
<format property="ant.build.revision" pattern="yyyyMMdd" />
</tstamp>
<property name="ant.project.vendor" value="Alexander Barker ([email protected])" />
<property name="ant.project.version" value="${ant.build.major}.${ant.build.minor}.${ant.build.revision}" />
<property file="build.properties" />
<property environment="env" />
<!-- Path Settings -->
<property name="dir.src" value="${basedir}/src" />
<property name="dir.test" value="${basedir}/test" />
<property name="dir.doc" value="${basedir}/doc" />
<property name="dir.jdoc" value="${basedir}/javadoc" />
<property name="dir.jar" value="${basedir}/jar" />
<property name="dir.dist" value="${basedir}/dist" />
<property name="dir.bin" value="${basedir}/bin" />
<!-- Class Path Settings -->
<!-- NOTE Gentoo requires `CLASSPATH="$(java-config -p ant-junit,junit-4)" ant test` -->
<path id="ant.project.class.path">
<pathelement location="${dir.bin}" />
<!-- pathelement location="${dir.bin}/test" /-->
<pathelement location="${dir.jar}" />
<pathelement path="${java.class.path}" />
</path>
<target name="clean" description="Removes generated bytecode and object files.">
<echo>Cleaning build structure...</echo>
<delete includeEmptyDirs="true" verbose="true" failonerror="false">
<fileset dir="${dir.bin}" includes="**/*" />
</delete>
</target>
<target name="compile" description="Compiles Java source files.">
<echo>Compiling Java source...</echo>
<mkdir dir="${dir.bin}" />
<javac
destdir="${dir.bin}"
debug="${ant.build.debug}"
debuglevel="lines,vars,source"
deprecation="false"
includeantruntime="false"
listfiles="true"
verbose="false"
>
<compilerarg line="${ant.build.javac.args}" />
<src path="${dir.src}" />
<classpath refid="ant.project.class.path" />
</javac>
<!-- Copy over the antlib.xml definitions. -->
<copy overwrite="true" todir="${dir.bin}">
<fileset dir="${dir.src}" includes="**/antlib.xml" />
</copy>
</target>
<target name="test" description="Perform JUnit tests.">
<echo>Compiling JUnit source...</echo>
<mkdir dir="${dir.bin}" />
<javac
destdir="${dir.bin}"
debug="${ant.build.debug}"
debuglevel="lines,vars,source"
deprecation="false"
includeantruntime="false"
listfiles="true"
verbose="false"
>
<compilerarg line="${ant.build.javac.args}" />
<src path="${dir.test}" />
<classpath refid="ant.project.class.path" />
</javac>
<echo>Performing JUnit tests...</echo>
<junit fork="true" printsummary="true" haltonerror="true">
<classpath refid="ant.project.class.path" />
<formatter type="brief" usefile="false" />
<!-- test name="TestExample" / -->
<batchtest> <!-- todir="${reports.tests}" -->
<fileset dir="${dir.test}">
<include name="**/*Test.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="jar" description="Creates the jar library.">
<echo>Creating ${ant.project.name}.jar...</echo>
<mkdir dir="${dir.jar}" />
<jar jarfile="${dir.jar}/${ant.project.name}.jar" basedir="${dir.bin}">
<include name="org/jnitasks/**" />
<exclude name="org/jnitasks/test/**" />
<manifest>
<section name="org/jnitasks">
<attribute name="Implementation-Title" value="${ant.project.name}" />
<attribute name="Implementation-Version" value="${ant.project.version}" />
<attribute name="Implementation-Vendor" value="${ant.project.vendor}" />
</section>
</manifest>
</jar>
</target>
<target name="javadoc" description="Generates javadoc api documentation.">
<echo level="info">Generating API Documentation...</echo>
<mkdir dir="${dir.jdoc}" />
<javadoc destdir="${dir.jdoc}" windowtitle="${ant.project.name}" author="true" version="true" use="true">
<packageset dir="${dir.src}" defaultexcludes="yes">
<include name="org/jnitasks/**" />
<exclude name="org/jnitasks/test/**" />
</packageset>
<doctitle><![CDATA[<h1>${project.name} API Documentation</h1>]]></doctitle>
<bottom><![CDATA[<i>Copyright © 2013 ${project.vendor}. All Rights Received.</i>]]></bottom>
<!--
<tag name="to.do" scope="all" description="To Do:" />
<tag name="fix.me" scope="all" description="Fix Needed:" />
-->
<link href="http://docs.oracle.com/javase/7/docs/api/" />
</javadoc>
</target>
<target name="package" depends="jar,javadoc" description="Creates zip files for distribution.">
<!-- Copy Files To Dist Locations -->
<echo>Creating Distribution Archive...</echo>
<mkdir dir="${dir.dist}" />
<zip destfile="${dir.dist}/${ant.project.name}-${ant.project.version}.zip" level="9">
<zipfileset dir="${dir.doc}" prefix="${ant.project.name}/doc">
<exclude name="**/.*" />
</zipfileset>
<zipfileset dir="${dir.jdoc}" prefix="${ant.project.name}/javadoc">
<exclude name="**/.*" />
</zipfileset>
<zipfileset dir="${dir.jar}" prefix="${ant.project.name}/jar">
<include name="${ant.project.name}.jar" />
</zipfileset>
<zipfileset dir="${dir.src}" prefix="${ant.project.name}/src">
<exclude name="**/.*" />
</zipfileset>
<zipfileset dir="${dir.test}" prefix="${ant.project.name}/test">
<exclude name="**/.*" />
</zipfileset>
<zipfileset dir="${basedir}" prefix="${ant.project.name}">
<include name="build.*" />
<include name="*.md" />
</zipfileset>
</zip>
</target>
<target name="all" depends="compile,jar" description="Compile all source files and create the jar library.">
</target>
</project>