blob: 7af697bf0b9dabcdba29a908c71b639855ac3f8f (
plain)
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
|
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:ivy="antlib:org.apache.ivy.ant"
name="AntIvyJUnit"
basedir="."
default="test">
<target name="configure">
<property file="${basedir}/src/main/resources/Application.properties"/>
<property name="build.dir" value="${basedir}/build"/>
<property name="dist.dir" value="${basedir}/dist"/>
<property name="doc.dir" value="${basedir}/doc"/>
<property name="main.dir" value="${basedir}/src/main" />
<property name="test.dir" value="${basedir}/src/test" />
<property name="src.dir" value="${main.dir}/java" />
<property name="resources.dir" value="${main.dir}/resources"/>
<property name="classes.dir" value="${build.dir}/classes"/>
<property name="class.main" value="ch.asynk.Main"/>
<property name="jar.name" value="${dist.dir}/myjar-${app.version}"/>
<property name="compile.debug" value="true"/>
<property name="compile.deprecation" value="false"/>
<property name="compile.optimize" value="true"/>
<property name="signatures.remove" value="true"/>
<path id="cp.build">
<dirset dir="${classes.dir}" />
</path>
<path id="cp.resources">
<dirset dir="${resources.dir}" />
</path>
<condition property="filter.sign.out">
<istrue value="${signatures.remove}"/>
</condition>
</target>
<target name="resolve" description="retrieve dependencies with Ivy">
<ivy:resolve file="ivy.xml" log="download-only"/>
<ivy:cachepath pathid="ivy.deps.compile" conf="compile" />
<ivy:cachepath pathid="ivy.deps.runtime" conf="runtime" />
<ivy:cachepath pathid="ivy.deps.test" conf="test" />
<ivy:cachefileset setid="ivy.deps.runtime.fileset" conf="runtime"/>
</target>
<target name="ivy-report" depends="configure,resolve">
<ivy:report conf="compile" organisation="ch.asynk" module="${app.name}"/>
<ivy:report conf="runtime" organisation="ch.asynk" module="${app.name}"/>
<ivy:report conf="test" organisation="ch.asynk" module="${app.name}"/>
</target>
<target name="clean" depends="configure" description="clean project">
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
<delete file="${app.logfile}" />
<delete file="build.log" />
<delete file="test.log" />
<delete file="ivy-report.css" />
<delete>
<fileset dir="${basedir}" includes="ch.asynk-${app.name}-*"/>
</delete>
</target>
<target name="ctags" depends="configure">
<exec executable="ctags" failonerror="false">
<arg value="-R"/>
<arg value="--language-force=java"/>
<arg value="-f.tags"/>
<arg value="${src.dir}"/>
</exec>
</target>
<target name="compile" depends="configure,resolve,ctags">
<record name="build.log" loglevel="verbose" action="start" />
<mkdir dir="${classes.dir}/main" />
<javac srcdir="${src.dir}"
destdir="${classes.dir}/main"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}"
includeantruntime="false">
<classpath refid="ivy.deps.compile"/>
<compilerarg value="-Xlint:all"/>
<compilerarg value="-Xlint:-path"/>
<compilerarg value="-Xlint:-processing"/>
<compilerarg value="-Xmaxerrs"/>
<compilerarg value="10"/>
</javac>
<mkdir dir="${classes.dir}/test" />
<javac srcdir="${test.dir}"
destdir="${classes.dir}/test"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}"
includeantruntime="false">
<classpath refid="cp.build"/>
<classpath refid="ivy.deps.compile"/>
<compilerarg value="-Xlint:all"/>
<compilerarg value="-Xlint:-path"/>
<compilerarg value="-Xlint:-processing"/>
<compilerarg value="-Xmaxerrs"/>
<compilerarg value="10"/>
</javac>
</target>
<target name="test" description="run JUnit tests" depends="compile">
<junit fork="true" dir="${basedir}" failureProperty="test.failed" printsummary="yes" haltonfailure="no">
<jvmarg value="-Xmx600M"/>
<classpath refid="cp.build"/>
<classpath refid="ivy.deps.test"/>
<formatter type="plain" usefile="true" extension=".log"/>
<test name = "ch.asynk.TestSuite" todir="." outfile="test"/>
</junit>
<fail message="-- FAILED --" if="test.failed" />
</target>
<target name="-jar.deps" if="filter.sign.out">
<jar jarfile="${jar.name}-deps.jar">
<zipgroupfileset refid="ivy.deps.runtime.fileset"/>
</jar>
</target>
<target name="-jar.static" depends="compile">
<manifestclasspath property="cp.manifest" jarfile="${jar.name}-static-cp.jar" maxParentLevels="10">
<classpath refid="ivy.deps.runtime"/>
</manifestclasspath>
<jar jarfile="${jar.name}-static-cp.jar" basedir="${classes.dir}/main">
<manifest>
<attribute name="Main-Class" value="${class.main}"/>
<attribute name="Class-Path" value="${cp.manifest}"/>
</manifest>
<fileset dir="${resources.dir}"/>
</jar>
</target>
<target name="-jar.fat" depends="compile,-jar.deps">
<jar jarfile="${jar.name}-fat.jar" basedir="${classes.dir}/main">
<manifest>
<attribute name="Main-Class" value="${class.main}"/>
<attribute name="Class-Path" value="."/>
</manifest>
<fileset dir="${resources.dir}"/>
<!-- FIXES Invalid signature file digest for Manifest main attributes -->
<!-- TODO use filter.sign.out -->
<zipfileset src="${jar.name}-deps.jar" excludes="META-INF/*.SF" />
<!-- <zipgroupfileset refid="ivy.deps.runtime.fileset"/> -->
</jar>
<!-- FIXES Invalid signature file digest for Manifest main attributes -->
<!-- <exec executable="zip"> -->
<!-- <arg value="-d"/> -->
<!-- <arg value="${jar.name}-fat.jar"/> -->
<!-- <arg value="META-INF/*.SF"/> -->
<!-- </exec> -->
</target>
<target name="-jar.src" depends="compile">
<jar jarfile="${jar.name}-src.jar" basedir="${basedir}" excludes="build/** dist/** *.log .tags" />
</target>
<target name="-jar.dir" depends="configure">
<mkdir dir="${dist.dir}" />
</target>
<target name="dist" description="generate the distribution" depends="-jar.dir,-jar.static,-jar.fat,-jar.src"/>
<target name="run" description="execute built main Class" depends="compile">
<java classname="${class.main}" fork="true">
<classpath refid="cp.build"/>
<classpath refid="cp.resources"/>
<classpath refid="ivy.deps.runtime"/>
</java>
</target>
<target name="run.jar" description="execute built jars" depends="dist">
<java jar="${jar.name}-static-cp.jar" fork="true"/>
<java jar="${jar.name}-fat.jar" fork="true"/>
</target>
</project>
|