-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathbuildRelease.xml
More file actions
181 lines (163 loc) · 6.68 KB
/
buildRelease.xml
File metadata and controls
181 lines (163 loc) · 6.68 KB
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
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." name="BuildRelease" default="all" xmlns:if="ant:if"
xmlns:unless="ant:unless" xmlns:res="antlib:org.apache.tools.ant.types.resources">
<!--
**********************************************************
* Ant file for building release package for the *
* staticSearch engine. A release package would include *
* all and only the files needed to use staticSearch in *
* a project, excluding
* *
* Note that you can also specify a relative path using *
* -DssConfig=../rel/cfg.xml * *
* *
**********************************************************
-->
<!--****************************************************************
* *
* Task Definitions *
* *
****************************************************************-->
<!-- We need ant contrib. -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${basedir}/lib/ant-contrib.jar"/>
</classpath>
</taskdef>
<!--****************************************************************
* *
* Properties *
* *
****************************************************************-->
<!-- We want our own base directory in case basedir is overridden
by an invoking ant process. -->
<dirname property="ssBaseDir" file="${ant.file}"/>
<!--Output folder for the package we create. -->
<property name="distOutputFolder" value="${ssBaseDir}/dist"/>
<!--The NAME of the temporary folder, which we treat as a constant-->
<property name="tempFolder" value="ssTemp"/>
<!--The temporary directory for distro files before zipping etc.-->
<property name="staticSearchTempDir" value="${ssBaseDir}/${tempFolder}"/>
<!-- The fileset we need. -->
<fileset id="requiredFiles" dir="${ssBaseDir}"
excludes="xsl/functions.xspec xsl/patch_tei_odd.xsl xsl/spiff_up_documentation.xsl xsl/split_documentation.xsl js/searchTest.* js/out js/out/**/*">
<include name="css/**/*"/>
<include name="dicts/**/*"/>
<include name="docs/staticSearch.html"/>
<include name="docs/documentation.css"/>
<include name="images/**/*"/>
<include name="js/**/*"/>
<include name="lib/**/*"/>
<exclude name="lib/ant-contrib_docs/**"/>
<exclude name="lib/saxon_docs/**"/>
<include name="schema/staticSearch.odd"/>
<include name="schema/staticSearch.rng"/>
<include name="schema/staticSearch.sch"/>
<!-- NOTE: If we move the stemmers around, this will need to change. -->
<include name="stemmers/**/*.js"/>
<include name="stemmers/**/*.xsl"/>
<exclude name="stemmers/**/ssStemmerTest.js"/>
<include name="stopwords/**/*"/>
<include name="xsl/**/*"/>
<exclude name="xsl/config.xsl"/>
<include name="build.xml"/>
<include name="EDITION"/>
<include name="license_BSD.txt"/>
<include name="gitInfo.txt"/>
</fileset>
<loadfile property="edition" srcFile="${ssBaseDir}/EDITION"/>
<target name="readEdition">
<description>
TARGET readEdition
This reads the EDITION file in the root directory
and if it's an alpha or beta, it checks with the
user to make sure they do want to create a release.
</description>
<loadfile property="edition" srcFile="${ssBaseDir}/EDITION"/>
<propertyregex
property="alphabeta"
input="${edition}"
regexp="[\d\.]+"
replace=""/>
<if>
<not>
<equals arg1="${alphabeta}" arg2=""/>
</not>
<then>
<input message="Warning: the edition is apparently a prerelease (${edition} contains ${alphabeta}). Are you sure you want to continue?"
validargs="y,n"
addproperty="continue"/>
<condition property="abort">
<equals arg1="n" arg2="${continue}"/>
</condition>
<fail if="${abort}">Build aborted.</fail>
</then>
</if>
<echo message="Edition is ${edition}"/>
</target>
<target name="getGitInfo">
<description>
TARGET getGitInfo
This generates a small text file containing the
git branch and revision information, so it's
easy to determine what the release package was
built from.
</description>
<delete file="${ssBaseDir}/gitInfo.txt"/>
<echo output="${ssBaseDir}/gitInfo.txt" message="Branch: " append="false"/>
<exec executable="git" output="${ssBaseDir}/gitInfo.txt" append="true">
<arg value="rev-parse"/>
<arg value="--abbrev-ref"/>
<arg value="HEAD"/>
</exec>
<echo output="${ssBaseDir}/gitInfo.txt" message="Commit: " append="true"/>
<exec executable="git" output="${ssBaseDir}/gitInfo.txt" append="true">
<arg value="rev-parse"/>
<arg value="HEAD"/>
</exec>
</target>
<target name="buildDist">
<description>
TARGET buildDist
This copies all the required files into the temporary
folder ready for zipping.
</description>
<echo message="Creating distribution..."/>
<echo message="Cleaning out existing folder..."/>
<delete dir="${staticSearchTempDir}"/>
<mkdir dir="${staticSearchTempDir}/staticSearch"/>
<echo message="Copying files..."/>
<copy todir="${staticSearchTempDir}/staticSearch">
<fileset refid="requiredFiles"/>
</copy>
</target>
<target name="zipDist">
<description>
TARGET zipDist
Creates two output archives from the distribution
content, one zip and one tar.gz.
</description>
<echo message="Creating compressed archives..."/>
<delete dir="${distOutputFolder}"/>
<mkdir dir="${distOutputFolder}"/>
<zip destfile="${distOutputFolder}/staticSearch_${edition}.zip"
basedir="${staticSearchTempDir}"
includes="staticSearch/**/*"/>
<tar destfile="${distOutputFolder}/staticSearch_${edition}.tar.gz"
basedir="${staticSearchTempDir}"
includes="staticSearch/**/*"
compression="gzip"
longfile="posix"
/>
</target>
<target name="all">
<description>
TARGET all
Runs a complete build.
</description>
<antcall target="readEdition"/>
<antcall target="getGitInfo"/>
<antcall target="buildDist"/>
<antcall target="zipDist"/>
</target>
</project>