-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
217 lines (193 loc) · 7.35 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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="mint" default="dist" basedir=".">
<description>
Mint build file
</description>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" />
<!-- set global properties for this build -->
<property name="src" location="WEB-INF/src/java"/>
<property name="custom-src" location="WEB-INF/custom/${custom}/java"/>
<property name="build" location="WEB-INF/classes"/>
<property name="lib" location="WEB-INF/lib"/>
<property name="dist" location="work/dist"/>
<property environment="env"/>
<property name="tomcat.home" location="${env.TOMCAT_HOME}" />
<property name="ivy.settings.file" location="ivysettings.xml" />
<path id="srcpath" >
<dirset dir="${src}" />
<dirset dir="WEB-INF/custom">
<include name="${custom}/java" if="custom" />
</dirset>
</path>
<property name="allSrc" refid="srcpath"/>
<target name="init" depends="resolve" >
<fail unless="appname" message="Please call ant with -Dappname=something. This is used as subdir in dist and for tomcat deploy." />
<echo message="Use -Dcustom=.. for code and view customizations" />
<echo message="Use -Ddeploy_target=.. for deploy target dir (with deploy.xml and local.properties)" />
<echo message="Use -Ddbpass=.. to overwrite the dbpassword in hibernate.properties on deploy" />
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
</target>
<target name="resolve" description="--> retrieve dependencies with ivy">
<ivy:retrieve pattern="${lib}/[artifact]-[type]-[revision](-[classifier]).[ext]" type="jar,bundle,javadoc" />
<!-- copy unmanaged_libs into lib-->
<copy todir="${lib}">
<fileset dir="WEB-INF/unmanaged_lib" />
</copy>
<ivy:report todir="${lib}" graph="true"/>
</target>
<target name="compile" depends="init"
description="compile the source " >
<echo message="Compiling source code..." />
<!-- Compile the java code from ${src} into ${build} -->
<javac destdir="${build}"
encoding = "utf-8"
source="1.8" debug="true" debuglevel="lines,vars,source"
includeAntRuntime="no" srcdir="${allSrc}" >
<classpath>
<pathelement path="${classpath}"/>
<fileset dir="WEB-INF/lib">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${tomcat.home}/lib">
<include name="**/*.jar"/>
</fileset>
</classpath>
</javac>
<echo message="Source code compile completed!" />
<copy todir="${build}">
<fileset dir="${src}"
excludes="**/*.java" />
</copy>
<copy todir="${build}" flatten="true" >
<fileset dir="WEB-INF/custom" >
<include name="${custom}/java/*" if="custom"/>
<exclude name="**/*.java" />
</fileset>
</copy>
<echo message="Resources copied to class folder." />
</target>
<target name="instrument" depends="compile">
<echo message="Instrumenting domain..." />
<taskdef name="instrument" classname="org.hibernate.tool.instrument.javassist.InstrumentTask">
<classpath >
<fileset dir="${lib}">
<include name="**/*.jar"/>
</fileset>
</classpath>
<classpath path="${build}"/>
</taskdef>
<instrument verbose="true">
<fileset dir="${build}/gr/ntua/ivml/mint/persistent">
<include name="Mapping.class"/>
<include name="Transformation.class" />
</fileset>
</instrument>
</target>
<target name="properties" depends="init" description="Build a build.properties file" >
<tstamp>
<format property="NOW" pattern="d-MMM-yyyy HH:mm:ss" locale="en,UK"/>
</tstamp>
<echo file="build.properties" message="git-SHA1=" />
<exec executable="git" output="build.properties" append="true">
<arg value="rev-parse"/>
<arg value="--verify"/>
<arg value="HEAD"/>
</exec>
<echo file="build.properties" append="true" >appname=${appname}
deploy_target=${deploy_target}
build-time=${NOW}</echo>
</target>
<target name="dist" depends="dist_base, dist_custom" />
<target name="dist_custom" depends="dist_base" if="custom" >
<echo message="Copying custom resources..." />
<copy todir="${dist}/${appname}/custom/${custom}">
<fileset dir="custom/${custom}" />
</copy>
</target>
<target name="dist_base" depends="instrument, properties"
description="generate the distribution" >
<echo message="Generating distribution..." />
<mkdir dir="${dist}/${appname}"/>
<echo message="Copying css..." />
<copy todir="${dist}/${appname}/css">
<fileset dir="css" />
</copy>
<echo message="Copying template..." />
<copy todir="${dist}/${appname}/template" >
<fileset dir="template" />
</copy>
<echo message="Copying images..." />
<copy todir="${dist}/${appname}/images" >
<fileset dir="images" />
</copy>
<echo message="Copying js..." />
<copy todir="${dist}/${appname}/js">
<fileset dir="js" />
</copy>
<echo message="Copying schemas..." />
<copy todir="${dist}/${appname}/schemas">
<fileset dir="schemas" />
</copy>
<echo message="Copying xsl..." />
<copy todir="${dist}/${appname}/xsl">
<fileset dir="xsl" />
</copy>
<echo message="Copying scripts..." />
<copy todir="${dist}/${appname}/scripts">
<fileset dir="scripts" />
</copy>
<echo message="Copying views..." />
<copy todir="${dist}/${appname}/views">
<fileset dir="views" />
</copy>
<echo message="Copying WEB-INF..." />
<copy todir="${dist}/${appname}/WEB-INF">
<fileset dir="WEB-INF" />
</copy>
<echo message="Copying META-INF..." />
<copy todir="${dist}/${appname}/META-INF">
<fileset dir="META-INF" />
</copy>
<echo message="Copying index.html..." />
<copy tofile="${dist}/${appname}/index.html" file="index.html"/>
<copy tofile="${dist}/${appname}/build.properties" file="build.properties"/>
</target>
<target name="clean"
description="clean up" >
<delete failonerror="false">
<fileset dir="${lib}" includes="*/**" erroronmissingdir="false" />
<fileset dir="${build}" includes="*/**" erroronmissingdir="false"/>
<fileset dir="${dist}" includes="*/**" erroronmissingdir="false"/>
</delete>
</target>
<import file="WEB-INF/deploy/${deploy_target}/deploy.xml" optional="true" />
<target name="modify" depends="dist" >
<antcall target="modify-specific"/>
</target>
<target name="deploy" depends="modify, dist" if="deploy_target">
<antcall target="deploy-specific"/>
</target>
<target name="jar" depends="modify, dist" if="deploy_target" >
<jar destfile="${dist}/${appname}.jar">
<fileset dir="${dist}/${appname}/WEB-INF" includes="lib/" />
<fileset dir="${dist}/${appname}/WEB-INF/classes" excludes="**/*jsp" />
<fileset dir="${dist}/${appname}" includes="build.properties" />
</jar>
</target>
<target name="doc">
<javadoc destdir="docs/mint2"
sourcepath="WEB-INF/src/java"
packagenames="gr.ntua.ivml.mint.*"
windowtitle="Mint2 Javadoc"
>
<classpath>
<pathelement path="${classpath}"/>
<fileset dir="WEB-INF/lib">
<include name="**/*.jar"/>
</fileset>
</classpath>
</javadoc>
</target>
</project>