forked from revive-adserver/revive-adserver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
239 lines (195 loc) · 10.5 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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
<project name="openx" default="package" basedir=".">
<property name="test.conf.xml" value="devel.xml"/>
<property name="dir.test.results" location="build/test-results"/>
<property name="dir.test.reports" location="build/test-results"/>
<property name="origin" value=""/>
<property file="devel.properties"/>
<property file="etc/version.properties"/>
<property name="rpm.basepath" value="opt/ox/adserver" />
<!-- Import the include/exclude filelist -->
<import file="build-filelist.xml"/>
<!-- OpenX Package Integrity Plugin -->
<taskdef name="checkdistribution" classname="org.openads.ant.CheckDistributionTask"/>
<!-- OpenX Delivery Generation Plugin -->
<taskdef name="generatedelivery" classname="org.openads.ant.GenerateDeliveryTask"/>
<macrodef name="oa-version" description="Sets a value of the OA_VERSION constant in the constants.php file.">
<attribute name="versionstring" description="A version to be set."/>
<sequential>
<replaceregexp file="constants.php"
match="^ *define\('OA_VERSION.*$"
replace=" define('OA_VERSION', '@{versionstring}');"
byline="true"/>
</sequential>
</macrodef>
<target name="clean" description="Cleans all the files generated during the build.">
<delete file="var/test.log" />
<delete dir="build" />
<delete file="tests.xml" />
</target>
<!-- ******************************************************************** -->
<!-- DELIVERY AND XML CACHE GENERATION TARGETS -->
<!-- ******************************************************************** -->
<target name="generate-delivery"
description="Merge delivery files into /www/delivery folder to optimize their speed.">
<exec dir="${basedir}/scripts/delivery" executable="php" failonerror="true">
<arg value="rebuild.php" />
</exec>
</target>
<target name="delivery-commit"
description="Merge delivery files into /www/delivery folder to optimize their speed and commit the generated files to the SVN."
depends="generate-delivery"
>
<svn-commit file="www/delivery" notes="Commit of auto-generated delivery files."/>
</target>
<target name="generate-xml-cache" description="Generate XML Cache from MDB2 Schema XML files">
<exec dir="${basedir}/scripts/upgrade" executable="php" failonerror="true">
<arg value="buildXmlCache.php" />
</exec>
</target>
<!-- ******************************************************************** -->
<!-- INITIALIZATION TARGETS -->
<!-- ******************************************************************** -->
<target name="init">
<touch file="should_not_exist"/>
<mkdir dir="build/test-results"/>
<mkdir dir="build/test-reports"/>
</target>
<target name="init-timestamp" unless="cctimestamp">
<tstamp/>
<property name="cctimestamp" value="${DSTAMP}${TSTAMP}"/>
</target>
<target name="init-label" unless="label">
<property name="label" value="trunk"/>
</target>
<target name="init-revision" unless="svnrevision">
<property name="svnrevision" value="na"/>
</target>
<target name="init-version" unless="version" depends="init-timestamp, init-label, init-revision">
<property name="version" value="${label}-${cctimestamp}-rev-${svnrevision}"/>
</target>
<target name="init-release" unless="release" depends="init,init-version">
<property name="release" value="openx-${version}"/>
<echo message="Initialized release: ${release}."/>
</target>
<target name="prepare-version-info" if="version" depends="init-release">
<echo message="Setting OA_VERSION to '${version}'."/>
<oa-version versionstring="${version}"/>
</target>
<!-- ******************************************************************** -->
<!-- PACKAGE TARGETS -->
<!-- ******************************************************************** -->
<target name="checkconsistency"
description="Checks whether all the files in the working directory are specified in the included or excluded lists of files.">
<checkdistribution>
<includeset dir="${basedir}">
<patternset refid="dist.included"/>
<patternset refid="dist.writable"/>
</includeset>
<excludeset dir="${basedir}">
<patternset refid="dist.excluded"/>
</excludeset>
</checkdistribution>
</target>
<target name="package-bzip2-canoo" depends="prepare-version-info">
<property name="canoo.package" value="openx-canoo-${version}.tar.gz"/>
<property name="canoo.package.file" value="${dir.test.results}/${canoo.package}"/>
<tar destfile="${canoo.package.file}" basedir="." compression="gzip" longfile="gnu">
<patternset refid="dist.included"/>
</tar>
</target>
<target name="prepare-distribution" depends="prepare-version-info">
<property name="release.dir" value="${dir.test.results}/${release}"/>
<mkdir dir="${release.dir}"/>
<copy todir="${release.dir}" includeEmptyDirs="true">
<fileset dir=".">
<patternset refid="dist.included"/>
</fileset>
</copy>
</target>
<target name="clear-distribution" depends="prepare-version-info">
<property name="release.dir" value="${dir.test.results}/${release}"/>
<delete dir="${release.dir}" failonerror="false"/>
</target>
<target name="package-bzip2" depends="prepare-version-info">
<tar destfile="${dir.test.results}/${release}${origin}.tar.bz2" basedir="${dir.test.results}" includes="${release}/**" compression="bzip2" longfile="gnu"/>
</target>
<target name="package-gz" depends="prepare-version-info">
<tar destfile="${dir.test.results}/${release}${origin}.tar.gz" includes="${release}/**" basedir="${dir.test.results}" compression="gzip" longfile="gnu"/>
</target>
<target name="package-zip" depends="prepare-version-info">
<zip destfile="${dir.test.results}/${release}${origin}.zip" basedir="${dir.test.results}" includes="${release}/**"/>
</target>
<target name="package-rpm" depends="prepare-version-info">
<fail unless="build" message="You must specify a build number # when building an RPM package e.g. -Dbuild=1" />
<copy file="${basedir}/scripts/rpm/core.spec.dist" tofile="${basedir}/scripts/rpm/core.spec" overwrite="true" />
<replace file="${basedir}/scripts/rpm/core.spec" token="{VERSION}" value="${openx.version.major}.${openx.version.minor}.${openx.version.revision}.${openx.version.rc}"/>
<replace file="${basedir}/scripts/rpm/core.spec" token="{BUILD}" value="${build}"/>
<replace file="${basedir}/scripts/rpm/core.spec" token="{DOCROOT}" value="/${rpm.basepath}"/>
<replace file="${basedir}/scripts/rpm/core.spec" token="{FOLDER}" value="${release}"/>
<!-- Relocate the files into the desired output path -->
<mkdir dir="${dir.test.results}/rpm/buildroot/${rpm.basepath}"/>
<move file="${dir.test.results}/${release}" toDir="${dir.test.results}/rpm/buildroot/${rpm.basepath}" />
<mkdir dir="${dir.test.results}/rpm/builddir/RPMS/noarch"/>
<exec dir="${basedir}/scripts/rpm" executable="rpmbuild" failonerror="true">
<arg value="-bb" />
<arg value="--buildroot" />
<arg value="${dir.test.results}/rpm/buildroot" />
<arg value="${basedir}/scripts/rpm/core.spec" />
</exec>
<!-- clean up -->
<move file="${dir.test.results}/rpm/buildroot/${rpm.basepath}/${release}" toDir="${dir.test.results}/" />
<delete dir="${dir.test.results}/rpm/buildroot/${rpm.basepath}/${release}" />
</target>
<target name="build-rpm" depends="generate-delivery, generate-xml-cache, checkconsistency, prepare-distribution, package-rpm"/>
<target name="package" depends="generate-delivery, generate-xml-cache, checkconsistency, prepare-distribution, package-bzip2, package-gz, package-zip"/>
<target name="write-origin-id" depends="prepare-version-info" if="originid">
<echo message="${originid}" file="${dir.test.results}/${release}/etc/origin.txt" append="no"/>
</target>
<target name="repackage" if="originid" depends="write-origin-id,package-bzip2,package-gz,package-zip"/>
<target name="build" depends="package, revert-after-packaging" description="Run this if you want your own release files built."/>
<!-- ******************************************************************** -->
<!-- RELEASE TARGETS -->
<!-- ******************************************************************** -->
<target name="revert-after-packaging">
<svn-revert file="constants.php"/>
</target>
<target name="release" depends="oa-save-version, package" if="version"/>
<target name="oa-save-version" if="version">
<oa-version versionstring="${version}"/>
</target>
<!-- ******************************************************************** -->
<!-- TEST TARGETS -->
<!-- ******************************************************************** -->
<target name="test-prepare">
<xslt style="tests.xsl" in="${test.conf.xml}" out="tests.xml"/>
</target>
<target name="test-all" depends="init, test-prepare">
<ant antfile="tests.xml"/>
</target>
<!--
<target name="test-canoo" description="Test canoo remotely or if -Drun.local=true switch exist tests it locally">
<echo>test-canoo started</echo>
<if>
<istrue value="${run.local}"/>
<then>
<echo message="running locally"/>
<antcall target="test-canoo-local" />
</then>
<else>
<echo message="running remotely"/>
<antcall target="test-canoo-remote" />
</else>
</if>
<echo>test-canoo finished</echo>
</target> -->
<!-- <target name="test-canoo-local" depends="canoo-create-openx-configuration-local, setup-delivery-files, run-test-canoo"> -->
<!--
<target name="test-canoo-local" depends="setup-delivery-files, run-test-canoo">
<property name="run.local" value="true" />
<antcall target="clean-delivery"></antcall>
</target>
<target name="test-canoo-remote" depends="test-canoo-prepare, run-test-canoo, clean-ec2"/>
<target name="test-canoo-prepare" depends="clean, checkconsistency, init-version, package-bzip2-canoo, canoo-prepare-dir, canoo-copy-package, canoo-unpack-package, canoo-create-openx-configuration-remote"/>
-->
<target name="simpletest" depends="clean, init, test-all" />
</project>