-
Notifications
You must be signed in to change notification settings - Fork 101
/
build.xml
133 lines (118 loc) · 6.46 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
<?xml version="1.0"?>
<!DOCTYPE project>
<project name="appserver-io/appserver" default="composer-init" basedir=".">
<!-- initialize ENV variable -->
<property environment="env" />
<!-- ==================================================================== -->
<!-- Generate a time stamp for further use in build targets -->
<!-- ==================================================================== -->
<tstamp>
<format property="time.stamp" pattern="yyyy-MM-dd_HHmmss"/>
</tstamp>
<!-- ==================================================================== -->
<!-- Defines helpful ANT targets -->
<!-- ==================================================================== -->
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="${basedir}/resources/lib/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
<!-- ==================================================================== -->
<!-- Defines a XML helper library -->
<!-- ==================================================================== -->
<taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask">
<classpath>
<pathelement location="${basedir}/resources/lib/xmltask.jar"/>
</classpath>
</taskdef>
<!-- initialize file based properties -->
<property file="${basedir}/build.properties"/>
<property file="${basedir}/build.default.properties"/>
<property file="${basedir}/build.${os.family}.properties"/>
<!-- initialize the library specific properties -->
<property name="codepool" value="vendor"/>
<!-- initialize the directory where we can find the real build files -->
<property name="vendor.dir" value ="${basedir}/${codepool}" />
<property name="build.dir" value="${vendor.dir}/appserver-io/build" />
<!-- ==================================================================== -->
<!-- Import all component specific build configuration files -->
<!-- ==================================================================== -->
<for param="component.build.file">
<fileset erroronmissingdir="false" dir="${vendor.dir}" includes="**/common.xml" />
<sequential>
<import file="@{component.build.file}"/>
</sequential>
</for>
<!-- ==================================================================== -->
<!-- Checks if composer has installed it's dependencies -->
<!-- ==================================================================== -->
<target name="is-composer-installed">
<condition property="composer.present">
<available file="${build.dir}" type="dir"/>
</condition>
</target>
<!-- ==================================================================== -->
<!-- Installs all dependencies defined in composer.json -->
<!-- ==================================================================== -->
<target name="composer-install" depends="is-composer-installed" unless="composer.present" description="Installs all dependencies defined in composer.json">
<exec dir="${basedir}" executable="composer">
<arg line="--no-interaction --dev install"/>
</exec>
</target>
<!-- ==================================================================== -->
<!-- Updates composer dependencies defined in composer.json -->
<!-- ==================================================================== -->
<target name="composer-update" depends="is-composer-installed" if="composer.present" description="Updates composer dependencies defined in composer.json">
<exec dir="${basedir}" executable="composer">
<arg line="--no-interaction --dev update"/>
</exec>
</target>
<!-- ===================================================================== -->
<!-- Checks if the build- and deployment stub has already been initialized -->
<!-- ===================================================================== -->
<target name="composer-init">
<antcall target="composer-install"/>
<antcall target="composer-update"/>
</target>
<!-- ==================================================================== -->
<!-- Copies the sources to the temporary directory -->
<!-- ==================================================================== -->
<target name="copy" description="Copies the sources to the temporary directory.">
<!-- prepare the build environment -->
<antcall target="prepare" />
<!-- copy all files to the target directory -->
<copy todir="${php-target.dir}/appserver" preservelastmodified="true" overwrite="true">
<fileset dir="${basedir}">
<include name="etc/**/*" />
<include name="src/**/*" />
<include name="var/**/*" />
<include name="tests/**/*" />
<include name="webapps/**/*" />
<include name="internal/**/*" />
<include name="resources/**/*" />
<include name="server.php" />
<include name="appserver.php" />
<include name="composer.json" />
</fileset>
</copy>
<!-- create the file with the version number -->
<echo file="${php-target.dir}/appserver/etc/appserver/.release-version" message="dev-master.${build.number}" />
</target>
<!-- ==================================================================== -->
<!-- Copies the sources to the deploy directory -->
<!-- ==================================================================== -->
<target name="deploy" depends="copy" description="Copies the sources to the deploy directory.">
<!-- copy all files to the deploy.directory -->
<copy todir="${deploy.dir}" preservelastmodified="true" overwrite="true">
<fileset dir="${php-target.dir}/appserver">
<include name="**/*"/>
</fileset>
</copy>
<!-- execute the composer post install script -->
<exec dir="${deploy.dir}" executable="${appserver.bin.dir}/php">
<arg value="${appserver.bin.dir}/composer.phar" />
<arg value="run-script" />
<arg value="post-install-cmd" />
</exec>
</target>
</project>