1 <project name="kohana" default="test" basedir=".">
6 Build a release.zip from a tag.
7 $ TAG=3.0.8 ant release-tag
9 Update submodules and push back. This won't affect your local clone.
10 $ ant update-submodules
15 Run unit tests with logging enabled
19 <property environment="env"/>
20 <property name="repo" value="git@github.com:kohana/kohana.git"/>
21 <property name="branch" value="3.0.x"/>
22 <property name="tag" value="${env.TAG}"/>
23 <!-- Used by update-submodules2 - not update-submodules -->
24 <property name="submodules" value="system,modules/auth,modules/cache,modules/codebench,modules/database,modules/image,modules/oauth,modules/orm,modules/pagination,modules/unittest,modules/userguide"/>
25 <property name="release-excludes" value="**/.git,**/.git*,build.xml,phpunit.xml,DEVELOPERS.md,phpunitcc,code_coverage.xml,release-tag,TESTING.md,**/tests"/>
29 <delete dir="${basedir}/build"/>
30 <!-- Create build directories -->
31 <mkdir dir="${basedir}/build/coverage"/>
32 <mkdir dir="${basedir}/build/logs"/>
33 <mkdir dir="${basedir}/build/release"/>
36 <!-- Run unit tests -->
37 <target name="phpunit">
38 <exec executable="phpunit" failonerror="true"/>
41 <!-- Run unit tests and generate junit.xml and clover.xml -->
42 <target name="phpunit-log">
43 <exec executable="phpunit" failonerror="true">
44 <arg line="--coverage-html=${basedir}/build/coverage"/>
45 <arg line="--log-junit=${basedir}/build/logs/junit.xml"/>
46 <arg line="--coverage-clover=${basedir}/build/logs/clover.xml"/>
50 <!-- Update submodules -->
51 <target name="update-submodules" depends="clean,clone-branch">
53 <exec executable="git" failonerror="true" dir="${basedir}/build/release/kohana-${branch}/system">
54 <arg line="checkout 3.0.x"/>
56 <exec executable="git" failonerror="true" dir="${basedir}/build/release/kohana-${branch}/system">
60 <exec executable="git" failonerror="true" dir="${basedir}/build/release/kohana-${branch}/modules/auth">
61 <arg line="checkout master"/>
63 <exec executable="git" failonerror="true" dir="${basedir}/build/release/kohana-${branch}/modules/auth">
67 <exec executable="git" failonerror="true" dir="${basedir}/build/release/kohana-${branch}/modules/cache">
68 <arg line="checkout master"/>
70 <exec executable="git" failonerror="true" dir="${basedir}/build/release/kohana-${branch}/modules/cache">
74 <exec executable="git" failonerror="true" dir="${basedir}/build/release/kohana-${branch}/modules/codebench">
75 <arg line="checkout master"/>
77 <exec executable="git" failonerror="true" dir="${basedir}/build/release/kohana-${branch}/modules/codebench">
81 <exec executable="git" failonerror="true" dir="${basedir}/build/release/kohana-${branch}/modules/database">
82 <arg line="checkout master"/>
84 <exec executable="git" failonerror="true" dir="${basedir}/build/release/kohana-${branch}/modules/database">
88 <exec executable="git" failonerror="true" dir="${basedir}/build/release/kohana-${branch}/modules/image">
89 <arg line="checkout master"/>
91 <exec executable="git" failonerror="true" dir="${basedir}/build/release/kohana-${branch}/modules/image">
95 <exec executable="git" failonerror="true" dir="${basedir}/build/release/kohana-${branch}/modules/oauth">
96 <arg line="checkout master"/>
98 <exec executable="git" failonerror="true" dir="${basedir}/build/release/kohana-${branch}/modules/oauth">
102 <exec executable="git" failonerror="true" dir="${basedir}/build/release/kohana-${branch}/modules/orm">
103 <arg line="checkout master"/>
105 <exec executable="git" failonerror="true" dir="${basedir}/build/release/kohana-${branch}/modules/orm">
109 <exec executable="git" failonerror="true" dir="${basedir}/build/release/kohana-${branch}/modules/pagination">
110 <arg line="checkout master"/>
112 <exec executable="git" failonerror="true" dir="${basedir}/build/release/kohana-${branch}/modules/pagination">
116 <exec executable="git" failonerror="true" dir="${basedir}/build/release/kohana-${branch}/modules/unittest">
117 <arg line="checkout 3.0.x"/>
119 <exec executable="git" failonerror="true" dir="${basedir}/build/release/kohana-${branch}/modules/unittest">
123 <exec executable="git" failonerror="true" dir="${basedir}/build/release/kohana-${branch}/modules/userguide">
124 <arg line="checkout master"/>
126 <exec executable="git" failonerror="true" dir="${basedir}/build/release/kohana-${branch}/modules/userguide">
130 <!-- Commit and Push -->
131 <exec executable="git" failonerror="true" dir="${basedir}/build/release/kohana-${branch}">
132 <arg line="commit -a -m 'Updating submodules'"/>
134 <exec executable="git" failonerror="true" dir="${basedir}/build/release/kohana-${branch}">
139 <!-- Update submodules - For when we sort out the submodule branch names -->
140 <target name="update-submodules2" depends="clean,clone-branch">
141 <for list="${submodules}" param="submodule">
143 <exec executable="git" failonerror="true" dir="${basedir}/build/release/kohana-${branch}/${submodule}">
144 <arg line="checkout ${branch}"/>
146 <exec executable="git" failonerror="true" dir="${basedir}/build/release/kohana-${branch}/${submodule}">
152 <!-- Commit and Push -->
153 <exec executable="git" failonerror="true" dir="${basedir}/build/release/kohana-${branch}">
154 <arg line="commit -a -m 'Updating submodules'"/>
156 <exec executable="git" failonerror="true" dir="${basedir}/build/release/kohana-${branch}">
161 <!-- Check if a specific tag exists -->
162 <target name="tag-exists">
163 <echo message="TODO: Check if tag (${tag}) exists."/>
166 <!-- Clone a specific tag -->
167 <target name="clone-tag">
168 <exec executable="git" failonerror="true" dir="${basedir}/build/release">
169 <arg line="clone ${repo} kohana-${tag}"/>
171 <exec executable="git" failonerror="true" dir="${basedir}/build/release/kohana-${tag}">
172 <arg line="checkout ${tag}"/>
174 <exec executable="git" failonerror="true" dir="${basedir}/build/release/kohana-${tag}">
175 <arg line="submodule update --init --recursive"/>
179 <!-- Clone a specific branch -->
180 <target name="clone-branch">
181 <exec executable="git" failonerror="true" dir="${basedir}/build/release">
182 <arg line="clone ${repo} kohana-${branch}"/>
184 <exec executable="git" failonerror="true" dir="${basedir}/build/release/kohana-${branch}">
185 <arg line="checkout ${branch}"/>
187 <exec executable="git" failonerror="true" dir="${basedir}/build/release/kohana-${branch}">
188 <arg line="submodule update --init --recursive"/>
192 <!-- Build a release of a specific tag -->
193 <target name="release-tag" depends="clean,tag-exists,clone-tag,test-tag">
194 <zip destfile="${basedir}/build/kohana-${tag}.zip">
195 <fileset dir="${basedir}/build/release" excludes="${release-excludes}"/>
199 <target name="test-tag">
200 <exec executable="phpunit" failonerror="true" dir="${basedir}/build/release/kohana-${tag}"/>
203 <target name="test-branch">
204 <exec executable="phpunit" failonerror="true" dir="${basedir}/build/release/kohana-${branch}"/>
207 <target name="test" depends="clean,phpunit"/>
208 <target name="test-log" depends="clean,phpunit-log"/>