-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.xml
187 lines (166 loc) · 6.71 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
<project xmlns:ivy="antlib:org.apache.ivy.ant"
name="SigmaUtils" default="all" basedir=".">
<property name="ivy.install.version" value="2.5.1"/>
<property name="ivy.home" value="${basedir}/.ivy"/>
<property name="ivy.jar.dir" value="${ivy.home}/lib"/>
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar"/>
<target name="check.for.ivy.jar">
<available file="${ivy.jar.file}" property="ivy.present"/>
</target>
<target name="download-ivy" depends="check.for.ivy.jar" unless="ivy.present">
<mkdir dir="${ivy.jar.dir}"/>
<!-- download Ivy from web site so that it can be used even without any special installation -->
<get src="https://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.jar.file}" usetimestamp="true"/>
</target>
<target name="init-ivy" depends="download-ivy">
<!-- try to load Ivy here from Ivy home, in case the user has not already dropped
it into Ant's lib dir (note that the latter copy will always take precedence).
We will not fail as long as local lib dir exists (it may be empty) and
Ivy is in at least one of Ant's lib dir or the local lib dir. -->
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
</target>
<property name="app.name" value="sigmaUtils"/>
<property name="build.home" value="build"/>
<property name="build.classes" value="${build.home}/classes"/>
<property name="build.test.classes" value="${build.home}/test/classes"/>
<!--<property name="build.lib" value="${build.home}/lib"/>-->
<property environment="env"/>
<property name="javac.release" value="11"/>
<property name="unit.test.suite" value="com.articulate.sigma.UnitTestSuite"/>
<property name="reports.dir" value="${build.home}/test/results"/>
<property name="report.html" value="file:${basedir}/${reports.dir}/html/index.html"/>
<condition property="isUnixNotMac">
<and>
<os family="unix"/>
<not>
<os family="mac"/>
</not>
</and>
</condition>
<target name="init" depends="init-ivy">
<echo>Java Version via Ant: ${ant.java.version}</echo>
<echo>Java Version System Prop: ${java.version}</echo>
<ivy:retrieve/>
</target>
<target name="compile" depends="init" description="Compile the project and place in ${build.classes}.">
<mkdir dir="${build.classes}"/>
<javac destdir="${build.classes}"
debug="on"
optimize="on"
deprecation="on"
includeantruntime="false"
classpathref="compile.classpath"
release="${javac.release}">
<src refid="core.sourcepath"/>
</javac>
<!-- <copy todir="${build.lib}">
<fileset dir="${basedir}/lib"/>
</copy>-->
</target>
<path id="core.sourcepath">
<pathelement path="src/java"/>
</path>
<path id="compile.classpath">
<fileset dir="${basedir}/lib">
<include name="*.jar"/>
</fileset>
</path>
<path id="test.sourcepath">
<pathelement path="test/unit/java"/>
</path>
<path id="classpath.test">
<pathelement location="lib/junit-4.13.2.jar"/>
<pathelement location="lib/hamcrest-core-1.3.jar"/>
<pathelement location="${build.classes}"/>
</path>
<target name="test-compile" depends="compile">
<mkdir dir="${build.test.classes}"/>
<javac destdir="${build.test.classes}"
debug="on"
optimize="on"
deprecation="on"
includeantruntime="false"
classpathref="classpath.test">
<src refid="test.sourcepath"/>
</javac>
<mkdir dir="${reports.dir}"/>
</target>
<!--
==========
UNIT TESTS
==========
-->
<target name="test" depends="test.unit"/>
<target name="test.unit" depends="test-compile" description="Runs the UnitTestSuite">
<junit printsummary="on"
showoutput="yes"
haltonfailure="yes"
fork="true">
<formatter type="plain" usefile="false"/>
<classpath>
<path refid="classpath.test"/>
<pathelement location="${build.test.classes}"/>
</classpath>
<test name="${unit.test.suite}" haltonfailure="no" todir="${reports.dir}">
<formatter type="xml"/>
</test>
</junit>
<antcall target="junit.report"/>
</target>
<target name="junit.report" >
<junitreport todir="${reports.dir}">
<fileset dir="${reports.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${reports.dir}/html"/>
</junitreport>
<!--<antcall target="open.junit.report"/>-->
</target>
<target name="open.junit.report" depends="report.mac,report.unix"/>
<target name="report.mac" unless="isUnixNotMac">
<exec executable="sh" osfamily="mac">
<arg value="-c"/>
<arg value="open -u ${report.html}"/>
</exec>
</target>
<target name="report.unix" if="isUnixNotMac">
<exec executable="sh" osfamily="unix">
<arg value="-c"/>
<arg value="xdg-open ${report.html}"/>
</exec>
</target>
<!--
=====
ADMIN
=====
-->
<target name="dist" depends="compile" description="Create the *.jar file">
<jar destfile="${basedir}/${app.name}.jar">
<fileset dir="${build.classes}"/>
</jar>
</target>
<!-- target name="all" depends="dist, api_doc" -->
<target name="all" depends="clean,dist">
<tstamp>
<format property="TODAY_US" pattern="yyyy-MM-dd HH:mm:ss:sss zzz" locale="en,US"/>
</tstamp>
<echo>the system date/time is ${TODAY_US}</echo>
</target>
<target name="clean" description="Delete old build, lib, dist aritifacts">
<!-- avoid problems with package name changes by deleting everything -->
<delete includeemptydirs="true" failonerror="false">
<fileset dir="${build.home}"/>
</delete>
<delete includeemptydirs="true" failonerror="false"> <!-- keep local ivy lib up to date -->
<fileset dir="${basedir}/lib"> <!-- keep ./lib -->
<include name="*.jar"/>
</fileset>
</delete>
<delete file="${app.name}.jar"/>
</target>
</project>