forked from dflydev/repose-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
181 lines (156 loc) · 7.13 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
<?xml version="1.0"?>
<project name="repose-php" default="default" basedir=".">
<property file="build.properties" />
<property name="paths.build" value="${project.basedir}/build" />
<property name="paths.dist" value="${project.basedir}/dist" />
<property name="paths.repo" value="${project.basedir}/repos" />
<property name="paths.tests" value="${project.basedir}/tests" />
<property name="paths.logs" value="${paths.build}/logs" />
<property name="paths.reports" value="${paths.build}/reports" />
<property name="repose.repository.url" value="git://github.com/dflydev/repose-php.git" />
<property name="repose.repository.path" value="${paths.repo}/repose-php" />
<fileset dir="${repose.repository.path}/lib" id="repose-libs">
<include name="*.php" />
</fileset>
<fileset dir="${repose.repository.path}" id="repose-misc">
<include name="README" />
<include name="LICENSE" />
</fileset>
<tstamp>
<format property="DSTAMP" pattern="%Y%m%d" />
<format property="TSTAMP" pattern="%H%M%S" />
</tstamp>
<target name="version">
<if>
<isset property="repose.tag" />
<then><property name="repose.version" value="${repose.tag}" /></then>
<else>
<if>
<not><isset property="repose.snapshotVersion" /></not>
<then>
<property name="repose.snapshotVersion" value="snapshot-${DSTAMP}${TSTAMP}" />
</then>
</if>
<if>
<isset property="repose.branch" />
<then><property name="repose.version" value="${repose.branch}-${repose.snapshotVersion}" /></then>
<else><property name="repose.version" value="${repose.snapshotVersion}" /></else>
</if>
</else>
</if>
</target>
<target name="setProperties" depends="version">
<property name="repose.pkgname.basic" value="repose-${repose.version}" />
<property name="repose.build.basic.path" value="${paths.build}/${repose.pkgname.basic}" />
<property name="repose.dist.basic.zipfile" value="${paths.dist}/${repose.pkgname.basic}.zip" />
<property name="repose.dist.basic.tgzfile" value="${paths.dist}/${repose.pkgname.basic}.tar.gz" />
</target>
<target name="prep">
<mkdir dir="${paths.build}" />
<mkdir dir="${paths.dist}" />
</target>
<target name="cleanBuild">
<delete dir="${paths.build}" />
</target>
<target name="cleanDist">
<delete dir="${paths.dist}" />
</target>
<target name="cleanRepos">
<delete dir="${paths.repos}" />
</target>
<target name="clean" depends="cleanBuild,cleanDist" />
<target name="realClean" depends="clean,cleanRepos" />
<target name="realclean" depends="realClean" />
<target name="update" depends="prep">
<if>
<available file="${repose.repository.path}" />
<then>
<echo>Fetching changes from upstream repository</echo>
<gitfetch repository="${repose.repository.path}" tags="true" />
</then>
<else>
<mkdir dir="${repose.repository.path}" />
<gitclone repository="${repose.repository.url}" targetPath="${repose.repository.path}" />
</else>
</if>
<if>
<isset property="repose.tag" />
<then>
<gitcheckout repository="${repose.repository.path}" branchname="v${repose.tag}" />
</then>
<else>
<if>
<isset property="repose.branch" />
<then>
<!--<gitcheckout repository="${repose.repository.path}" create="true" branchname="${repose.branch}" startPoint="origin/${repose.branch}" />-->
<gitcheckout repository="${repose.repository.path}" create="true" branchname="${repose.branch}" startPoint="origin/${repose.branch}" />
</then>
<else>
<gitcheckout repository="${repose.repository.path}" branchname="master" />
</else>
</if>
</else>
</if>
</target>
<target name="buildBasic">
<copy toDir="${repose.build.basic.path}" mode="0755">
<fileset refid="repose-libs"/>
<fileset refid="repose-misc"/>
</copy>
<chmod mode="0755">
<fileset dir="${repose.build.basic.path}">
<include name="*.php" />
<include name="README" />
<include name="LICENSE" />
</fileset>
</chmod>
</target>
<target name="build" depends="setProperties,update,cleanBuild,buildBasic" />
<target name="distBasic" depends="build">
<mkdir dir="${paths.dist}" />
<delete file="${repose.dist.basic.tgzfile}" />
<tar compression="gzip" destFile="${repose.dist.basic.tgzfile}" basedir="${repose.build.basic.path}" prefix="${repose.pkgname.basic}" />
<delete file="${repose.dist.basic.zipfile}" />
<zip destFile="${repose.dist.basic.zipfile}" basedir="${repose.build.basic.path}" prefix="${repose.pkgname.basic}/" />
</target>
<target name="dist" depends="distBasic" />
<target name="test">
<mkdir dir="${paths.logs}" />
<mkdir dir="${paths.reports}/coverage" />
<property name="coverage.database" value="${paths.logs}/coverage.db" />
<coverage-setup database="${coverage.database}">
<fileset dir="lib">
<include name="**/*.php" />
</fileset>
</coverage-setup>
<phpunit printsummary="true" codecoverage="true" haltonfailure="true">
<formatter todir="${paths.logs}" type="xml" />
<formatter todir="${paths.reports}/coverage" type="clover" />
<batchtest>
<fileset dir="${paths.tests}">
<include name="*Test.php" />
<exclude name="Abstract*" />
</fileset>
</batchtest>
</phpunit>
</target>
<target name="default" depends="version">
<echo>Repose PHP ORM - ${repose.version}</echo>
<echo />
<echo>Targets:</echo>
<echo> clean - Cleans build and dist</echo>
<echo> update - Updates build files</echo>
<echo> build - Builds package</echo>
<echo> dist - Creates distribution archives</echo>
<echo> test - Tests distribution archives</echo>
<echo />
<echo> realclean - Cleans everything</echo>
<echo />
<echo>Properties:</echo>
<echo> repose.tag - repose tag to use</echo>
<echo> repose.branch - repose branch to use</echo>
<echo> repose.version - repose version to use</echo>
<echo> repose.snapshotVersion - repose snapshot version to use (branches)</echo>
<echo> repose.repository.url - URL for repose Git Repository</echo>
</target>
</project>