forked from jaeksoft/opensearchserver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
186 lines (156 loc) · 5.74 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
<?xml version="1.0" encoding="UTF-8"?>
<!--
License Agreement for OpenSearchServer
Copyright (C) 2008-2015 Emmanuel Keller / Jaeksoft
http://www.open-search-server.com
This file is part of OpenSearchServer.
OpenSearchServer is free software: you can redistribute it and/or
modify it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenSearchServer is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenSearchServer.
If not, see <http://www.gnu.org/licenses/>.
-->
<project name="OpenSearchServer" default="dist" basedir=".">
<property environment="env" />
<property name="dist" location="dist" />
<property name="licenses" location="licenses" />
<property name="shelldir" location="shell" />
<property name="product" value="opensearchserver" />
<property name="oss_testing_instance" value="http://localhost:9090" />
<property name="temp" location="temp" />
<!-- Read the short hash from GIT -->
<exec executable="git" outputproperty="git.revision">
<arg value="rev-list" />
<arg value="--abbrev-commit" />
<arg value="--no-merges" />
<arg value="-n" />
<arg value="1" />
<arg value="HEAD" />
</exec>
<!-- Read the manifest from the WAR -->
<loadproperties>
<zipentry name="META-INF/MANIFEST.MF">
<first>
<fileset dir="target" includes="**/opensearchserver-*.war" />
</first>
</zipentry>
</loadproperties>
<property name="productsrc" value="${product}-${Implementation-Version}" />
<property name="productsrcrpm" value="${product}-${Specification-Version}-1" />
<property name="productdest" value="${product}-${Implementation-Version}-${git.revision}" />
<!-- Start OpenSearchServer using the embedded Tomcat -->
<target name="start" description="Starts OpenSearchServer">
<mkdir dir="${temp}" />
<mkdir dir="${temp}/data" />
<java fork="true" jar="target/${productsrc}-war-exec.jar" dir="${temp}" spawn="true">
<env key="OPENSEARCHSERVER_DATA" value="${temp}/data" />
<arg line="-httpPort 9090 -uriEncoding UTF-8" />
</java>
<waitfor maxwait="120" maxwaitunit="second" checkevery="2" checkeveryunit="second">
<http url="${oss_testing_instance}" />
</waitfor>
</target>
<!-- Stop any running OpenSearchServer -->
<target name="stop" description="Stop any running embedded Tomcat">
<exec executable="${env.JAVA_HOME}/bin/jps" output="${temp}/jps.out" />
<loadfile srcfile="${temp}/jps.out" property="oss_pid">
<filterchain>
<linecontainsregexp>
<regexp pattern="[0-9]+ ${productsrc}-war-exec.jar" />
</linecontainsregexp>
<replaceregex pattern="([0-9]+) ${productsrc}-war-exec.jar" replace="\1" />
<prefixlines prefix=" " />
<striplinebreaks />
<trim />
</filterchain>
</loadfile>
<fail message="No PID found">
<condition>
<not>
<isset property="oss_pid" />
</not>
</condition>
</fail>
<exec executable="kill">
<arg line="${oss_pid}" />
</exec>
</target>
<target name="dist">
<mkdir dir="${dist}/${product}" />
<mkdir dir="${dist}/${product}/data" />
<mkdir dir="${dist}/${product}/logs" />
<mkdir dir="${dist}/${product}/lib" />
<copy tofile="${dist}/${product}/${product}.jar">
<fileset file="target/${productsrc}-war-exec.jar" />
</copy>
<copy tofile="${dist}/${productdest}.deb">
<fileset file="target/${productsrc}.deb" />
</copy>
<copy tofile="${dist}/${productdest}.rpm">
<fileset file="target/rpm/opensearchserver/RPMS/noarch/${productsrcrpm}.noarch.rpm" />
</copy>
<copy tofile="${dist}/${productdest}.war">
<fileset file="target/${productsrc}.war" />
</copy>
<copy todir="${dist}/${product}">
<fileset file="LICENSE.txt" />
<fileset file="NOTICE.txt" />
<fileset file="README.md" />
<fileset file="CHANGELOG.txt" />
<fileset dir="${shelldir}" />
</copy>
<!-- Check executable file flag for batches -->
<chmod perm="ugo+x" type="file">
<fileset dir="${dist}/${product}">
<include name="**/*.sh" />
<include name="**/*.bat" />
</fileset>
</chmod>
<!-- Create the tar.gz archive -->
<tar longfile="gnu" compression="gzip" destfile="${dist}/${productdest}.tar.gz">
<tarfileset dir="${dist}/${product}" mode="755" prefix="${product}">
<include name="**/*.sh" />
<include name="**/*.bat" />
</tarfileset>
<tarfileset dir="${dist}/${product}" prefix="${product}">
<include name="**" />
<exclude name="**/*.sh" />
<exclude name="**/*.bat" />
</tarfileset>
</tar>
<!-- Create the zip archive -->
<zip encoding="windows-1250" destfile="${dist}/${productdest}.zip">
<zipfileset dir="${dist}/${product}" filemode="755" prefix="${product}">
<include name="**/*.sh" />
<include name="**/*.bat" />
</zipfileset>
<zipfileset dir="${dist}/${product}" prefix="${product}">
<include name="**" />
<exclude name="**/*.sh" />
<exclude name="**/*.bat" />
</zipfileset>
</zip>
<!-- Copy Txt Files -->
<copy todir="${dist}">
<fileset file="README.md" />
<fileset file="CHANGELOG.txt" />
</copy>
<!-- Clean the temporary product directory -->
<delete dir="${dist}/${product}" />
</target>
<!-- The tarball -->
<target name="dist-src">
<mkdir dir="${dist}" />
<tar compression="gzip" destfile="${dist}/${productdest}.src.tar.gz" longfile="gnu" basedir="." excludes="temp/**, dist/**, ant-build/**, build/**, target/**, .git/**" />
</target>
<target name="clean" description="clean up">
<delete dir="${temp}" />
<delete dir="${dist}" />
</target>
</project>