Commits

Anonymous committed 18f316f

* Updated to build documentation better than before.

Comments (0)

Files changed (1)

Trunk/Scripts/Build/build.xml

 <?xml version="1.0" encoding="UTF-8"?>
-<project name="vchgbuild" default="main" basedir="../../"
-    description="Release and PEAR packaging build process for VersionControl_Hg">
+<project name="vchgbuild" default="main" basedir="../../"
+    description="Release and PEAR packaging build process for VersionControl_Hg">
 
-    <property name="docsdir" value="${project.basedir}/Documentation" />
-    <property name="sourcedir" value="${project.basedir}" override="true" />
-    <property name="codedir" value="${project.basedir}/VersionControl" />
+    <property name="rootdir" value="H:" />
+    <property name="docsdir" value="Documentation" />
+    <property name="sourcedir" value="/" override="true" />
+    <property name="codedir" value="VersionControl" />
+    <property name="unittestsdir" value="/Tests/Unit" />
 
-    <target name="main" description="Default target" depends=""></target>
+    <input propertyname="version">Which version tag are we deploying?</input>
 
-    <!-- clean -->
-     <target name="cleandocs" description="Clean build directory">
-         <!-- <delete dir="${docsdir}/Api" includeemptydirs="true" verbose="false" failonerror="false" /> -->
-     </target>
+    <taskdef classname="phing.tasks.ext.d51PearPkg2Task" name="d51pearpkg2" />
 
-     <target name="initdocs" description="Making documentation directory" depends="cleandocs">
-         <!--<mkdir dir="${docsdir}" />-->
-     </target>
+    <!--  -->
+    <target name="main" depends="quality,pear-package" description="">
+    </target>
 
