-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
97 lines (85 loc) · 3.81 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
<?xml version="1.0" encoding="utf-8"?>
<project name="CIAPI.PHP" default="build" basedir=".">
<description>
CIAPI.PHP Ant build support for specific tasks not readily/easily available in Maven itself.
</description>
<!-- set global properties for this build -->
<condition property="windowsBatchToolSuffix" value=".bat" else="">
<os family="windows" />
</condition>
<property name="src" location="src" />
<property name="build" location="build" />
<property name="composer" location="${build}/composer" />
<property name="dist" location="${build}/dist" />
<property name="vendor" location="vendor" />
<property name="installerSrc" value="http://getcomposer.org/installer" />
<property name="installerDest" location="${composer}/installer" />
<property name="composerDest" location="${composer}/composer.phar" />
<property name="releaseName" value="CIAPI.PHP" />
<property name="phpTimezone" value="date.timezone=UTC" />
<property name="phpunit" value="phpunit${windowsBatchToolSuffix}" />
<property name="phpunitConf" location="phpunit.xml" />
<property name="travis-lint" value="travis-lint${windowsBatchToolSuffix}" />
<property name="travisConf" location=".travis.yml" />
<target name="build" depends="clean,install,test">
</target>
<target name="dist" depends="dist-clean,install,package">
</target>
<target name="init">
<!-- Create the time stamp -->
<tstamp />
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}" />
<mkdir dir="${build}/composer" />
<available file="${composerDest}" type="file" property="composer.dest.available" />
<available file="${vendor}" type="dir" property="vendor.available" />
</target>
<target name="composer" depends="init" description="Get composer" unless="${composer.dest.available}">
<get src="${installerSrc}" dest="${installerDest}" verbose="true" usetimestamp="true" />
<exec executable="php" dir="${composer}">
<arg line="-d ${phpTimezone} -f ${installerDest}" />
</exec>
</target>
<target name="install" depends="composer" description="Parse composer.json and download dependencies" unless="${vendor.available}">
<exec executable="php" dir="${basedir}">
<arg line="-d ${phpTimezone} -f ${composerDest}" />
<arg value="install" />
</exec>
</target>
<target name="update" depends="composer" description="Update dependencies and composer.lock">
<exec executable="php" dir="${basedir}">
<arg line="-d ${phpTimezone} -f ${composerDest}" />
<arg value="update" />
</exec>
</target>
<target name="phpunit" description="Run unit tests with PHPUnit">
<exec executable="${phpunit}" failonerror="true">
<arg value="--configuration" />
<arg value="${phpunitConf}" />
</exec>
</target>
<target name="test" depends="phpunit" description="Run tests">
</target>
<target name="travis" description="Validate Travis CI configuration">
<exec executable="${travis-lint}" failonerror="true">
<arg line="${travisConf}" />
</exec>
</target>
<target name="package" depends="test" description="Create distribution pacakges">
<zip destfile="${dist}/${releaseName}.zip">
<zipfileset dir="${src}" prefix="CIAPI.PHP/src" />
<zipfileset dir="${vendor}" prefix="CIAPI.PHP/vendor" />
</zip>
<tar destfile="${dist}/${releaseName}.tar.gz" compression="gzip">
<zipfileset src="${dist}/${releaseName}.zip" />
</tar>
</target>
<target name="clean" description="Clean up regular build artifacts (w/o vendor tree)">
<!-- Delete the ${build} directory tree -->
<delete dir="${build}" />
</target>
<target name="dist-clean" depends="clean" description="Clean up all artifacts (w/ vendor tree)">
<!-- Delete the ${vendor} directory tree -->
<delete dir="${vendor}" />
</target>
</project>