forked from go-lang-plugin-org/go-lang-idea-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-test.xml
194 lines (166 loc) · 6.99 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
194
<project name="Idea Google Go language scripted test file" 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="gen" location="${basedir}/gen"/>
<property name="jps" location="${basedir}/jps-plugin"/>
<property name="google-app-engine" location="${basedir}/google-app-engine"/>
<property name="google-app-engine-yaml" location="${google-app-engine}/google-app-engine-yaml"/>
<property name="utils" location="${basedir}/utils"/>
<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="go.plugin.name" value="com.goide" />
<property name="idea.community.build" location="${basedir}/idea-IC/" />
<path id="idea.classpath">
<fileset dir="${idea.community.build}/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${idea.community.build}/plugins/coverage/lib">
<include name="*.jar"/>
</fileset>
</path>
<path id="my.classpath">
<pathelement location="${build}"/>
</path>
<path id="classpath">
<path refid="my.classpath"/>
<path refid="idea.classpath"/>
</path>
<path id="classpath.test">
<pathelement location="${build}"/>
<pathelement location="${test.build}"/>
<fileset dir="${idea.community.build}/lib">
<include name="**/*.jar" />
<exclude name="ant/lib/**/*.jar" />
</fileset>
<fileset dir="${idea.community.build}/plugins/coverage/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.community.build}/lib/javac2.jar"/>
<pathelement location="${idea.community.build}/lib/asm-all.jar" />
</classpath>
</taskdef>
<macrodef name="copy_resources">
<attribute name="dest"/>
<sequential>
<echo message="Copying resources"/>
<patternset id="resources">
<include name="**/*.properties"/>
<include name="**/*.xml"/>
<include name="**/*.txt"/>
<include name="**/*.go"/>
</patternset>
<copy toDir="@{dest}">
<fileset dir="${resources}">
<patternset refid="resources"/>
</fileset>
<fileset dir="${src}">
<patternset refid="resources"/>
</fileset>
<fileset dir="${gen}">
<patternset refid="resources"/>
</fileset>
<fileset dir="${jps}">
<patternset refid="resources"/>
</fileset>
<fileset dir="${google-app-engine}">
<patternset refid="resources"/>
</fileset>
<fileset dir="${google-app-engine-yaml}">
<patternset refid="resources"/>
</fileset>
<fileset dir="${jps}/src">
<include name="META-INF/services/**"/>
</fileset>
<fileset dir="${test.src}">
<patternset refid="resources"/>
</fileset>
</copy>
</sequential>
</macrodef>
<macrodef name="compile">
<attribute name="dest"/>
<sequential>
<pathconvert property="classpathProp" refid="classpath"/>
<echo>Classpath is ${classpathProp}</echo>
<javac2 destdir="@{dest}" classpathref="classpath" verbose="false" debug="true" source="1.6" target="1.6" includeantruntime="false">
<src path="${src}"/>
<src path="${gen}"/>
<src path="${utils}/src"/>
<src path="${jps}/src"/>
<src path="${google-app-engine}/src"/>
<src path="${google-app-engine-yaml}/src"/>
<src path="${test.src}"/>
</javac2>
<copy_resources dest="@{dest}"/>
</sequential>
</macrodef>
<target name="init">
<tstamp/>
<mkdir dir="${build}"/>
<mkdir dir="${test.build}"/>
<echo message="Using IDEA build from: ${idea.community.build}" />
<echo message="Using JAVA_HOME: ${java.home}" />
</target>
<target name="compile" depends="clean,init" description="Compile the source code">
<taskdef name="javac2" classname="com.intellij.ant.Javac2">
<classpath>
<pathelement location="${idea.community.build}/lib/javac2.jar"/>
<pathelement location="${idea.community.build}/lib/forms_rt.jar"/>
<path refid="idea.classpath"/>
</classpath>
</taskdef>
<compile dest="${build}"/>
<copy todir="${build}">
<fileset dir="${resources}">
<include name="*/**"/>
</fileset>
<fileset dir="${google-app-engine}/resources">
<include name="*/**"/>
</fileset>
</copy>
</target>
<target name="compile_test" depends="compile" description="Compile tests">
<compile dest="${test.build}"/>
</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" showoutput="yes"
failureProperty="failure_found"
fork="yes" forkmode="once" reloading="no">
<jvmarg value="-Didea.home.path=${idea.community.build}"/>
<jvmarg value="-Xbootclasspath/a:${idea.community.build}/lib/boot.jar"/>
<jvmarg value="-Dfile.encoding=UTF-8"/>
<jvmarg value="-ea"/>
<jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=${suspend},address=43251"/>
<jvmarg value="-Didea.launcher.bin.path=${idea.community.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}" />
</target>
</project>