forked from asinbow/junit5-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
65 lines (55 loc) · 2.4 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="junit5-jupiter-starter-ant" default="build" basedir=".">
<fail message="Ant 1.10.4+ is required!">
<condition>
<not>
<antversion atleast="1.10.4"/>
</not>
</condition>
</fail>
<path id="test.classpath">
<pathelement path="build/test"/>
<pathelement path="build/main"/>
<fileset dir="${ant.home}/lib" includes="*.jar" />
</path>
<target name="build" description="clean build" depends="clean, test" />
<target name="clean">
<delete dir="build"/>
</target>
<target name="init">
<mkdir dir="build/main"/>
<mkdir dir="build/test"/>
<mkdir dir="build/test-report"/>
</target>
<target name="compile" depends="init">
<javac destdir="build/main" srcdir="src/main/java" includeantruntime="false"/>
<javac destdir="build/test" classpathref="test.classpath" srcdir="src/test/java" includeantruntime="false"/>
</target>
<!-- https://junit.org/junit5/docs/snapshot/user-guide/#running-tests-build-ant -->
<target name="test.junit.launcher" depends="compile">
<junitlauncher haltOnFailure="true" printSummary="true">
<classpath refid="test.classpath"/>
<testclasses outputdir="build/test-report">
<fileset dir="build/test">
<include name="**/*Tests.class"/>
</fileset>
<listener type="legacy-xml" sendSysOut="true" sendSysErr="true"/>
<listener type="legacy-plain" sendSysOut="true" />
</testclasses>
</junitlauncher>
</target>
<!-- https://junit.org/junit5/docs/current/user-guide/#running-tests-console-launcher -->
<target name="test.console.launcher" depends="compile">
<java classpathref="test.classpath" classname="org.junit.platform.console.ConsoleLauncher" fork="true" failonerror="true">
<arg value="--scan-classpath"/>
<arg line="--reports-dir build/test-report"/>
</java>
<junitreport todir="build/test-report">
<fileset dir="build/test-report">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="build/test-report/html"/>
</junitreport>
</target>
<target name="test" depends="test.junit.launcher, test.console.launcher" />
</project>