-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
192 lines (161 loc) · 8.26 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
<?xml version="1.0" encoding="UTF-8" ?>
<project name="icefaces_pocs" default="dist" xmlns:ivy="antlib:org.apache.ivy.ant">
<description>
ICEfaces PoC container
</description>
<!-- Properties needed for this to work -->
<property name="dist.dir" value="build" />
<property name="war.dir" value="${dist.dir}/exploded" />
<property name="classes.dir" value="${dist.dir}/classes" />
<property name="test.classes.dir" value="${dist.dir}/test/classes" />
<property name="lib.dir" value="${war.dir}/WEB-INF/lib" />
<property name="src.dir" value="src/main" />
<property name="test.src.dir" value="src/test" />
<property name="web.dir" value="src/main/webapp" />
<property name="resource.dir" value="src/main/resources" />
<!-- SETUP TASKS -->
<target name="-ask-deploy-env" unless="build-type">
<input addproperty="build-type" message="Are you deploying to JBoss or a servlet container?" validargs="jboss,servlet"
defaultvalue="jboss" />
</target>
<target name="-init" depends="-ask-deploy-env">
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpath="./build-lib/ivy-2.0.0.jar" />
<mkdir dir="${dist.dir}" />
<mkdir dir="${war.dir}" />
<mkdir dir="${classes.dir}" />
<mkdir dir="${lib.dir}" />
<condition property="build-jboss">
<equals arg1="${build-type}" arg2="jboss" trim="true" />
</condition>
</target>
<target name="-resolve-servlet" depends="-init" unless="build-jboss">
<echo message="Resolving for servlet configuration" level="debug" />
<ivy:settings file="ivysettings.xml" />
<ivy:resolve file="ivy.xml" conf="compile" log="quiet" />
<ivy:cachepath pathid="compile.classpath" conf="compile" log="download-only" />
<ivy:cachepath pathid="test.classpath" conf="test" log="download-only" />
<ivy:cachefileset setid="runtime.fileset" conf="servlet" log="download-only" />
</target>
<target name="-resolve-jboss" depends="-init" if="build-jboss">
<echo message="Resolving for JBoss configuration" level="debug" />
<ivy:settings file="ivysettings.xml" />
<ivy:resolve file="ivy.xml" conf="compile" log="quiet" />
<ivy:cachepath pathid="compile.classpath" conf="compile" log="download-only" />
<ivy:cachepath pathid="test.classpath" conf="test" log="download-only" />
<ivy:cachefileset setid="runtime.fileset" conf="runtime" log="download-only" />
</target>
<target name="-resolve" depends="-resolve-servlet,-resolve-jboss" />
<!-- User tasks -->
<target name="compile" description="Compile the sources" depends="-init, -resolve">
<taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" classpathref="compile.classpath" />
<javac destdir="${classes.dir}" debug="true" listfiles="false">
<classpath>
<path refid="compile.classpath" />
</classpath>
<exclude name="**/package-info.java" />
<src path="${src.dir}/java" />
</javac>
<groovyc srcdir="${src.dir}/groovy" destdir="${classes.dir}">
<classpath>
<path refid="compile.classpath" />
<path location="${classes.dir}" />
</classpath>
</groovyc>
<copy todir="${classes.dir}">
<fileset dir="${src.dir}/java">
<exclude name="**/*.java" />
</fileset>
<fileset dir="${src.dir}/groovy">
<exclude name="**/*.groovy" />
</fileset>
</copy>
</target>
<target name="test" description="Run tests" depends="compile">
<mkdir dir="${dist.dir}/test-output" />
<junit haltonfailure="true" printsummary="true" showoutput="true" dir="${dist.dir}/test-output">
<sysproperty key="groovy.test.dir" value="${test.src.dir}" />
<classpath>
<path refid="test.classpath" />
<path location="${classes.dir}" />
</classpath>
<test name="groovy.util.AllTestSuite" todir="${dist.dir}/test-output" />
<formatter type="plain" />
<formatter type="xml" />
</junit>
</target>
<target name="copy-web" description="Copy the web resources" depends="-init, copy-resources">
<copy todir="${war.dir}">
<fileset dir="${web.dir}">
<include name="**/*" />
</fileset>
</copy>
<copy todir="${war.dir}/WEB-INF/classes">
<fileset dir="${classes.dir}">
<include name="**/*" />
</fileset>
</copy>
<copy todir="${lib.dir}" failonerror="false" flatten="true">
<fileset refid="runtime.fileset" />
</copy>
</target>
<target name="copy-resources" description="Copies the resources to the target" depends="-init">
<copy todir="${classes.dir}/META-INF">
<fileset dir="${resource.dir}/META-INF" />
</copy>
</target>
<target name="dist" description="Create a distributable archive" depends="compile, copy-web">
<echo message="build-jboss: ${build-jboss}" level="debug" />
<zip destfile="${dist.dir}/icefaces.war" basedir="${war.dir}" />
</target>
<target name="run-jetty" description="Builds and starts the appilcation using jetty">
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpath="./build-lib/ivy-2.0.0.jar" />
<antcall target="compile">
<param name="build-type" value="servlet" />
</antcall>
<antcall target="copy-resources">
<param name="build-type" value="servlet" />
</antcall>
<ivy:settings file="ivysettings.xml" />
<ivy:resolve file="ivy.xml" conf="jetty,servlet" log="quiet" />
<ivy:cachefileset setid="runtime.fileset" conf="servlet" log="download-only" />
<ivy:cachepath pathid="jetty.classpath" conf="jetty" log="download-only" />
<taskdef classpathref="jetty.classpath" resource="tasks.properties" loaderref="jetty.loader" />
<jetty tempDirectory="${dist.dir}/jetty-temp">
<webapp name="icefaces" contextpath="/icefaces" scanintervalseconds="5" warfile="${web.dir}">
<lib refid="runtime.fileset" />
<classes dir="${classes.dir}" includes="**/*" />
</webapp>
</jetty>
</target>
<target name="debug-jetty" description="Builds and starts the appilcation in debug mode using jetty">
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpath="./build-lib/ivy-2.0.0.jar" />
<antcall target="compile">
<param name="build-type" value="servlet" />
</antcall>
<ivy:settings file="ivysettings.xml" />
<ivy:resolve file="ivy.xml" conf="jetty,servlet" log="quiet" />
<ivy:cachefileset setid="runtime.fileset" conf="servlet" log="download-only" />
<ivy:cachepath pathid="jetty.classpath" conf="jetty" log="download-only" />
<taskdef classpathref="jetty.classpath" resource="tasks.properties" loaderref="jetty.loader" />
<jetty tempDirectory="${dist.dir}/jetty-temp">
<webapp name="icefaces" contextpath="/icefaces" scanintervalseconds="5" warfile="${web.dir}">
<lib refid="runtime.fileset" />
<classes dir="${classes.dir}" includes="**/*" />
</webapp>
<systemProperties>
<systemProperty name="STOP.PORT" value="8079"/>
<systemProperty name="STOP.KEY" value="secret"/>
<systemProperty name="debug" value=""/>
<systemProperty name="runjdwp:transport" value="dt_socket,address=8000,server=y,suspend=y"/>
</systemProperties>
</jetty>
</target>
<target name="dependency-report" description="Show and create the Ivy dependency report">
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpath="./build-lib/ivy-2.0.0.jar" />
<ivy:resolve file="ivy.xml" conf="*" />
<ivy:report todir="${dist.dir}/dependency-report" conf="*" />
</target>
<target name="clean">
<delete dir="${dist.dir}" />
</target>
</project>