-
Notifications
You must be signed in to change notification settings - Fork 4
/
build-test.xml
193 lines (163 loc) · 6.59 KB
/
build-test.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
188
189
190
191
192
193
<project name="Atoum PhpStorm Plugin" default="test" basedir=".">
<property file="build.properties" />
<!-- set global properties for this build -->
<property name="build.compiler" value="modern"/>
<property name="src" location="${basedir}/src"/>
<property name="test.src" location="${basedir}/tests"/>
<property name="build" location="build"/>
<property name="test.build" location="build_test"/>
<property name="resources" value="${basedir}/resources"/>
<property name="idea.build" location="${basedir}/idea/" />
<property name="plugins" location="${basedir}/plugins"/>
<property name="deploy" location="${basedir}/deploy"/>
<path id="idea.classpath">
<fileset dir="${idea.build}/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${plugins}">
<include name="*.jar"/>
</fileset>
<fileset dir="${plugins}/php/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${idea.build}/plugins/properties/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${idea.build}/plugins/java-i18n/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${idea.build}/plugins/CSS/lib">
<include name="*.jar"/>
</fileset>
</path>
<path id="classpath">
<pathelement location="${build}"/>
<path refid="idea.classpath"/>
</path>
<path id="classpath.test">
<pathelement location="${build}"/>
<pathelement location="${test.build}"/>
<fileset dir="${idea.build}/lib">
<include name="**/*.jar" />
<exclude name="ant/lib/**/*.jar" />
</fileset>
<fileset dir="${plugins}">
<include name="*.jar"/>
</fileset>
<fileset dir="${plugins}/php/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${idea.build}/plugins/properties/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${idea.build}/plugins/java-i18n/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${idea.build}/plugins/CSS/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${java.home}/../lib">
<include name="**/*.jar" />
</fileset>
</path>
<taskdef name="javac2" classname="com.intellij.ant.Javac2">
<classpath>
<pathelement location="${idea.build}/lib/javac2.jar"/>
<path refid="idea.classpath"/>
</classpath>
</taskdef>
<macrodef name="copy_resources">
<attribute name="dest"/>
<attribute name="src"/>
<sequential>
<echo message="Copying resources"/>
<patternset id="resources">
<include name="**/*.php"/>
<include name="**/*.png"/>
<include name="**/*.xml"/>
<include name="**/*.yml"/>
<include name="**/*.xlf"/>
<include name="**/*.json"/>
</patternset>
<copy toDir="@{dest}">
<fileset dir="@{src}">
<patternset refid="resources"/>
</fileset>
</copy>
</sequential>
</macrodef>
<macrodef name="make_plugin">
<attribute name="dest"/>
<sequential>
<copy toDir="@{dest}/classes">
<fileset dir="${src}"/>
</copy>
<copy toDir="@{dest}/META-INF">
<fileset dir="${basedir}/META-INF"/>
</copy>
</sequential>
</macrodef>
<target name="init">
<tstamp/>
<mkdir dir="${build}"/>
<mkdir dir="${test.build}"/>
<mkdir dir="${plugins}/atoum-plugin"/>
<echo message="Using IDEA build from: ${idea.build}"/>
<echo message="Using JAVA_HOME: ${java.home}"/>
</target>
<target name="compile" depends="init" description="Compile the source code">
<sequential>
<pathconvert property="classpathProp" refid="classpath"/>
<javac2 destdir="${build}" classpathref="classpath" verbose="false" debug="true" source="1.8" target="1.8" includeantruntime="false">
<src path="${src}"/>
</javac2>
<copy_resources dest="${build}" src="${src}"/>
<make_plugin dest="${plugins}/atoum-plugin"/>
</sequential>
</target>
<target name="compile_test" depends="compile" description="Compile tests">
<sequential>
<pathconvert property="classpathProp" refid="classpath"/>
<javac2 destdir="${test.build}" classpathref="classpath" verbose="false" debug="true" source="1.8" target="1.8" includeantruntime="false">
<src path="${src}"/>
<src path="${test.src}"/>
</javac2>
<copy_resources dest="${test.build}" src="${src}"/>
<copy_resources dest="${test.build}" src="${test.src}"/>
</sequential>
</target>
<target name="test" depends="compile_test" description="Run the tests">
<echo message="Running tests"/>
<property name="suspend" value="n"/>
<junit printsummary="yes"
haltonfailure="false"
failureProperty="failure_found"
fork="yes" forkmode="once" reloading="no" showoutput="yes">
<jvmarg value="-Didea.home.path=${idea.build}"/>
<jvmarg value="-Xbootclasspath/a:${idea.build}/lib/boot.jar"/>
<jvmarg value="-Dfile.encoding=UTF-8"/>
<jvmarg value="-Didea.load.plugins.id=com.jetbrains.php,org.atoum.intellij.plugin.atoum"/>
<jvmarg value="-ea"/>
<jvmarg value="-Didea.plugins.path=${plugins}"/>
<jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=${suspend},address=43251"/>
<jvmarg value="-Didea.launcher.bin.path=${idea.build}/bin"/>
<classpath refid="classpath.test"/>
<formatter type="brief" usefile="false"/>
<batchtest>
<fileset dir="${test.src}">
<include name="**/*Test.java"/>
<exclude name="**/*TestCase.java"/>
</fileset>
</batchtest>
</junit>
<antcall target="check_test"/>
</target>
<target name="check_test" if="failure_found">
<fail message="Failures found"/>
</target>
<target name="clean" description="clean up">
<delete dir="${build}" />
<delete dir="${test.build}" />
<delete dir="${plugins}/atoum-plugin" />
</target>
</project>