This repository has been archived by the owner on Jun 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.xml
201 lines (168 loc) · 9.74 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="org.macroing.gdt.openrc" default="distribution" basedir=".">
<!--The following properties should be specified by each project. Some of them are the same for all projects, whereas others are not.-->
<property name="java.source" value="1.8"/>
<property name="java.target" value="1.8"/>
<property name="project.class.classpath" value=". aparapi.jar"/>
<property name="project.class.main" value="org.macroing.gdt.openrc.TestGame"/>
<property name="project.version" value="0.1-beta"/>
<property name="root.directory" location="."/>
<property name="vendor.name" value="Macroing.org"/>
<!--The following properties are based on the above properties and don't really need to change.-->
<property name="distribution.directory" location="${root.directory}/distribution"/>
<property name="project.build.directory" location="build"/>
<property name="project.build.main.directory" location="${project.build.directory}/main/java"/>
<property name="project.build.test.directory" location="${project.build.directory}/test/java"/>
<property name="project.documentation.directory" location="doc"/>
<property name="project.documentation.data.directory" location="${project.documentation.directory}/data"/>
<property name="project.documentation.html.directory" location="${project.documentation.directory}/html"/>
<property name="project.documentation.javadoc.directory" location="${project.documentation.directory}/javadoc"/>
<property name="project.name" value="${ant.project.name}"/>
<property name="project.resources.directory" location="resources"/>
<property name="project.resources.distribution.directory" location="${project.resources.directory}/distribution"/>
<property name="project.resources.jar.directory" location="${project.resources.directory}/jar"/>
<property name="project.resources.metainf.directory" location="${project.resources.directory}/metainf"/>
<property name="project.source.directory" location="src"/>
<property name="project.source.main.directory" location="${project.source.directory}/main/java"/>
<property name="project.source.test.directory" location="${project.source.directory}/test/java"/>
<property name="repository.directory" location="${root.directory}/repository"/>
<property name="repository.file" location="${repository.directory}/${project.name}.jar"/>
<condition property="hasMainClass" value="true">
<isset property="project.class.main"/>
</condition>
<condition property="hasNoMainClass" value="true">
<not>
<isset property="project.class.main"/>
</not>
</condition>
<path id="repository.path">
<fileset dir="${repository.directory}" includes="**/*.jar"/>
</path>
<path id="project.build.main.path">
<path refid="repository.path"/>
<pathelement location="${project.build.main.directory}"/>
</path>
<path id="project.build.test.path">
<path refid="repository.path"/>
<pathelement location="${project.build.main.directory}"/>
<pathelement location="${project.build.test.directory}"/>
</path>
<target name="clean" description="Deletes generated directories and files for project ${project.name}.">
<delete dir="${project.build.directory}"/>
<delete dir="${project.documentation.directory}"/>
<delete file="${repository.file}"/>
</target>
<target name="initialize" depends="clean" description="Creates needed directories for project ${project.name}.">
<mkdir dir="${project.build.main.directory}"/>
<mkdir dir="${project.build.test.directory}"/>
<mkdir dir="${project.documentation.data.directory}"/>
<mkdir dir="${project.documentation.html.directory}"/>
<mkdir dir="${project.documentation.javadoc.directory}"/>
<mkdir dir="${project.resources.distribution.directory}"/>
<mkdir dir="${project.resources.jar.directory}"/>
<mkdir dir="${project.resources.metainf.directory}"/>
<mkdir dir="${project.source.main.directory}"/>
<mkdir dir="${project.source.test.directory}"/>
<mkdir dir="${repository.directory}"/>
</target>
<target name="compile.main" depends="initialize" description="Compiles the main Java source code for project ${project.name}.">
<javac source="${java.source}" target="${java.target}" srcdir="${project.source.main.directory}" destdir="${project.build.main.directory}" classpathref="repository.path" includeAntRuntime="false" encoding="UTF-8" debug="true" debuglevel="lines,vars,source">
<compilerarg value="-Xlint:all"/>
</javac>
</target>
<target name="compile.test" depends="compile.main" description="Compiles the test Java source code for project ${project.name}.">
<javac source="${java.source}" target="${java.target}" srcdir="${project.source.test.directory}" destdir="${project.build.test.directory}" classpathref="project.build.main.path" includeAntRuntime="false" encoding="UTF-8" debug="true" debuglevel="lines,vars,source">
<compilerarg value="-Xlint:all"/>
</javac>
</target>
<target name="test" depends="compile.test" description="Runs JUnit tests for project ${project.name}.">
<junit printsummary="true">
<classpath refid="project.build.test.path"/>
<formatter type="plain"/>
<formatter type="xml"/>
<batchtest todir="${project.documentation.data.directory}">
<fileset dir="${project.build.test.directory}" includes="**/*Test.class"/>
</batchtest>
</junit>
</target>
<target name="test.report" depends="test" description="Generates JUnit test reports for project ${project.name}.">
<junitreport todir="${project.documentation.data.directory}">
<fileset dir="${project.documentation.data.directory}">
<include name="TEST-*.xml"/>
</fileset>
<!--The report task could not be used due to bugs in previous versions of required libraries (either Apache Ant, Apache Xalan, ...). It was in Java 7.-->
<report format="frames" todir="${project.documentation.html.directory}"/>
</junitreport>
</target>
<target name="jar" depends="compile.main" description="Generates a Jar file for project ${project.name}.">
<antcall target="jar.1"/>
<antcall target="jar.2"/>
</target>
<target name="jar.1" depends="compile.main" description="Generates a Jar file for project ${project.name}." if="hasNoMainClass">
<tstamp>
<format property="build.date" pattern="EEEE, d MMMM yyyy"/>
<format property="build.time" pattern="hh:mm a"/>
</tstamp>
<jar destfile="${repository.file}" basedir="${project.build.main.directory}">
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Specification-Title" value="${project.name}"/>
<attribute name="Specification-Version" value="${project.version}"/>
<attribute name="Specification-Vendor" value="${vendor.name}"/>
<attribute name="Implementation-Title" value="${project.name}"/>
<attribute name="Implementation-Version" value="${project.version} - built at ${build.time} on ${build.date}"/>
<attribute name="Implementation-Vendor" value="${vendor.name}"/>
</manifest>
<fileset dir="${project.resources.jar.directory}" excludes="**/.*/**"/>
<metainf dir="${project.resources.metainf.directory}" excludes="**/.*/**"/>
</jar>
</target>
<target name="jar.2" depends="compile.main" description="Generates a Jar file for project ${project.name}." if="hasMainClass">
<tstamp>
<format property="build.date" pattern="EEEE, d MMMM yyyy"/>
<format property="build.time" pattern="hh:mm a"/>
</tstamp>
<jar destfile="${repository.file}" basedir="${project.build.main.directory}">
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Class-Path" value="${project.class.classpath}"/>
<attribute name="Main-Class" value="${project.class.main}"/>
<attribute name="Specification-Title" value="${project.name}"/>
<attribute name="Specification-Version" value="${project.version}"/>
<attribute name="Specification-Vendor" value="${vendor.name}"/>
<attribute name="Implementation-Title" value="${project.name}"/>
<attribute name="Implementation-Version" value="${project.version} - built at ${build.time} on ${build.date}"/>
<attribute name="Implementation-Vendor" value="${vendor.name}"/>
<attribute name="SplashScreen-Image" value="SplashScreen.jpg"/>
</manifest>
<fileset dir="${project.resources.jar.directory}" excludes="**/.*/**"/>
<metainf dir="${project.resources.metainf.directory}" excludes="**/.*/**"/>
</jar>
</target>
<target name="javadoc" depends="compile.main" description="Generates Javadoc for project ${project.name}.">
<javadoc encoding="UTF-8" charset="UTF-8" docencoding="UTF-8" sourcepath="${project.source.main.directory}" destdir="${project.documentation.javadoc.directory}" author="true" version="true" use="true" access="protected" linksource="false" windowtitle="${project.name} API">
<classpath>
<path refid="repository.path"/>
<pathelement location="${project.build.main.directory}"/>
</classpath>
</javadoc>
</target>
<target name="distribution" depends="test.report, jar, javadoc">
<delete dir="${distribution.directory}/${project.name}-${project.version}"/>
<mkdir dir="${distribution.directory}/${project.name}-${project.version}"/>
<copy todir="${distribution.directory}/${project.name}-${project.version}">
<fileset dir="${repository.directory}" includes="${project.name}.jar"/>
<fileset dir="${repository.directory}" includes="aparapi.jar"/>
<fileset dir="${project.resources.distribution.directory}"/>
<fileset dir="." includes="COPYING"/>
<fileset dir="." includes="COPYING.LESSER"/>
<fileset dir="." includes="README.md"/>
</copy>
<copy todir="${distribution.directory}/${project.name}-${project.version}/doc">
<fileset dir="${project.documentation.javadoc.directory}"/>
</copy>
<copy todir="${distribution.directory}/${project.name}-${project.version}/src">
<fileset dir="${project.source.main.directory}"/>
</copy>
</target>
</project>