forked from gashli/junit-generator-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
116 lines (99 loc) · 4.43 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
<project name="junitgen" basedir="." default="all">
<target name="init" description="initializes all the variables for the build">
<property file="build.properties"/>
<fail unless="idea.home" message="idea.home property is missing. Add via -Didea.home="/>
<fail unless="Version"
message="Version property is missing, see build.properties or set the JDK property if running inside intellij"/>
<property name="source.dir" value="./src"/>
<property name="resources.dir" value="./resources"/>
<property name="target.dir" value="./target"/>
<property name="jar.file.name" value="junitgen.jar"/>
<property name="dist.file" location="junitgen-${Version}"/>
<property name="dist.dir" value="./dist"/>
<property name="test.dir" value="./test"/>
<property name="idea.lib" value="${idea.home}/lib"/>
<filterset id="dirs.filterset">
<filter token="Version" value="${Version}"/>
</filterset>
<path id="class.path">
<pathelement path="${idea.lib}/openapi.jar"/>
<pathelement path="${idea.lib}/extensions.jar"/>
<pathelement path="${idea.lib}/util.jar"/>
<pathelement path="${idea.lib}/annotations.jar"/>
<pathelement path="${idea.lib}/idea.jar"/>
<pathelement path="${idea.lib}/velocity.jar"/>
</path>
<path id="test.class.path">
<path refid="class.path"/>
<pathelement path="${target.dir}/classes"/>
<pathelement path="${target.dir}/testclasses"/>
<pathelement path="${idea.lib}/junit-4.10.jar"/>
<pathelement path="${idea.lib}/trove4j.jar"/>
</path>
</target>
<target name="all" depends="clean, compile, deploy, test"
description="executes all the targets in the build file"/>
<target name="compile" depends="init" description="compiles the source">
<mkdir dir="${target.dir}/classes"/>
<javac
srcdir="${source.dir}"
destdir="${target.dir}/classes"
deprecation="true"
debug="false"
includeantruntime="false"
source="5"
target="5">
<include name="**/*.java"/>
<classpath refid="class.path"/>
</javac>
</target>
<target name="deploy" depends="test"
description="creates all the needed distribution files and packages them into zip file.">
<!-- the sources -->
<zip file="${dist.file}-src.zip">
<fileset dir="${source.dir}"/>
<fileset dir="${resources.dir}"/>
<fileset dir="${test.dir}"/>
<fileset dir="${basedir}" includes="META-INF/plugin.xml,build.xml,build.properties"/>
</zip>
<!-- the binary -->
<mkdir dir="${dist.dir}"/>
<mkdir dir="${dist.dir}/META-INF"/>
<!-- copy everything we need into the directory -->
<copy todir="${dist.dir}">
<fileset dir="${basedir}" includes="META-INF/plugin.xml"/>
<fileset dir="${resources.dir}"/>
<fileset dir="${target.dir}/classes"/>
<filterset refid="dirs.filterset"/>
</copy>
<jar
jarfile="${dist.file}.jar"
basedir="${dist.dir}"
includes="**"/>
</target>
<target name="compile-test" depends="compile">
<mkdir dir="${target.dir}/testclasses"/>
<javac srcdir="${test.dir}"
destdir="${target.dir}/testclasses"
includeantruntime="false">
<classpath refid="test.class.path"/>
</javac>
</target>
<target name="test" depends="compile-test"
description="Execute the JUnit tests">
<mkdir dir="${target.dir}/test-results"/>
<junit printsummary="true" fork="false" haltonfailure="yes">
<formatter type="plain" usefile="false"/>
<classpath refid="test.class.path"/>
<batchtest todir="${target.dir}/test-results">
<fileset dir="${target.dir}/testclasses" includes="**/*Test*.class"/>
</batchtest>
</junit>
</target>
<target name="clean" depends="init">
<delete dir="${dist.dir}" includeemptydirs="yes"/>
<delete dir="${target.dir}" includeemptydirs="yes"/>
<delete file="${dist.file}.jar"/>
<delete file="${dist.file}-src.zip"/>
</target>
</project>