forked from FutureGateway/APIServerDaemon
/
build.xml
171 lines (153 loc) · 6.91 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
<project name="APIServer Daemon"
default="help"
basedir="."
xmlns:ivy="antlib:org.apache.ivy.ant">
<!-- Define the properties used by the build -->
<property environment="env"/>
<property name="app.name" value="APIServerDaemon"/>
<property name="app.libs" value="${basedir}/web/WEB-INF/lib"/>
<property name="app.baselibs" value="${basedir}/lib"/>
<property name="work.home" value="${basedir}/work"/>
<property name="dist.home" value="${basedir}/dist"/>
<property name="src.home" value="${basedir}/src"/>
<property name="web.home" value="${basedir}/web"/>
<property name="test.home" value="${basedir}/src/java/test"/>
<property name="deb.home" value="${basedir}/package/ubuntu"/>
<target name="help">
<echo>You can use the following targets:</echo>
<echo> </echo>
<echo> help : (default) Prints this message </echo>
<echo> all : Cleans, compiles, and packages application</echo>
<echo> clean : Deletes work directories</echo>
<echo> compile : Compiles servlets into class files</echo>
<echo> dist : Packages artifacts into a deployable WAR</echo>
<echo> deb : Create Ubuntu package. It works only on Ubuntu platform</echo>
<echo></echo>
<echo>For example, to clean, compile, and package all at once, run:</echo>
<echo>prompt> ant all </echo>
</target>
<!-- Define the CLASSPATH -->
<path id="compile.classpath">
<fileset dir="${app.baselibs}">
<include name="*.jar"/>
</fileset>
<fileset dir="${app.libs}">
<include name="*.jar"/>
</fileset>
</path>
<target name="all" depends="clean, resolve, check, compile, dist"
description="Clean work dirs, then compile and create a WAR"/>
<target name="clean"
description="Delete old work and dist directories">
<delete dir="${work.home}"/>
<delete dir="${dist.home}"/>
<delete dir="${test.home}/classes"/>
</target>
<target name="check" depends="resolve"
description="Codestyle check with checkstyle">
<get src="https://github.com/csgf/grid-and-cloud-engine/releases/download/1.5.12-fg/grid-and-cloud-engine-threadpool-1.5.12-fg.jar"
dest="lib"
/>
<get src="https://github.com/csgf/grid-and-cloud-engine/releases/download/1.5.12-fg/grid-and-cloud-engine_M-1.5.12-fg.jar"
dest="lib"
/>
<taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties">
<classpath refid="compile.classpath"/>
</taskdef>
<checkstyle config="${basedir}/sun_checks.xml"
failOnViolation="true">
<fileset dir="${basedir}/src/java/it/infn/ct" includes="**/*.java"/>
<formatter type="xml" tofile="checkstyle-report.xml"/>
</checkstyle>
</target>
<target name="prepare" depends="clean"
description="Create working dirs and copy static files to work dir">
<mkdir dir="${dist.home}"/>
<mkdir dir="${work.home}/WEB-INF/classes"/>
<mkdir dir="${app.baselibs}"/>
<mkdir dir="${app.libs}"/>
<mkdir dir="${test.home}/classes"/>
<mkdir dir="${work.home}"/>
<!-- Copy static HTML and JSP files to work dir -->
<copy todir="${work.home}">
<fileset dir="${web.home}"/>
</copy>
</target>
<target name="compile" depends="prepare"
description="Compile Java sources and copy to WEB-INF/classes dir">
<javac srcdir="${src.home}"
destdir="${work.home}/WEB-INF/classes"
includeantruntime="false"
debug="on">
<classpath refid="compile.classpath"/>
</javac>
<copy todir="${work.home}/WEB-INF/classes">
<fileset dir="${src.home}" excludes="**/*.java"/>
</copy>
</target>
<target name="deb" depends="check, compile">
<mkdir dir="${deb.home}/var/lib/tomcat7/webapps/APIServerDaemon"/>
<copy todir="${deb.home}/var/lib/tomcat7/webapps/APIServerDaemon">
<fileset dir="${work.home}" />
</copy>
<copy todir="${deb.home}/var/lib/tomcat7/webapps/APIServerDaemon/WEB-INF/lib">
<fileset dir="${app.baselibs}">
<exclude name="javax.servlet*.java"/>
</fileset>
</copy>
<exec executable="dpkg-deb" failonerror="true">
<arg value="--build"/>
<arg value="${deb.home}"/>
<arg value="${dist.home}"/>
</exec>
</target>
<target name="dist" depends="compile"
description="Create WAR file for binary distribution">
<copy todir="${work.home}/WEB-INF/lib/">
<fileset dir="${app.baselibs}"/>
</copy>
<jar jarfile="${dist.home}/${app.name}.war"
basedir="${work.home}"/>
</target>
<!-- ivy -->
<target name="resolve" description="retrieve dependencies with ivy" depends="init-ivy">
<ivy:settings file="ivysettings.xml" />
<ivy:retrieve />
</target>
<property name="ivy.install.version" value="2.1.0-rc2" />
<!-- You may place ivy.jar into other folder if you want to keep folder lib clean-->
<property name="ivy.jar.dir" value="lib" />
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
<target name="download-ivy" unless="offline">
<mkdir dir="${ivy.jar.dir}"/>
<!-- download Ivy from web site so that it can be used even without any special installation -->
<get src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.jar.file}" usetimestamp="true"/>
</target>
<target name="init-ivy" depends="download-ivy">
<!-- try to load ivy here from ivy home, in case the user has not already dropped
it into ant's lib dir (note that the latter copy will always take precedence).
We will not fail as long as local lib dir exists (it may be empty) and
ivy is in at least one of ant's lib dir or the local lib dir. -->
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
</target>
<target name="test" depends="dist">
<copy file="${work.home}/WEB-INF/classes/it/infn/ct/ToscaIDC.properties" tofile="${work.home}/WEB-INF/classes/ToscaIDC.properties"/>
<copy file="${src.home}/java/test/log4j.properties" tofile="${work.home}/WEB-INF/classes/log4j.properties"/>
<junit printsummary="on" haltonfailure="yes" fork="true">
<sysproperty key="log4j.configuration" value="file:${work.home}/WEB-INF/classes/log4j.properties"/>
<classpath>
<path refid="compile.classpath"/>
<pathelement location="${work.home}/WEB-INF/classes"/>
</classpath>
<formatter type="brief" usefile="false" />
<batchtest>
<fileset dir="${test.home}" includes="**/*Test.java" />
</batchtest>
</junit>
</target>
</project>