-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.xml
198 lines (165 loc) · 8.33 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
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
195
196
197
198
<?xml version="1.0" encoding="utf-8" ?>
<!--
(c) Copyright IBM Corporation 2013, 2017.
This is licensed under the following license.
The Eclipse Public 1.0 License (http://www.eclipse.org/legal/epl-v10.html)
U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
-->
<project name="WebSphereMessageBroker-CMP" default="all" basedir="."
xmlns:codestation="antlib:com.urbancode.codestation2.client">
<property environment="env"/>
<property file=".build.properties"/>
<defaultexcludes add="**/.ahs.*"/>
<defaultexcludes add="**/*.bom"/>
<!-- AHP settings -->
<property name="ahp.branch" value="air" />
<property name="ahp.project.name" value="${ant.project.name}" />
<!-- =================================================== -->
<!-- PROJECT STRUCTURE -->
<!-- =================================================== -->
<property name="lib.dir" location="lib" />
<!-- =================================================== -->
<!-- MACROS -->
<!-- =================================================== -->
<macrodef name="emptyDir" description="Ensure that the target directory exists and is empty">
<attribute name="dir"/>
<attribute name="excludes" default=""/>
<sequential>
<mkdir dir="@{dir}"/>
<delete dir="@{dir}" includes="*/**" excludes="@{excludes}" includeemptydirs="true" defaultexcludes="false"/>
</sequential>
</macrodef>
<property name="lib.dir" location="lib"/>
<property name="dist.dir" location="dist"/>
<property name="src.dir" location="src"/>
<property name="build.dir" location="build"/>
<property name="build.classes.dir" location="${build.dir}/classes"/>
<property name="src.test.java.dir" location="${src.dir}/test/java"/>
<property name="src.test.groovy.dir" location="${src.dir}/test/groovy"/>
<property name="lib.test.dir" location="${lib.dir}/test"/>
<property name="lib.build.dir" location="${lib.dir}/build"/>
<property name="dist.test.dir" location="${dist.dir}/test"/>
<property name="build.test.dir" location="${build.dir}/test"/>
<property name="build.test.groovy.dir" location="${build.dir}/test/groovy"/>
<property name="build.test.groovy.classes.dir" location="${build.test.groovy.dir}/classes"/>
<property name="build.test.groovy.data.dir" location="${build.test.groovy.dir}/data"/>
<property name="build.test.classes.dir" location="${build.test.dir}/classes"/>
<!-- =================================================== -->
<!-- TARGETS -->
<!-- =================================================== -->
<target name="dist" depends="resolve" description="Create distribution">
<ant antfile="plugin-build.xml" target="dist" inheritall="true"/>
</target>
<target name="all" depends="resolve">
<ant antfile="plugin-build.xml" target="all" inheritall="true"/>
</target>
<target name="clean" description="Cleans build output">
<emptyDir dir="${lib.dir}" excludes="ext/**"/>
<ant antfile="plugin-build.xml" target="clean" inheritall="true"/>
</target>
<target name="resolve" unless="resolve.no" description="Resolve all dependencies">
<mkdir dir="${lib.dir}"/>
<codestation:resolve buildLife="${env.AH_BUILD_LIFE_ID}"
xmlFile="dependencies.xml"/>
</target>
<target name="publish" unless="publish.no"
description="Build artifacts and publish them to codestation">
<codestation:publish project="${ahp.project.name}"
workflow="${ahp.workflow.name}"
publishall="true"/>
</target>
<!-- =================================================== -->
<!-- TEST TARGETS -->
<!-- =================================================== -->
<path id="classpath">
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
</path>
<path id="classpath.build">
<fileset dir="${lib.build.dir}">
<include name="*.jar"/>
</fileset>
<path refid="classpath"/>
</path>
<path id="classpath.test">
<fileset dir="${lib.test.dir}">
<include name="*.jar"/>
</fileset>
<pathelement location="${build.main.classes.dir}"/>
<pathelement location="${build.test.classes.dir}"/>
<pathelement location="${lib.build.classes.dir}"/>
<path refid="classpath.build"/>
</path>
<path id="classpath.groovyc">
<path><fileset dir="${lib.dir}/plugin" includes="*.jar" erroronmissingdir="false"/></path>
<path refid="classpath.test"/>
<pathelement location="${build.dir}/tmp"/>
</path>
<path id="compile.classpath">
<fileset dir="${lib.dir}" includes="**/*.jar" />
</path>
<path id="classpath.groovyc.classes">
<path><fileset dir="${build.classes.dir}" includes="*.class" erroronmissingdir="false"/></path>
<path refid="classpath.groovyc"/>
<pathelement location="${build.dir}/classes"/>
</path>
<path id="classpath.groovyc.test">
<path refid="classpath.groovyc.classes"/>
<pathelement location="${build.test.groovy.classes.dir}"/>
</path>
<target name="taskdef" unless="taskdef.no">
<path id="taskdefpath">
<fileset dir="${lib.dir}" includes="*.jar"/>
<fileset dir="${lib.dir}/build" includes="*.jar"/>
</path>
<taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpathref="taskdefpath" />
<taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" classpathref="taskdefpath" />
<!--
<taskdef name="air_validate_plugin"
classname="com.urbancode.air.plugin.ant.ValidateTask"
classpathref="taskdefpath"/>
-->
<taskdef uri="antlib:com.urbancode.air.plugin.ant"
resource="com/urbancode/air/plugin/ant/antlib.xml"
classpathref="taskdefpath"/>
</target>
<target name="check-groovy-tests" depends="taskdef">
<available file="${src.test.groovy.dir}" property="src.test.groovy.exists"/>
</target>
<target name="compile-groovy-tests" depends="taskdef, check-groovy-tests, compile-groovy" if="${src.test.groovy.exists}">
<mkdir dir="${build.test.groovy.classes.dir}"/>
<groovyc srcdir="${src.test.groovy.dir}" destdir="${build.test.groovy.classes.dir}">
<classpath refid="classpath.groovyc.test"/>
</groovyc>
</target>
<target name="run-groovy-tests" depends="compile-groovy, compile-groovy-tests" unless="tests.no" description="Run tests" if="${src.test.groovy.exists}">
<mkdir dir="${build.test.groovy.data.dir}"/>
<mkdir dir="${build.test.groovy.classes.dir}"/>
<mkdir dir="${dist.test.dir}"/>
<junit printsummary="on" haltonfailure="no" haltonerror="no" fork="yes" showoutput="false" failureproperty="tests.failed">
<jvmarg value="-Dcom.urbancode.winapi.WinAPI.dllPath=${lib.test.dir}/native/windows/x64/WinAPI.dll"/>
<classpath refid="classpath.groovyc.test"/>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<batchtest todir="${build.test.groovy.data.dir}">
<fileset dir="${build.test.groovy.classes.dir}">
<include name="**/*Test.class"/>
</fileset>
</batchtest>
</junit>
<junitreport todir="${dist.test.dir}">
<fileset dir="${build.test.groovy.data.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${dist.test.dir}"/>
</junitreport>
<fail message="JUnit Tests Failed" if="tests.failed" />
</target>
<target name="compile-groovy" depends="taskdef" description="compile all the groovy classes from src">
<mkdir dir="${build.classes.dir}"/>
<groovyc srcdir="${src.dir}" destdir="${build.classes.dir}" classpathref="compile.classpath">
<javac debug="on" />
</groovyc>
</target>
</project>