-    <!-- build API docs in docbook -->
-    <target name="apidocs" description="Making API documentation" depends="initdocs">
-        <echo message="Cleaning out old API documentation..." />
+    <!--  -->
+    <target name="quality" depends="sniffs,copy-paste,mess-detector,lines-of-code,code-browser,metrics" description="">
+        <echo message="Generating all quality documentation" />
+    </target>
+
+    <!--  -->
+    <target name="pear-package" depends="deploy-to-release,create-package-xml,tar,post" description="">
+    </target>
+
+    <!-- Clean the Releases dir -->
+    <target name="clean-release-dir" description="Clean the Releases dir">
+        <!--  depends="" -->
+        <delete dir="${rootdir}/Releases/PEAR/" includeemptydirs="true" verbose="true" />
+    </target>
+
+    <!-- create the pear package skeleton structure -->
+    <target name="pear-structure" depends="clean-release-dir" description="Create the pear package skeleton structure">
+        <mkdir dir="${rootdir}/Releases/PEAR/VersionControl_Hg" />
+        <mkdir dir="${rootdir}/Releases/PEAR/VersionControl_Hg/tests" />
+        <mkdir dir="${rootdir}/Releases/PEAR/VersionControl_Hg/docs" />
+        <mkdir dir="${rootdir}/Releases/PEAR/VersionControl_Hg/docs/examples" />
+        <!--<mkdir dir="${rootdir}/Releases/PEAR/VersionControl_Hg/scripts" />-->
+        <!--<mkdir dir="${rootdir}/Releases/PEAR/VersionControl_Hg/misc" />-->
+        <!--<mkdir dir="${rootdir}/Releases/PEAR/VersionControl_Hg/data" />-->
+        <mkdir dir="${rootdir}/Releases/PEAR/VersionControl_Hg/VersionControl/" />
+    </target>
+
+    <target name="deploy-to-release" depends="pear-structure">
+        <copy todir="${rootdir}/Releases/PEAR/VersionControl_Hg/VersionControl/">
+            <fileset dir="VersionControl">
+                <include name="**/*.php" />
+            </fileset>
+        </copy>
+        <copy todir="${rootdir}/Releases/PEAR/VersionControl_Hg/docs">
+            <fileset dir="Documentation/API/Docbook">
+                <include name="**/*.xml" />
+            </fileset>
+        </copy>
+        <copy todir="${rootdir}/Releases/PEAR/VersionControl_Hg/docs/examples">
+            <mapper type="regexp" from="^(test_)(.*)\.php" to="\2.php"/>
+            <!--<mapper type="glob" from="test_*.php" to="*.php"/>-->
+            <fileset dir="Tests/Functional">
+                <include name="**/*.php" />
+            </fileset>
+        </copy>
+        <copy todir="${rootdir}/Releases/PEAR/VersionControl_Hg/tests/unit">
+            <fileset dir="Tests/Unit">
+                <include name="**/*.php" />
+            </fileset>
+            <filelist dir="Tests/" files="phpunit.xml" />
+        </copy>
+    </target>
+
+    <!--  -->
+    <target name="create-package-xml" depends="deploy-to-release" description="">
+        <d51pearpkg2 baseinstalldir="/" dir="${rootdir}/Releases/PEAR/VersionControl_Hg">
+            <name>VersionControl_Hg</name>
+            <summary>A Php5 interface to Mercurial repositories</summary>
+            <channel>pear.php.net</channel>
+            <description>VersionControl_Hg provides a fluid interface with natural semantics to allow Php programmers to interact with Mercurial repositories. An excellent use case is in checking out projects as part of a build process.</description>
+            <license uri="http://www.opensource.org/licenses/bsd-license.php">BSD</license>
+            <lead user="mgatto" name="Michael Gatto" email="mgatto@lisantra.com" />
+            <version release="${version}" api="${version}" />
+            <stability release="beta" api="beta" />
+            <notes>-</notes>
+            <dependencies>
+                <php minimum_version="5.2.0" />
+                <pear minimum_version="1.7.0" recommended_version="1.9.1" />
+            </dependencies>
+
+            <dirroles key="examples">doc</dirroles>
+            <dirroles key="docs">doc</dirroles>
+
+            <changelog version="0.3.0" api_version="0.3.0">
+                - Made it work again
+            </changelog>
+
+        </d51pearpkg2>
+
+        <!--<pearpkg2 name="VersionControl_Hg"
+            dir="${rootdir}/Releases/PEAR/VersionControl_Hg"
+            destFile="${rootdir}/Releases/PEAR/VersionControl_Hg/package.xml">
+
+            <fileset dir="${rootdir}/Releases/PEAR/VersionControl_Hg">
+                <include name="**" />
+            </fileset>
+
+            <option name="notes">Initial release for Proposal</option>
+
+            <option name="description">A Php5 interface to Mercurial repositories</option>
+            <option name="channel" value="pear.php.net" />
+            <option name="summary">VersionControl_Hg provides a fluid interface with natural semantics to allow Php programmers to interact with Mercurial repositories. An excellent use case is in checking out projects as part of a build process.</option>
+            <option name="version" value="0.3.0" />
+            <option name="state" value="beta" />
+            <option name="license" value="MIT" />
+
+            <option name="baseinstalldir" value="VersionControl" />
+            <option name="apiversion" value="0.3.0" />
+            <option name="apistability" value="beta" />
+            <option name="releaseversion" value="0.3.0" />
+            <option name="releasestability" value="beta" />
+            <option name="phpdep" value="5.2.0" />
+            <option name="pearinstallerdep" value="1.7.0" />
+            <option name="packagetype" value="php" />
+            <mapping name="maintainers">
+                <element>
+                    <element key="handle" value="mgatto" />
+                    <element key="name" value="Michael Gatto" />
+                    <element key="email" value="mgatto@lisantra.com" />
+                    <element key="role" value="lead" />
+                </element>
+            </mapping>
+        </pearpkg2>-->
+    </target>
+
+    <!--  -->
+    <target name="tar" depends="create-package-xml" description="">
+        <exec command="pear package" dir="${rootdir}/Releases/PEAR/VersionControl_Hg/" passthru="true" />
+    </target>
+
+    <target name="post" depends="tar" description="">
+        <move file="${rootdir}/Releases/PEAR/VersionControl_Hg/VersionControl_Hg-${version}.tgz" tofile="${rootdir}/Releases/VersionControl_Hg-${version}.tgz" overwrite="true" />
+        <phingcall target="clean-release-dir" />
+    </target>
+
+<!-- QUALITY tasks -->
+
+    <!-- runs unit tests on code in dev area, not the Releases folder (change?) -->
+    <target name="test" description="" depends="">
+        <exec command="phpunit --configuration ..\phpunit.xml ." dir="Tests/Unit" passthru="true" />
+        <!-- noframes  -->
+        <phpunitreport infile="${docsdir}/Quality/test-reports/junit-log.xml"
+            format="frames"
+            todir="${docsdir}/Quality/test-reports/html/"
+            styledir="C:\Languages\Php\data\phing\etc"
+            />
+        <!--<phpunit haltonfailure="true" haltonerror="true">
+          <formatter todir="${docsdir}/test-reports/" type="xml" />
+          <batchtest>
+            <fileset dir="Tests/Unit">
+              <include name="**/*Test*.php" />
+            </fileset>
+          </batchtest>
+        </phpunit>-->
+    </target>
+
+    <!-- Hmmm, very very spurious results; it seems not to handle magic functions well at all -->
+    <target name="dead-code">
+        <exec dir="${codedir}" command="phpdcd --recursive   --log ${builddir}/logs --source ${basedir}/${codedir} --output ${basedir}/${docsdir}/Code/" passthru="true"/>
+    </target>
+
+    <!-- run code-sniffs -->
+    <target name="sniffs">
+        <phpcodesniffer standard="PEAR">
+            <fileset dir="${codedir}">
+                <include name="**/*.php" />
+            </fileset>
+            <formatter type="summary" outfile="${docsdir}/code-sniffs/summary.txt" />
+            <formatter type="csv" outfile="${docsdir}/code-sniffs/checkstyle.csv" />
+            <formatter type="checkstyle" outfile="${docsdir}/code-sniffs/checkstyle.xml"/>
+        </phpcodesniffer>
+    </target>
+
+    <!-- Generate pmd-cpd.xml -->
+    <target name="copy-paste">
+        <phpcpd>
+            <fileset dir="${codedir}" id="files-to-cpd">
+                <include name="**/*.php" />
+            </fileset>
+            <formatter type="default" outfile="${docsdir}/copy-paste/summary.txt" />
+            <formatter type="pmd" outfile="${docsdir}/copy-paste/pmd-cpd.xml" />
+        </phpcpd>
+    </target>
+
+    <!-- Generate pmd.xml -->
+    <target name="mess-detector">
+        <phpmd>
+            <fileset dir="${codedir}">
+                <include name="**/*.php" />
+            </fileset>
+            <formatter type="html" outfile="${docsdir}/Quality/mess-detector/messes.html"/>
+            <formatter type="text" outfile="${docsdir}/Quality/mess-detector/summary.txt"/>
+            <formatter type="xml" outfile="${docsdir}/Quality/mess-detector/pmd.xml"/>
+        </phpmd>
+    </target>
+
+    <!-- Generate phploc.csv -->
+    <target name="lines-of-code">
+        <taskdef name="phploc" classname="phing.tasks.ext.PhpLocTask" />
+        <phploc reportType="txt" reportName="lines"
+            reportDirectory="${docsdir}/Quality/lines-of-code/" countTests="false" >
+            <fileset dir="${codedir}">
+                <include name="**/*.php" />
+            </fileset>
+        </phploc>
+    </target>
+
+    <!-- Generate browsable code -->
+    <target name="code-browser">
+        <exec command="phpcb --log ${docsdir}/phpcb.log --source ${basedir}/${codedir} --output ${basedir}/${docsdir}/Code/" passthru="true" />
+    </target>
+
+    <!-- pdepend -->
+    <target name="metrics">
+        <phpdepend>
+            <fileset dir="${codedir}">
+                <include name="**/*.php" />
+            </fileset>
+            <logger type="summary-xml" outfile="${docsdir}/Quality/metrics/summary.xml"/>
+            <logger type="phpunit-xml" outfile="${docsdir}/Quality/metrics/pdepend.xml"/>
+            <analyzer type="coderank-mode" value="method"/>
+        </phpdepend>
+    </target>
+
+    <target name="docs">
+        <echo msg="Cleaning docs dir" />
         <delete dir="${docsdir}/Api" includeemptydirs="true" verbose="false" failonerror="false" />
 
