-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
174 lines (149 loc) · 6.82 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
<?xml version="1.0"?>
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="topica" default="">
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!-- ~~~ Build file for the TamingText project ~~~~~~~~~~~~~~~~~~~~~~ -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!-- Load properties from file, if it exists -->
<property file="build.properties" />
<property name="project.name" value="topica"/>
<property name="project.version" value="0.1-SNAPSHOT"/>
<property name="project.name-ver" value="${project.name}-${project.version}"/>
<property name="build.dir" location="build" />
<property name="dist.dir" location="${build.dir}/dist" />
<property name="assembly.dir" location="${build.dir}/assembly" />
<property name="main.src.dir" location="src/main" />
<property name="java.src.dir" location="src/main/java" />
<property name="resource.src.dir" location="src/main/resources" />
<property name="tools.src.dir" location="src/main/tools" />
<property name="main.bin.dir" location="${build.dir}/main/classes" />
<property name="test.src.dir" location="src/test/java" />
<property name="test.bin.dir" location="${build.dir}/test/classes" />
<property name="test.data.dir" location="${build.dir}/test/data" />
<property name="test.reports.dir" location="${build.dir}/test/reports" />
<property name="server.stage.address" location="hi10testapp.huygens.knaw.nl" />
<property name="server.stage.path" location="/usr/share/tomcat5/webapps" />
<property name="server.stage.user" location="gertjanf" />
<property name="server.stage.password" location="wetreF3K" />
<property name="target.jar" location="${dist.dir}/tools.jar" />
<property name="target.pom" location="${dist.dir}/${project.name-ver}.pom" />
<!-- <property name="local.tomcat.dir" location="/usr/local/bin/apache-tomcat-7.0.6/webapps" />-->
<property name="local.dir" location="${user.home}/badger" />
<property name="config.src" location="config" />
<property name="website.src" location="website" />
<property name="solr.src" location="solr" />
<tstamp>
<format property="timestamp.isoformat" pattern="yyyy-mm-dd'T'HH:mm:ss" locale="en" />
</tstamp>
<!-- ~~~ Ivy tasks ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<property name="ivy.jar.version" value="2.2.0"/>
<property name="ivy.jar.name" value="ivy-${ivy.jar.version}.jar" />
<property name="ivy.home" value="${user.home}/.ivy2" />
<available property="ivy.installed" file="${ivy.home}/${ivy.jar.name}" />
<!-- Auto-installs the ivy jar into ~/.ivy2 if not present -->
<target name="ivy-install" unless="ivy.installed">
<mkdir dir="${ivy.home}"/>
<get src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.jar.version}/${ivy.jar.name}" dest="${ivy.home}/${ivy.jar.name}"/>
</target>
<!-- Initializes ivy -->
<target name="ivy-init" depends="ivy-install,init">
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpath="${ivy.home}/${ivy.jar.name}"/>
<property name="ivy.lib.dir" location="build/ivy/lib"/>
<!-- Override if you want another repository -->
<property name="publish.repo" value="${user.home}/.m2/repository"/>
<ivy:resolve/>
</target>
<!-- Called by the user to download jars -->
<target name="ivy-retrieve" depends="ivy-init" description="downloads jars for the project">
<ivy:retrieve pattern="${ivy.lib.dir}/[conf]/[artifact]-[revision].[ext]" conf="*" type="*"/>
</target>
<target name="pom" depends="ivy-init">
<ivy:makepom ivyfile="ivy.xml" pomfile="${target.pom}">
<!--
Mapping confs to scopes is important, otherwise
unmapped confs are included as optional. If you
have private confs, the best option seems to
be marking them as provided or system. See
IVY-1201 for an ehancement request.
-->
<mapping conf="main" scope="compile"/>
<mapping conf="test" scope="provided"/>
</ivy:makepom>
</target>
<target name="ivy-report" depends="ivy-retrieve">
<ivy:report todir="${build.dir}/ivy/report" />
</target>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<target name="init">
<mkdir dir="${main.bin.dir}" />
<mkdir dir="${test.bin.dir}" />
<mkdir dir="${dist.dir}" />
</target>
<target name="clean" description="Deletes all files generated by the build.">
<delete includeEmptyDirs="true">
<fileset dir="${build.dir}"/>
</delete>
</target>
<target name="classpaths" depends="ivy-report">
<path id="main.compile.classpath">
<fileset dir="${ivy.lib.dir}/main" includes="*.jar" />
</path>
<path id="test.compile.classpath">
<fileset dir="${ivy.lib.dir}/test" includes="*.jar" excludes="*ant-*"/>
<pathelement location="${main.bin.dir}" />
</path>
<path id="test.classpath">
<path refid="test.compile.classpath" />
<pathelement location="${test.bin.dir}" />
</path>
</target>
<target name="main-compile" depends="classpaths">
<javac srcdir="${main.src.dir}" destdir="${main.bin.dir}" debug="true" includeantruntime="false">
<classpath refid="main.compile.classpath"/>
</javac>
<copy todir="${main.bin.dir}">
<fileset dir="${java.src.dir}" includes="**/*.properties" />
<fileset dir="${resource.src.dir}">
<include name="**/*.properties"/>
<include name="**/*.ftl"/>
</fileset>
</copy>
</target>
<target name="test-compile" depends="main-compile">
<javac srcdir="${test.src.dir}" destdir="${test.bin.dir}" includeantruntime="false">
<classpath refid="test.compile.classpath"/>
</javac>
</target>
<target name="unit-tests" depends="test-compile">
<mkdir dir="${test.data.dir}"/>
<mkdir dir="${test.reports.dir}"/>
<!-- Run tests in their own JVM -->
<junit fork="true" forkmode="once" printsummary="false"
errorProperty="test.failed" failureProperty="test.failed">
<classpath refid="test.classpath"/>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<batchtest todir="${test.data.dir}">
<fileset dir="${test.bin.dir}">
<include name="**/*Test.class"/>
</fileset>
</batchtest>
</junit>
<junitreport todir="${test.data.dir}">
<fileset dir="${test.data.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${test.reports.dir}"/>
</junitreport>
<fail if="test.failed">
Test failed. Check ${test.reports.dir}.
</fail>
</target>
<target name="war" depends="unit-tests">
<war destfile="${project.name}.war" webxml="src/main/webapp/WEB-INF/web.xml">
<classes dir="${main.bin.dir}" />
<lib dir="${ivy.lib.dir}/main" />
</war>
<copy file="${project.name}.war" todir="${dist.dir}" />
<delete file="${project.name}.war" />
</target>
</project>