forked from revive-adserver/revive-adserver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
194 lines (158 loc) · 7.79 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
<project name="revive" 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"/>
<!-- YUI compressor -->
<path id="task.classpath">
<pathelement location="${basedir}/lib/ant/yuicompressor-2.4.8.jar" />
<pathelement location="${basedir}/lib/ant/yui-compressor-ant-task-0.5.jar" />
</path>
<taskdef name="yui-compressor" classname="net.noha.tools.ant.yuicompressor.tasks.YuiCompressorTask">
<classpath refid="task.classpath" />
</taskdef>
<!-- Import the include/exclude filelist -->
<import file="build-filelist.xml"/>
<!-- Package Integrity Plugin -->
<taskdef name="checkdistribution" classname="org.openads.ant.CheckDistributionTask"/>
<macrodef name="rv-version" description="Sets a value of the VERSION constant in the constants.php file.">
<attribute name="versionstring" description="A version to be set."/>
<sequential>
<replaceregexp file="constants.php"
match="^ *define\('VERSION.*$"
replace=" define('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" depends="install-deps"
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="minify-delivery"
description="Minify delivery JS files into /www/delivery">
<delete>
<fileset dir="${basedir}/www/delivery" includes="*.js"/>
</delete>
<yui-compressor warn="false" munge="true" jsSuffix=".js" cssSuffix=".css" preserveAllSemiColons="false" fromDir="${basedir}/www/delivery_dev" toDir="${basedir}/www/delivery">
<include name="*.js" />
</yui-compressor>
</target>
<target name="generate-xml-cache" depends="install-deps" 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"/>
<touch file="var/UPGRADE"/>
</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="master"/>
</target>
<target name="init-version" unless="version" depends="init-timestamp, init-label">
<property name="version" value="${label}-${cctimestamp}"/>
</target>
<target name="init-release" unless="release" depends="init,init-version">
<property name="release" value="revive-adserver-${version}"/>
<echo message="Initialized release: ${release}."/>
</target>
<target name="prepare-version-info" if="version" depends="init-release">
<echo message="Setting VERSION to '${version}'."/>
<rv-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="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="install-deps" description="Install composer dependencies.">
<exec dir="${basedir}" executable="composer" failonerror="true">
<arg value="install" />
<arg value="--no-dev" />
<arg value="--prefer-dist" />
<arg value="-o" />
</exec>
</target>
<target name="clear-deps" description="Cleans the composer vendor dir.">
<delete dir="lib/vendor" />
</target>
<target name="clear-distribution" depends="prepare-version-info, clear-deps">
<property name="release.dir" value="${dir.test.results}/${release}"/>
<delete dir="${release.dir}" failonerror="false"/>
</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" depends="generate-delivery, generate-xml-cache, checkconsistency, prepare-distribution, package-gz, package-zip"/>
<target name="repackage" if="originid" depends="package-gz,package-zip"/>
<target name="build" depends="package" description="Run this if you want your own release files built."/>
<!-- ******************************************************************** -->
<!-- RELEASE TARGETS -->
<!-- ******************************************************************** -->
<target name="release" depends="rv-save-version, package" if="version"/>
<target name="rv-save-version" if="version">
<rv-version versionstring="${version}"/>
</target>
<!-- ******************************************************************** -->
<!-- TEST TARGETS -->
<!-- ******************************************************************** -->
<target name="test-prepare">
<xslt style="tests.xsl" in="${test.conf.xml}" out="tests.xml"/>
<ant dir="${basedir}/plugins_repo" target="release">
<property name="name" value="demoExtension"/>
</ant>
<ant dir="${basedir}/plugins_repo" target="release">
<property name="name" value="openXAdditionalBannerTypes"/>
</ant>
<ant dir="${basedir}/plugins_repo" target="release">
<property name="name" value="openXTests"/>
</ant>
</target>
<target name="test-all" depends="init, test-prepare">
<ant antfile="tests.xml"/>
</target>
<target name="simpletest" depends="clean, init, test-all" />
</project>