-        <mkdir dir="${docsdir}/API" />
+        <echo msg="Making docs dir" />
+        <mkdir dir="${docsdir}" />
         <mkdir dir="${docsdir}/API/Docbook" />
         <mkdir dir="${docsdir}/API/Html" />
 
-        <echo message="Making Docbook..." />
-        <!--<exec command="" dir="${codedir}" />-->
-        <exec command="phpdoc -d V:\Development\_Webroot\Trunk\VersionControl -t V:\Development\_Webroot\Trunk\Documentation\API\Docbook -o XML:DocBook/peardoc2:default" escape="false" />
+        <exec command="phpdoc --title VersionControl_Hg --parseprivate on -d H:\Development\_Webroot\Trunk\VersionControl -t H:\Development\_Webroot\Trunk\Documentation\API\Docbook -o XML:DocBook/peardoc2:default" escape="false" />
 
         <echo message="Making Html..." />
-        <exec command="phpdoc -d V:\Development\_Webroot\Trunk\VersionControl -t V:\Development\_Webroot\Trunk\Documentation\API\Html -o HTML:frames:default" escape="false" />
+        <exec command="phpdoc --title VersionControl_Hg --parseprivate on -d H:\Development\_Webroot\Trunk\VersionControl -t H:\Development\_Webroot\Trunk\Documentation\API\Html -o HTML:frames:default" escape="false" />
     </target>
-
-    <!-- run codesniffs -->
-    <!-- build benchmarks -->
-    <!-- transform manual with TypeFreindly -->
-    <!-- run code coverage -->
-    <target name="coverage" description="" depends="">
-        <exec command="phpunit --coverage-clover ${docsdir}/Testing/coverage.xml ./" />
-    </target>
-
-    <!-- commit new docs to Hg? -->
-    <!-- build pear package -->
-</project>
+
+</project>