-
Notifications
You must be signed in to change notification settings - Fork 12
/
build.xml
175 lines (149 loc) · 6.48 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
<?xml version="1.0"?>
<project name="jmte" default="jar" basedir=".">
<!--
===================================================================
Set build properties
===================================================================
-->
<property file="${basedir}/common.properties" />
<property file="${basedir}/local.properties" />
<property name="creator" value="floreysoft GmbH" />
<property name="final.name" value="${name}-${version}" />
<property name="nocompiler.name" value="${final.name}" />
<property name="dist.name" value="${name}-${version}-full.zip" />
<property name="nocompiler.jar.name" value="${nocompiler.name}.jar" />
<tstamp>
<format property="TODAY.DATE" pattern="yyyy-MM-dd" locale="us" />
<format property="TODAY.TIME" pattern="HH:mm:ss" locale="us" />
</tstamp>
<property name="today" value="${TODAY.DATE} ${TODAY.TIME}" />
<!--
===================================================================
Set the properties related to the source tree
===================================================================
-->
<property name="src.dir" value="${basedir}/src" />
<property name="java.dir" value="${src.dir}" />
<property name="test.dir" value="${basedir}/test" />
<property name="example.dir" value="${basedir}/example" />
<!--
===================================================================
Set the properties for the build area
===================================================================
-->
<property name="build.dir" value="${basedir}/bin" />
<property name="lib.dir" value="${basedir}/lib" />
<property name="manifest.file.name" value="MANIFST.MF" />
<property name="dist.dir" value="${basedir}/dist" />
<property name="tmp.dir" value="${build.dir}/tmp" />
<property name="doc.dir" value="${basedir}/doc" />
<property name="api.dir" value="${doc.dir}/api" />
<path id="classpath">
<pathelement location="${build.dir}" />
<fileset dir="${lib.dir}" />
</path>
<!--
===================================================================
Prepare the build
===================================================================
-->
<target name="prepare">
<tstamp />
<mkdir dir="${build.dir}" />
<mkdir dir="${dist.dir}" />
</target>
<!--
===================================================================
Build the code
===================================================================
-->
<target name="tag-version" depends="prepare">
<mkdir dir="${tmp.dir}/src"/>
<copy todir="${tmp.dir}/src" >
<fileset dir="${src.dir}"/>
</copy>
<replace dir="${tmp.dir}/src" token="@version@" value="${version}"/>
</target>
<target name="build" depends="prepare,tag-version" description="Compiles the main classes">
<javac destdir="${build.dir}" source="${compile.source}" target="${compile.target}" debug="${compile.debug}"
deprecation="${compile.deprecation}" optimize="${compile.optimize}">
<src path="${tmp.dir}/src"/>
<src path="${test.dir}" />
<classpath refid="classpath" />
</javac>
<copy todir="${build.dir}">
<fileset dir="${src.dir}" includes="**/*.properties" />
<fileset dir="${test.dir}" includes="**/*.jmte" />
<fileset dir="${test.dir}" includes="**/*.txt" />
</copy>
</target>
<!--
===================================================================
Archive the code
===================================================================
-->
<target name="archive-jars" depends="build" description="Builds the exectutable jar-archives">
<jar destfile="${dist.dir}/${nocompiler.jar.name}" filesetmanifest="skip">
<manifest>
<attribute name="Built-By" value="${creator}" />
<attribute name="Main-Class" value="${main-class}" />
<attribute name="Version" value="${version}" />
<attribute name="Build-Date" value="${today}" />
</manifest>
<fileset dir="${build.dir}" excludes="**/*Test*.class,**/*Tests*.class,**/sample/**,tmp/**" />
</jar>
</target>
<!--
===================================================================
Distribute the code
===================================================================
-->
<target name="all" depends="full-dist" description="Creates all distributions" />
<target name="jar" depends="clean,build,test,archive-jars" description="Creates the testet release jar" />
<target name="deploy" description="Deploys jar" if="deploy.dir">
<copy todir="${deploy.dir}">
<fileset file="${dist.dir}/${nocompiler.jar.name}" />
</copy>
</target>
<target name="full-dist" depends="jar,javadoc" description="Source distribution">
<zip destfile="${dist.dir}/${dist.name}">
<zipfileset dir="${example.dir}" prefix="${final.name}/example" />
<zipfileset dir="${test.dir}" prefix="${final.name}/test" />
<zipfileset dir="${src.dir}" prefix="${final.name}/src" />
<zipfileset dir="${doc.dir}" prefix="${final.name}/doc" />
<zipfileset dir="${lib.dir}" prefix="${final.name}/lib" />
<zipfileset dir="${dist.dir}" includes="${nocompiler.jar.name}" prefix="${final.name}" />
<zipfileset dir="${basedir}" includes="build.xml, common.properties, COPYING, local.properties.sample, Releasenotes.md" prefix="${final.name}" />
</zip>
</target>
<target name="javadoc" depends="build" description="Generates the public API">
<delete dir="${api.dir}" />
<javadoc destdir="${api.dir}" author="true" version="true" use="true" access="public" windowtitle="${full.name} - Public API">
<packageset dir="src" defaultexcludes="yes">
<exclude name="**/token/**" />
</packageset>
<link href="http://java.sun.com/javase/6/docs/api/" />
</javadoc>
</target>
<!--
===================================================================
Cleans up build directories
===================================================================
-->
<target name="clean" description="Removes temporaray files">
<delete dir="${build.dir}" />
</target>
<!--
===================================================================
Do tests
===================================================================
-->
<target name="test" depends="build" description="Exectutes JUnit tests">
<mkdir dir="${tmp.dir}" />
<junit printsummary="yes" haltonfailure="yes">
<classpath refid="classpath" />
<formatter type="plain" />
<test name="${test.class}" haltonfailure="yes" todir="${tmp.dir}" />
</junit>
</target>
</project>