-
Notifications
You must be signed in to change notification settings - Fork 67
/
build.xml
248 lines (213 loc) · 7.92 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
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
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Mibble MIB Parser (www.mibble.org)
See LICENSE.txt for licensing information.
Copyright (c) 2004-2017 Per Cederberg. All rights reserved.
-->
<project name="mibble" default="all">
<!--
BUILD INSTRUCTIONS
This is an Ant build file for Mibble. You can use it to simplify
compiling and packaging of your own modifications to the original
Mibble source code. Note that this build file will overwrite content
in the current directory as a result of the build process.
To run Ant, choose one (or more) of the targets under the TOP-LEVEL
TARGETS heading below. If you run Ant without any target specified
it will build the whole Mibble project, while also performing tests
and creating the documentation.
The following build properties are available (specify on the
command-line with -Dname=value):
build.name
The base name of the build. Defaults to "mibble".
build.version
The build version number. Defaults to todays date.
build.optimized
The optimized build flag. Set to any value to compile without
debug information. By default this flag is off.
-->
<!-- INITIALIZATION -->
<property name="build.name" value="${ant.project.name}" />
<property name="build.title" value="Mibble" />
<property name="build.java.package" value="net.percederberg.mibble" />
<tstamp>
<format property="build.year" pattern="yyyy" />
<format property="build.printdate" pattern="yyyy-MM-dd" />
</tstamp>
<property name="build.version" value="${DSTAMP}" />
<property name="build.date" value="${DSTAMP}" />
<property name="build.sysclasspath" value="ignore" />
<patternset id="pattern.srcfiles">
<include name="**/*.css" />
<include name="**/*.grammar" />
<include name="**/*.java" />
<include name="**/*.sh" />
<include name="**/*.txt" />
<include name="**/*.xml" />
<include name="**/*.xsl" />
</patternset>
<path id="project.class.path">
<fileset dir="lib" includes="*.jar" />
</path>
<!-- TOP-LEVEL TARGETS -->
<target name="all" description="Performs a full rebuild, including tests"
depends="compile,test,doc" />
<target name="minimal" description="Performs a minimal rebuild, excluding tests"
depends="compile,doc" />
<target name="compile" description="Compiles the source code"
depends="compile-clean,compile-codegen,compile-java,compile-scripts" />
<target name="test" description="Runs the validation tests"
depends="compile,test-validator" />
<target name="doc" description="Generates the documentation"
depends="doc-clean,doc-text,doc-html,doc-java" />
<!-- COMPILATION TARGETS -->
<target name="compile-clean">
<delete quiet="true">
<fileset dir="bin" />
<fileset dir="classes" />
<fileset dir="lib" includes="mibble*.jar" />
</delete>
<mkdir dir="bin" />
<mkdir dir="classes" />
<mkdir dir="lib" />
<replaceregexp match="\s+$" replace="" flags="g" byline="true">
<fileset dir=".">
<patternset refid="pattern.srcfiles" />
<include name="**/*.bat" />
<include name="src/mibs/**/*" />
</fileset>
</replaceregexp>
<fixcrlf srcdir="." tab="remove">
<patternset refid="pattern.srcfiles" />
<include name="src/mibs/**/*" />
</fixcrlf>
<fixcrlf srcdir="." eol="dos" eof="add" tab="remove">
<include name="**/*.bat" />
</fixcrlf>
</target>
<target name="compile-codegen">
<taskdef resource="ant-grammatica.properties" classpathref="project.class.path" />
<grammatica grammar="src/grammar/asn1.grammar">
<java dir="src/java"
package="${build.java.package}.asn1"
public="true" />
</grammatica>
</target>
<target name="compile-java"
depends="compile-java-optimized,compile-java-debug">
<echo file="classes/net/percederberg/mibble/build.properties"># Automatically Generated, DO NOT EDIT
build.title = ${build.title}
build.version = ${build.version}
build.date = ${build.printdate}
</echo>
<unjar src="lib/grammatica-1.6.jar" dest="classes">
<patternset>
<include name="net/percederberg/grammatica/parser/**/*.class" />
</patternset>
</unjar>
<jar jarfile="lib/${build.name}-parser-${build.version}.jar">
<manifest>
<attribute name="Main-Class" value="${build.java.package}.MibbleBrowser" />
<attribute name="Class-Path" value="${build.name}-mibs-${build.version}.jar" />
</manifest>
<fileset dir="." includes="README.txt" />
<fileset dir="." includes="LICENSE.txt" />
<fileset dir="classes" />
</jar>
<jar jarfile="lib/${build.name}-mibs-${build.version}.jar">
<zipfileset dir="src/mibs" prefix="mibs" />
</jar>
<unjar src="lib/snmp6_1.jar" dest="classes" />
<jar jarfile="${build.title}Browser.jar">
<manifest>
<attribute name="Main-Class" value="${build.java.package}.MibbleBrowser" />
</manifest>
<fileset dir="." includes="README.txt" />
<fileset dir="." includes="LICENSE.txt" />
<fileset dir="classes" />
<zipfileset dir="src/mibs" prefix="mibs" />
</jar>
</target>
<target name="compile-java-optimized" if="build.optimized">
<javac srcdir="src/java"
destdir="classes"
classpathref="project.class.path"
source="1.7"
target="1.7"
debug="off"
optimize="on"
deprecation="on" />
</target>
<target name="compile-java-debug" unless="build.optimized">
<javac srcdir="src/java"
destdir="classes"
classpathref="project.class.path"
source="1.7"
target="1.7"
debug="on"
deprecation="on" />
</target>
<target name="compile-scripts">
<copy todir="bin" overwrite="true">
<fileset dir="src/bin" />
<filterset>
<filter token="NAME" value="${build.name}" />
<filter token="VERSION" value="${build.version}" />
</filterset>
</copy>
<chmod dir="bin" includes="*.sh" perm="ugo+x" />
</target>
<!-- TEST TARGETS -->
<target name="test-validator">
<java classname="${build.java.package}.MibbleValidator"
classpath="lib/${build.name}-parser-${build.version}.jar"
failonerror="true">
<arg value="src/mibs" />
</java>
</target>
<!-- DOCUMENTATION TARGETS -->
<target name="doc-clean">
<delete dir="doc" quiet="true" />
<mkdir dir="doc" />
<mkdir dir="doc/api" />
</target>
<target name="doc-text">
<xslt style="src/doc/txt.xsl"
basedir="src/doc/release"
destdir="doc"
extension=".txt"
includes="*.xml">
<param name="name" expression="${build.name}" />
<param name="version" expression="${build.version}" />
<param name="year" expression="${build.year}" />
<param name="date" expression="${build.printdate}" />
</xslt>
</target>
<target name="doc-html">
<copy file="src/doc/style.css"
todir="doc" />
<xslt style="src/doc/html.xsl"
basedir="src/doc/release"
destdir="doc"
extension=".html"
includes="*.xml">
<param name="name" expression="${build.name}" />
<param name="version" expression="${build.version}" />
<param name="year" expression="${build.year}" />
<param name="date" expression="${build.printdate}" />
<param name="style" expression="style.css" />
</xslt>
</target>
<target name="doc-java">
<javadoc packagenames="${build.java.package}.*"
excludepackagenames="${build.java.package}.asn1.*,${build.java.package}.browser.*"
sourcepath="src/java"
destdir="doc/api"
classpath="classes"
classpathref="project.class.path"
version="false"
use="true"
author="false"
windowtitle="${build.title} ${build.version} Documentation"
failonerror="true" />
</target>
</project>