<?xml version="1.0" encoding="UTF-8"?>
<project name="App.EduResourceCenter" default="codesniffer" description="??????????">
<property name="project.version" value="0.1.0" />
<property name="project.profile" value="development" />
<!--
Target: profile
Description: ????profile?????development????phing?????profile??
profile????????development?test?production.
Example: phing target -Dprofile=production
-->
<target name="profile">
<echo msg="Project profile : ${profile}" />
<if>
<isset property="profile" />
<then>
<property name="project.profile" value="${profile}" override="true" />
</then>
</if>
<echo message="Project profile : ${project.profile}" />
</target>
<!--
Target: prepare
Description: ????????????????????????????????
-->
<target name="prepare" depends="profile">
<echo msg="Making directory build" />
<svnlastrevision workingcopy="${phing.dir}" propertyname="svn.lastrevision"/>
<!--<delete dir="build" />-->
<delete dir="build/dist" />
<delete dir="build/reports" />
<mkdir dir="build" />
<mkdir dir="build/dist" />
<mkdir dir="build/reports" />
</target>
<!--
Target: config
Description: ??http???superdiamond????????????
development profile ???????Application/Common/Conf/user-config.php????ThinkPHP 3.2?
test & production profile ???????build/user-config.php???????build target??
??build/user-config.php???build/Application/Common/Conf/user-config.php??
-->
<target name="config" depends="profile">
<if>
<equals arg1="development" arg2="${project.profile}" trim="true" />
<then>
<httpget url="http://172.16.81.73:8001/superdiamond/preview/App.EduSNS/${project.profile}?format=php"
dir="Application/Common/Conf" filename="user-config.php" />
</then>
<else>
<httpget url="http://172.16.81.73:8001/superdiamond/preview/App.EduSNS/${project.profile}?format=php"
dir="build" filename="user-config.php" />
</else>
</if>
</target>
<!--
Target: build
Description: ??????????build???
-->
<target name="build" depends="prepare">
<echo msg="Copying files to build directory..." />
<copy file="index.php" tofile="build/index.php" />
<copy todir="build/Application">
<fileset dir="Application"/>
</copy>
<copy todir="build/Public">
<fileset dir="Public"/>
</copy>
<copy todir="build/ThinkPHP">
<fileset dir="ThinkPHP"/>
</copy>
<copy todir="build/vendor">
<fileset dir="vendor">
<exclude name="**/tests/**" />
<exclude name="**/Tests/**" />
<exclude name="**/doc/**" />
<exclude name="phpunit/**" />
</fileset>
</copy>
<if>
<not>
<equals arg1="development" arg2="${project.profile}" trim="true" />
</not>
<then>
<move file="build/user-config.php" todir="Application/Common/Conf" />
</then>
</if>
</target>
<!--
Target: prepare
Description: ??jsmin??js???????build????
-->
<target name="jsmin">
<jsmin targetDir="build/Public" failOnError="true" suffix="">
<fileset dir="Public">
<include name="**/*.js"/>
<exclude name="_static/**" />
</fileset>
</jsmin>
</target>
<!--
Target: composer
Description: composer????????????composer install?????composer update?
-->
<target name="composer">
<condition property="checkComposerLockIsExists">
<and>
<available file="composer.lock" />
</and>
</condition>
<if>
<equals arg1="${checkComposerLockIsExists}" arg2="yes" />
<then>
<echo message="??composer update" />
<exec command="composer update" logoutput="true" />
</then>
<else>
<echo message="??composer instll" />
<exec command="composer install"/>
</else>
</if>
</target>
<!--
Target: codesniffer
Description: ??????????IflyPSR2???
-->
<target name="codesniffer">
<echo msg="Executing codesniffer..." />
<phpcodesniffer
haltonerror="true"
showWarnings="false"
noSubdirectories="true"
standard="IflyPSR2"
verbosity="1"
tabWidth="4"
>
<formatter outfile="build/reports/codesniffer.txt" type="full" />
<fileset dir="${project.basedir}">
<include name="Application/**/*.php"/>
</fileset>
</phpcodesniffer>
</target>
<!--
Target: phpmd
Description: ????????
-->
<target name="phpmd">
<phpmd file="Application">
<formatter type="html" outfile="build/reports/phpmd.html"/>
</phpmd>
</target>
<!--
Target: check
Description: ????codesniffer ? phpmd target
-->
<target name="check" depends="prepare" description="????">
<phingcall target="phpmd" />
<phingcall target="codesniffer" />
</target>
<!--
Target: check
Description: ????????????????????
${phing.project.name}-${project.version}-build${svn.lastrevision}.tar.gz
-->
<target name="dist" depends="prepare, config, build, jsmin">
<echo msg="Creating archive..." />
<tar destfile="build/dist/${phing.project.name}-${project.version}-build${svn.lastrevision}.tar.gz" compression="gzip">
<fileset dir="build">
<include name="*" />
<exclude name="reports" />
<exclude name="dist" />
</fileset>
</tar>
<filehash
file="build/dist/${phing.project.name}-${project.version}-build${svn.lastrevision}.tar.gz"
hashtype="1"
propertyname="hash" />
<echo msg="SHA1 Digest = ${hash}" />
</target>
</project>
|