-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.xml
209 lines (185 loc) · 11.4 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
<?xml version="1.0"?>
<!DOCTYPE project>
<project name="appserver-io-php/runtime" default="dependencies-init" basedir=".">
<!-- ==================================================================== -->
<!-- Load the environment variables into our properties -->
<!-- ==================================================================== -->
<property environment="env" />
<!-- ==================================================================== -->
<!-- Generate a time stamp for further use in build targets -->
<!-- ==================================================================== -->
<tstamp>
<format property="time.stamp" pattern="yyyy-MM-dd_HHmmss"/>
</tstamp>
<!-- ==================================================================== -->
<!-- We define an extra property for our base directory so we are able to -->
<!-- selectively override it without affection the original dir -->
<!-- ==================================================================== -->
<property name="work.dir" value="${basedir}/" />
<!-- ==================================================================== -->
<!-- Create some basic properties which we need for further processing -->
<!-- The property hub.scp-user is missing on purpose and has to be -->
<!-- provided within the build environment. -->
<!-- ==================================================================== -->
<property name="hub.address" value="bernade.appserver.io"/>
<property name="src.dir" value="${work.dir}src" />
<property name="lib.dir" value="${work.dir}lib" />
<property name="target.dir" value="${work.dir}target" />
<property name="build.dir" value="${work.dir}build" />
<property name="tests.dir" value="${work.dir}tests" />
<property name="temp.dir" value="${work.dir}tmp" />
<property name="reports.dir" value="${work.dir}reports" />
<!-- ==================================================================== -->
<!-- Load all property files in the right order -->
<!-- ==================================================================== -->
<property file="${basedir}/build.properties"/>
<property file="${user.home}/build.properties"/>
<property file="${basedir}/build.default.properties"/>
<!-- ==================================================================== -->
<!-- Import the build.xml files, defined by os.family property -->
<!-- ==================================================================== -->
<import file="buildfiles/${os.family}/build.xml"/>
<!-- initialize the library specific properties -->
<property name="codepool" value="vendor"/>
<!-- initialize the directory where we can find the real build files -->
<property name="dependency.dir" value ="${basedir}/${codepool}" />
<property name="package.dir" value="${dependency.dir}/package" />
<property name="package.remote-location" value="https://github.com/appserver-io-dist/package.git" />
<!-- ==================================================================== -->
<!-- Import the package build files if they are present -->
<!-- ==================================================================== -->
<import file="${package.dir}/common.xml" optional="true" />
<!-- ==================================================================== -->
<!-- Remote path to recently built resources -->
<!-- ==================================================================== -->
<property name="hub.snapshot-path" value="/var/www/builds.appserver.io/${os.qualified.path}"/>
<!-- ==================================================================== -->
<!-- Checks if the package helper libary is present -->
<!-- ==================================================================== -->
<target name="package-library-present">
<!-- check for the existence of the most central file of the package library -->
<available file="${package.dir}/common.xml" property="package-library.present" />
</target>
<!-- ==================================================================== -->
<!-- Loads all dependencies needed for the execution of build targets. -->
<!-- Not to be confused with the loading of dependencies needed for the -->
<!-- built packages! -->
<!-- ==================================================================== -->
<target name="dependencies-init" depends="package-library-present" unless="package-library.present">
<!-- create the target dir -->
<mkdir dir="${dependency.dir}" />
<!-- clone the latest version of our package library -->
<exec dir="${dependency.dir}" executable="git">
<arg line="clone ${package.remote-location}" />
</exec>
</target>
<!-- ==================================================================== -->
<!-- Cleans the directories with the generated source files -->
<!-- ==================================================================== -->
<target name="clean" description="Cleans build directory in preparation for new build.">
<delete dir="${target.dir}" includeemptydirs="true" quiet="false" verbose="true" failonerror="true"/>
<delete dir="${temp.dir}" includeemptydirs="true" quiet="false" verbose="true" failonerror="true"/>
</target>
<!-- ==================================================================== -->
<!-- Cleans the build directories -->
<!-- ==================================================================== -->
<target name="clean-build" depends="prepare-build">
<delete includeemptydirs="true" quiet="false" verbose="false" failonerror="true">
<fileset dir="${build.dir}" includes="**/*"/>
</delete>
</target>
<!-- ==================================================================== -->
<!-- Prepares the build environment -->
<!-- ==================================================================== -->
<target name="prepare-build">
<mkdir dir="${build.dir}" />
</target>
<!-- ==================================================================== -->
<!-- Prepares all the required directories -->
<!-- ==================================================================== -->
<target name="prepare" depends="clean" description="Prepares all the required directories.">
<mkdir dir="${target.dir}" />
<mkdir dir="${lib.dir}" />
<mkdir dir="${temp.dir}" />
</target>
<!-- ==================================================================== -->
<!-- Copies the sources to the temporary directory -->
<!-- ==================================================================== -->
<target name="copy" depends="prepare" description="Copies the sources to the target directory.">
<copy todir="${target.dir}" preservelastmodified="true" overwrite="true">
<fileset dir="${src.dir}/${os.family}/generic">
<include name="**/*" />
</fileset>
<filterchain>
<expandproperties/>
</filterchain>
</copy>
<copy todir="${target.dir}" failonerror="false" preservelastmodified="true" overwrite="true" quiet="true">
<fileset dir="${src.dir}/${os.family}/${os.distribution}">
<include name="**/*" />
</fileset>
</copy>
</target>
<!-- ==================================================================== -->
<!-- Copies the sources to the deploy directory -->
<!-- ==================================================================== -->
<target name="deploy" depends="copy" description="Copies the sources to the deploy directory.">
<copy todir="${dir.www}/${deploy.dir}" preservelastmodified="true" overwrite="true">
<fileset dir="${target.dir}">
<include name="**/*"/>
</fileset>
</copy>
</target>
<!-- ==================================================================== -->
<!-- Checks if the executtion of make clean is even needed. -->
<!-- ==================================================================== -->
<target name="check-make-clean-needed" description="Checks if the executtion of make clean is even needed.">
<!-- download the composer installer -->
<condition property="make-clean.needed">
<or>
<available file="${target.dir}/php-${runtime.php.version}/makefile" />
<available file="${target.dir}/php-${runtime.php.version}/Makefile" />
<available file="${target.dir}/php-${runtime.php.version}/GNUMakefile" />
</or>
</condition>
</target>
<!-- ==================================================================== -->
<!-- Executes make clean if it is needed. -->
<!-- ==================================================================== -->
<target name="make-clean" depends="check-make-clean-needed" if="make-clean.needed" description="Executes make clean if it is needed.">
<!-- execute the "make clean" command -->
<exec dir="${target.dir}/php-${runtime.php.version}" executable="make" failonerror="true">
<arg value="clean"/>
</exec>
</target>
<!-- ==================================================================== -->
<!-- Moves any build results from the temporary target directory into -->
<!-- a mounted build directoy -->
<!-- ==================================================================== -->
<target name="move-build-results" description="Moves any build results from the temporary target directory into a mounted build directoy">
<move todir="${runtime.compile.prefix}" preservelastmodified="true" overwrite="true">
<fileset dir="${src.dir}/${os.family}/generic">
<include name="**/*" />
</fileset>
<filterchain>
<expandproperties/>
</filterchain>
</move>
<copy todir="${runtime.compile.prefix}" failonerror="false" errorproperty="dev.null" preservelastmodified="true" overwrite="true">
<fileset dir="${src.dir}/${os.family}/${os.distribution}">
<include name="**/*" />
</fileset>
</copy>
<!-- make the composer file executable -->
<chmod perm="755" file="${runtime.compile.prefix}/bin/composer" />
</target>
<!-- ==================================================================== -->
<!-- Builds the runtime locally -->
<!-- ==================================================================== -->
<target name="local-build" depends="prepare-build" description="Builds the runtime and creates a .tgz package.">
<!-- do the actual building -->
<antcall target="build-runtime" />
<!-- create a compressed package of the recent build -->
<antcall target="create-package" />
</target>
</project>