Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

291 lines (260 sloc) 10.559 kb
<?xml version="1.0" ?>
<project name="kohana" default="help">
<property environment="env"/>
<property name="basedir" value="${project.basedir}"/>
<property name="builddir" value="${basedir}/build"/>
<property name="branch" value="3.2/develop"/>
<property name="submodules" value="system,modules/auth,modules/cache,modules/codebench,modules/database,modules/image,modules/orm,modules/unittest,modules/userguide"/>
<!-- Shows the help message -->
<target name="help">
<echo message="General Targets"/>
<echo message="==============="/>
<echo message="phing test Run unit tests."/>
<echo message="phing test-log Run unit tests with logging enabled."/>
<echo message="phing phpcs Run phpcs."/>
<echo message="phing phpcs-log Run phpcs with logging enabled."/>
<echo message="phing phpmd Run phpmd."/>
<echo message="phing phpmd-log Run phpmd with logging enabled."/>
<echo message="phing phpcpd-log Run phpcpd with logging enabled."/>
<echo message="phing pdepend-log Run pdepend with logging enabled."/>
<echo message="phing phpcb-log Run phpcb with logging enabled."/>
<echo message=""/>
<echo message="Kohana Developer Targets"/>
<echo message="========================"/>
<echo message="phing dev-setup Setup for development on Kohana itself."/>
<echo message="phing git-status Show the git status of each submodule."/>
<echo message="phing git-checkout Checkout a branch accross all submodules."/>
<echo message="phing git-pull Perform a pull for each submodule."/>
<echo message="phing git-push Perform a push for each submodule."/>
<echo message=""/>
<echo message="Misc Targets"/>
<echo message="============"/>
<echo message="phing ci Alias task for continuous integration servers"/>
<echo message="phing dist Build a release .zip"/>
</target>
<!-- Clean up -->
<target name="clean">
<delete dir="${builddir}"/>
<!-- Create build directories -->
<mkdir dir="${builddir}/coverage"/>
<mkdir dir="${builddir}/logs"/>
<mkdir dir="${builddir}/release"/>
<mkdir dir="${builddir}/code-browser"/>
</target>
<target name="dev-setup">
<property name="git-checkout-branch" value="${branch}"/> <!-- Prevents git-checkout asking for a branch name -->
<exec command="git submodule update --init --recursive" dir="${basedir}" />
<phingcall target="_dev-setup-remotes" />
<phingcall target="git-pull" />
<phingcall target="git-checkout" />
</target>
<target name="git-pull">
<phingcall target="_git-pull">
<property name="dir" value="." />
</phingcall>
<foreach list="${submodules}" param="dir" target="_git-pull"/>
</target>
<target name="_git-pull">
<exec command="git pull dev" dir="${dir}"/>
</target>
<target name="git-checkout">
<if>
<not>
<isset property="git-checkout-branch"/>
</not>
<then>
<propertyprompt propertyName="git-checkout-branch" defaultValue="${branch}" promptText="Branch name:" />
</then>
</if>
<phingcall target="_git-checkout">
<property name="dir" value="." />
</phingcall>
<foreach list="${submodules}" param="dir" target="_git-checkout"/>
</target>
<target name="_git-checkout">
<exec returnProperty="git-checkout-branch-exists" command="git show-ref --quiet --verify -- 'refs/remotes/dev/${git-checkout-branch}'" dir="${dir}" passthru="true"/>
<if>
<equals arg1="${git-checkout-branch-exists}" arg2="0"/>
<then>
<exec command="git checkout --track -b ${git-checkout-branch} dev/${git-checkout-branch}" dir="${dir}" passthru="true"/>
</then>
<else>
<exec command="git checkout -b ${git-checkout-branch}" dir="${dir}" passthru="true"/>
</else>
</if>
</target>
<target name="git-push">
<foreach list="${submodules}" param="dir" target="_git-push"/>
<phingcall target="_git-push">
<property name="dir" value="." />
</phingcall>
</target>
<target name="_git-push">
<exec command="git push dev" dir="${dir}" passthru="true"/>
</target>
<target name="git-status">
<foreach list="${submodules}" param="dir" target="_git-status"/>
<phingcall target="_git-status">
<property name="dir" value="." />
</phingcall>
</target>
<target name="_git-status">
<exec command="git status" dir="${dir}" passthru="true"/>
</target>
<target name="_dev-setup-remotes">
<!-- TODO: Clean up... -->
<phingcall target="_dev-setup-remote">
<property name="repository" value="git@github.com:kohana/kohana.git" />
<property name="dir" value="${basedir}" />
</phingcall>
<phingcall target="_dev-setup-remote">
<property name="repository" value="git@github.com:kohana/core.git" />
<property name="dir" value="${basedir}/system" />
</phingcall>
<phingcall target="_dev-setup-remote">
<property name="repository" value="git@github.com:kohana/auth.git" />
<property name="dir" value="${basedir}/modules/auth" />
</phingcall>
<phingcall target="_dev-setup-remote">
<property name="repository" value="git@github.com:kohana/cache.git" />
<property name="dir" value="${basedir}/modules/cache" />
</phingcall>
<phingcall target="_dev-setup-remote">
<property name="repository" value="git@github.com:kohana/codebench.git" />
<property name="dir" value="${basedir}/modules/codebench" />
</phingcall>
<phingcall target="_dev-setup-remote">
<property name="repository" value="git@github.com:kohana/database.git" />
<property name="dir" value="${basedir}/modules/database" />
</phingcall>
<phingcall target="_dev-setup-remote">
<property name="repository" value="git@github.com:kohana/image.git" />
<property name="dir" value="${basedir}/modules/image" />
</phingcall>
<phingcall target="_dev-setup-remote">
<property name="repository" value="git@github.com:kohana/orm.git" />
<property name="dir" value="${basedir}/modules/orm" />
</phingcall>
<phingcall target="_dev-setup-remote">
<property name="repository" value="git@github.com:kohana/unittest.git" />
<property name="dir" value="${basedir}/modules/unittest" />
</phingcall>
<phingcall target="_dev-setup-remote">
<property name="repository" value="git@github.com:kohana/userguide.git" />
<property name="dir" value="${basedir}/modules/userguide" />
</phingcall>
</target>
<target name="_dev-setup-remote">
<exec command="git remote rm dev" dir="${dir}"/>
<exec command="git remote add dev ${repository}" dir="${dir}"/>
</target>
<!-- Run unit tests -->
<target name="test">
<exec command="phpunit --bootstrap=modules/unittest/bootstrap_all_modules.php modules/unittest/tests.php" checkreturn="true" passthru="true"/>
</target>
<!-- Run unit tests and generate junit.xml and clover.xml -->
<target name="test-log">
<exec command="phpunit --bootstrap=modules/unittest/bootstrap_all_modules.php --coverage-html=${builddir}/coverage --log-junit=${builddir}/logs/junit.xml --coverage-clover=${builddir}/logs/clover.xml modules/unittest/tests.php" checkreturn="true" passthru="true"/>
</target>
<!-- Run PHP Code Sniffer -->
<target name="phpcs">
<phpcodesniffer standard="Kohana" showSniffs="true" showWarnings="true">
<fileset dir="${basedir}">
<include name="**/*.php" />
<exclude name="**/vendor/**" />
<exclude name="**/tests/**" />
</fileset>
<formatter type="default" usefile="false"/>
</phpcodesniffer>
</target>
<!-- Run PHP Code Sniffer and generate checkstyle.xml -->
<target name="phpcs-log">
<phpcodesniffer standard="Kohana" showSniffs="true" showWarnings="true">
<fileset dir="${basedir}">
<include name="**/*.php" />
<exclude name="**/vendor/**" />
<exclude name="**/tests/**" />
</fileset>
<formatter type="default" usefile="false"/>
<formatter type="checkstyle" outfile="${builddir}/logs/checkstyle.xml"/>
</phpcodesniffer>
</target>
<!-- Run PHP Mess Detector -->
<target name="phpmd">
<exec command="phpmd ${basedir} text codesize,unusedcode --exclude=**/vendor/**" passthru="true"/>
</target>
<!-- Run PHP Mess Detector and generate pmd.xml -->
<target name="phpmd-log">
<exec command="phpmd ${basedir} xml codesize,unusedcode --exclude=**/vendor/** --reportfile ${builddir}/logs/pmd.xml" passthru="true"/>
</target>
<!-- Run PHP Copy/Paste Detector and generate pmd.xml -->
<target name="phpcpd-log">
<phpcpd>
<fileset dir="${basedir}">
<include name="**/*.php" />
<exclude name="**/vendor/**" />
</fileset>
<formatter type="pmd" outfile="${builddir}/logs/pmd-cpd.xml"/>
</phpcpd>
</target>
<!-- Run PHP Depend and generate jdepend.xml -->
<target name="pdepend-log">
<phpdepend>
<fileset dir="${basedir}">
<include name="**/*.php" />
<exclude name="**/vendor/**" />
</fileset>
<logger type="jdepend-xml" outfile="${builddir}/logs/jdepend.xml"/>
<!--<analyzer type="coderank-mode" value="method"/>-->
</phpdepend>
</target>
<!-- Run PHP CodeBrowser and generate output -->
<target name="phpcb-log">
<exec command="phpcb --exclude=${builddir}/** --log=${builddir}/logs --source=${basedir} --output=${builddir}/code-browser" passthru="true"/>
</target>
<!-- Build a release .zip -->
<target name="dist">
<!-- Pick an appropriate dist filename -->
<if>
<isset property="dist.filename" />
<else>
<if>
<and>
<!-- basically - are we running inside hudson? -->
<isset property="env.BUILD_NUMBER" />
<isset property="env.JOB_NAME" />
</and>
<then>
<property name="dist.filename" value="${env.JOB_NAME}-${env.BUILD_NUMBER}" />
</then>
<else>
<property name="dist.filename" value="kohana" />
</else>
</if>
</else>
</if>
<zip destfile="${builddir}/${dist.filename}.zip" prefix="${dist.filename}/">
<fileset dir="${basedir}">
<include name="**/**"/>
<!-- Build Files -->
<exclude name="*.zip" />
<exclude name="build/**" />
<!-- Dev Files -->
<exclude name="build.xml" />
<exclude name="phpunit.xml" />
<!-- SCM Files -->
<exclude name="**/.git/**" />
<exclude name="**/.git*" />
</fileset>
</zip>
</target>
<!-- Hudson CI target -->
<target name="ci" depends="clean">
<phingcall target="test-log"/>
<phingcall target="pdepend-log"/>
<phingcall target="phpmd-log"/>
<phingcall target="phpcpd-log"/>
<phingcall target="phpcs-log"/>
<phingcall target="phpcb-log"/>
</target>
</project>
Jump to Line
Something went wrong with that request. Please try again.