-
-
Notifications
You must be signed in to change notification settings - Fork 319
/
Copy pathbuild.xml
200 lines (170 loc) · 6.52 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
<?xml version="1.0"?>
<!--
This build file builds the Phing release as a phar package.
-->
<project name="phing" basedir="." default="main">
<dirname property="buildfile.dir" file="${phing.file}"/>
<resolvepath propertyName="phingpkg.home" path="${buildfile.dir}/.."/>
<property name="build.full.dir" value="${buildfile.dir}/full"/>
<fileset dir="${phingpkg.home}" id="all">
<include name="bin/phing"/>
<include name="bin/phing.bat"/>
<include name="bin/phing.php"/>
<include name="src/**"/>
<include name="etc/**"/>
<include name="CHANGELOG.md"/>
<include name="CREDITS.md"/>
<include name="LICENSE"/>
<include name="README.md"/>
<include name="composer.*"/>
</fileset>
<!--
==============================================
Main entry point
==============================================
-->
<target name="main"
depends="clean,copy-files,composer,package.phar"
/>
<!--
==============================================
Sets some default properties
==============================================
-->
<target name="setproperties">
<loadfile property="version" file="${phingpkg.home}/etc/VERSION.TXT"/>
<property name="pkgname" value="phing-${version}"/>
<property name="build.full.dir" value="${buildfile.dir}/full/${pkgname}" override="true"/>
<if>
<contains string="${version}" substring="RC"/>
<then>
<property name="notes" value="This is the latest release candidate of Phing." />
<property name="state" value="RC" />
</then>
<elseif>
<contains string="${version}" substring="alpha"/>
<then>
<property name="notes" value="This is the latest alpha release of Phing." />
<property name="state" value="alpha"/>
</then>
</elseif>
<else>
<property name="notes" value="This is the latest stable release of Phing." />
<property name="state" value="stable"/>
</else>
</if>
<echo>Building Phing version ${version} (${state})</echo>
<echo>${notes}</echo>
</target>
<!--
==============================================
Copy the desired files into the build/ dir
==============================================
-->
<target name="copy-files"
depends="setproperties">
<echo>-----------------------------</echo>
<echo>| Creating directory layout |</echo>
<echo>-----------------------------</echo>
<mkdir dir="${build.full.dir}" />
<copy todir="${build.full.dir}">
<fileset refid="all"/>
</copy>
<copy file="${buildfile.dir}/manifest.xml" tofile="${build.full.dir}/manifest.xml">
<filterchain>
<expandproperties />
</filterchain>
</copy>
<chmod file="${build.full.dir}/bin/phing" mode="755"/>
</target>
<!--
==============================================
Run composer
==============================================
-->
<target name="composer"
depends="setproperties">
<composer command="install" composer="composer" php="">
<arg value="--working-dir=${build.full.dir}"/>
<arg value="-o"/>
<arg value="--no-plugins"/>
<arg value="--no-scripts"/>
<arg value="--prefer-dist"/>
</composer>
</target>
<!--
==============================================
Create a phar package of the files.
==============================================
-->
<target name="package.phar"
if="version"
depends="setproperties">
<tstamp>
<format property="builddate" pattern="yyyyMMdd" />
</tstamp>
<pharpackage
compression="gzip"
destfile="${build.full.dir}.phar"
stub="${buildfile.dir}/phing-stub.php"
alias="phing.phar"
basedir="${build.full.dir}">
<fileset dir="${build.full.dir}">
<include name="bin/**" />
<include name="src/**" />
<include name="etc/**" />
<include name="vendor/**" />
<include name="manifest.xml" />
<include name="custom*.properties" />
</fileset>
<metadata>
<element name="version" value="${version}" />
<element name="state" value="${state}" />
<element name="builddate" value="${builddate}" />
<element name="authors">
<element name="Michiel Rook">
<element name="e-mail" value="mrook@php.net" />
</element>
</element>
</metadata>
</pharpackage>
<phingcall target="generate-hash">
<param name="filename" value="${build.full.dir}.phar"/>
</phingcall>
<if>
<equals arg1="${state}" arg2="stable"/>
<then>
<copy file="${build.full.dir}.phar" tofile="${buildfile.dir}/full/phing-latest.phar"/>
<phingcall target="generate-hash">
<param name="filename" value="${buildfile.dir}/full/phing-latest.phar"/>
</phingcall>
</then>
</if>
</target>
<!--
==============================================
Clean up build files.
==============================================
-->
<target name="clean"
depends="setproperties">
<echo>-----------------------------</echo>
<echo>| Deleting build directory |</echo>
<echo>-----------------------------</echo>
<delete dir="${buildfile.dir}/full" failonerror="false"/>
</target>
<!--
==============================================
Generate SHA512 file hashes
==============================================
-->
<target name="generate-hash" unless="env.CI">
<filehash file="${filename}" algorithm="sha512" />
<filehash file="${filename}" algorithm="sha384" />
<filehash file="${filename}" algorithm="sha256" />
<filehash file="${filename}" algorithm="sha1" />
<exec executable="gpg" checkreturn="true" logoutput="true" taskname="gpg">
<arg line="-u release@phing.info --detach-sign --output ${filename}.asc ${filename}"/>
</exec>
</target>
</project>