-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
169 lines (138 loc) · 6.58 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
<project name="Warszawa" basedir="." default="dist">
<!-- Setup ================================================== -->
<!-- version info -->
<!-- 1.7 December 2020. Small fix ClassFinder:243 (detecting that class in package requested from filename)
Also bumped javassist version to 3.27 -->
<property name="warszawa_version" value="1.7"/>
<!-- build info -->
<property name="javaVersion" value="1.7"/> <!-- 1.7 needed for JCommander -->
<property name="src" location="src"/>
<property name="production_build" location="out/ant_production"/>
<property name="test_build" location="out/ant_test"/>
<property name="test_src" location="test"/>
<property name="test_list" value="**/*Test.java"/>
<property name="test_resources" value="test_resources"/>
<property name="system_tests" value="SystemTests"/>
<property name="test_lib" value="test_lib"/>
<path id="compile.classpath">
<fileset dir="bundled_packages">
<include name="**/*.jar"/>
</fileset>
</path>
<path id="test.classpath">
<path refid="compile.classpath"/>
<pathelement location="${production_build}"/>
<pathelement location="${test_build}"/>
<pathelement location="${test_resources}"/>
<fileset dir="test_lib">
<include name="**/*.jar"/>
</fileset>
</path>
<path id="javadoc.classpath">
<path refid="compile.classpath"/>
</path>
<!-- distribution info -->
<property name="dist" location="dist"/>
<property name="javadocs" value="${dist}/doc"/>
<property name="jarName" value="warszawa"/>
<target name="makedirs" description="Make any necessary directories">
<mkdir dir="${production_build}"/>
<mkdir dir="${test_build}"/>
<mkdir dir="${dist}"/>
</target>
<!-- Compile ================================================== -->
<target name="compile" description="compile source" depends="makedirs">
<javac srcdir="${src}" destdir="${production_build}" classpathref="compile.classpath" debug="off"
includeantruntime="false" encoding="UTF-8" source="${javaVersion}" target="${javaVersion}">
<compilerarg value="-Xlint:unchecked"/>
</javac>
</target>
<target name="compile_jcommander" description="compile source">
<javac srcdir="jcommander/src/main/java" destdir="${production_build}" debug="off"
includeantruntime="false" encoding="UTF-8" source="${javaVersion}" target="${javaVersion}">
</javac>
</target>
<!-- Test stuff ================================================== -->
<target name="build_test" description="compile junit tests" depends="compile, compile_jcommander">
<javac srcdir="${test_src}" destdir="${test_build}" classpathref="test.classpath" debug="on"
source="${javaVersion}" target="${javaVersion}"
includeantruntime="false" encoding="UTF-8"/>
</target>
<target name="test" depends="build_test">
<junit fork="yes" haltonfailure="yes">
<assertions enableSystemAssertions="true"/>
<!-- This is necessary for Java 7 on windows only -->
<!-- Hopefully there will come a time when it is no longer necessary -->
<!-- <jvmarg value="-XX:-UseSplitVerifier"/> -->
<batchtest fork="yes">
<fileset dir="${test_src}">
<include name="${test_list}"/>
</fileset>
</batchtest>
<formatter type="plain" usefile="false"/>
<classpath refid="test.classpath"/>
</junit>
</target>
<!-- javadoc =============================================== -->
<target name="doc" description="Javadoc documentation.">
<javadoc classpathref="javadoc.classpath" destdir="${javadocs}" access="public">
<fileset dir="${src}"/>
</javadoc>
</target>
<!-- public dist ================================================== -->
<!--- marcro to build a jar file with or without source. -->
<macrodef name="buildDist">
<attribute name="src" default="NOT SET"/>
<element name="addSrc" optional="yes"/>
<sequential>
<propertyfile file="${production_build}/edu/gvsu/kurmasz/warszawa/buildInfo.properties">
<entry key="builddate" value="now" type="date" pattern="yyyy.MM.dd HH.mm.ss"/>
<entry key="version" value="${warszawa_version}"/>
</propertyfile>
<tstamp>
<format property="now" pattern="E MMM dd HH:mm:ss z yyyy"/>
</tstamp>
<echo file="${dist}/versionInfo"
message="Version ${warszawa_version} built at ${now}.${line.separator}"/>
<echo file="${system_tests}/expected_output/runJar"
message="Warszawa version ${warszawa_version} built ${now}.${line.separator}"/>
<jar destfile="${dist}/${jarName}-${warszawa_version}@{src}.jar">
<manifest>
<attribute name="Built-By" value="Zachary Kurmas"/>
<attribute name="Main-Class" value="edu.gvsu.kurmasz.warszawa.Warszawa"/>
</manifest>
<fileset dir="${dist}" includes="doc/**"/>
<zipgroupfileset dir="bundled_packages" includes="**/*.jar"/>
<fileset dir="${production_build}"/>
<addSrc/>
<!--- This element adds the source -->
</jar>
</sequential>
</macrodef>
<target name="dist_noTest" description="Jar file containing releasable warszawa class files only."
depends="compile">
<buildDist src=""/>
<!-- Don't include any source code -->
</target>
<target name="dist_class" description="Make jar file, but skip tests"
depends="test, doc, dist_noTest"/>
<target name="dist_src" description="Jar file containing releasable warszawa class and source."
depends="compile,test,doc">
<buildDist src="-src"> <!-- jar file name ends with src -->
<addSrc> <!-- add the following filesets to the .jar file -->
<fileset dir="${src}"/>
</addSrc>
</buildDist>
</target>
<target name="dist" description="Distribution 'public' Warszawa packages" depends="dist_class, dist_src"/>
<!-- clean ================================================== -->
<target name="clean" description="Delete class files and docs dir.">
<delete>
<!-- there shouldn't be any .class files here, but it happens -->
<fileset dir="${src}/" includes="**/*.class"/>
<fileset dir="${production_build}/" includes="**/*.class"/>
<fileset dir="${test_build}/" includes="**/*.class"/>
<fileset dir="${dist}/" includes="**"/>
</delete>
</target>
</project>