Add the configuration templates for the Hudson continuous integration setup.
authorGunnar Wrobel <p@rdus.de>
Wed, 25 Aug 2010 07:08:57 +0000 (09:08 +0200)
committerGunnar Wrobel <p@rdus.de>
Wed, 25 Aug 2010 07:08:57 +0000 (09:08 +0200)
framework/Element/data/hudson-element-build.xml.template [new file with mode: 0644]
framework/Element/data/hudson-element-config.xml.template [new file with mode: 0644]
framework/Element/data/hudson-element-phpunit.xml.template [new file with mode: 0644]
framework/Element/lib/Horde/Element/Constants.php [new file with mode: 0644]
framework/Element/package.xml

diff --git a/framework/Element/data/hudson-element-build.xml.template b/framework/Element/data/hudson-element-build.xml.template
new file mode 100644 (file)
index 0000000..de25c10
--- /dev/null
@@ -0,0 +1,90 @@
+<project name="Kolab_Config" default="build" basedir=".">
+ <property name="tooldir" location="${basedir}/../../%1$s"/>
+
+ <target name="clean">
+  <!-- Clean up -->
+  <delete dir="build"/>
+
+  <!-- Create build directories -->
+  <mkdir dir="${basedir}/build/api"/>
+  <mkdir dir="${basedir}/build/code-browser"/>
+  <mkdir dir="${basedir}/build/coverage"/>
+  <mkdir dir="${basedir}/build/logs"/>
+  <mkdir dir="${basedir}/build/pdepend"/>
+ </target>
+
+ <!-- Run unit tests and generate junit.xml and clover.xml -->
+ <target name="phpunit">
+  <exec executable="php" failonerror="true">
+    <arg line="-c php.ini ${tooldir}/phpunit" />
+  </exec>
+ </target>
+
+ <!-- Run pdepend, phpmd, phpcpd, and phpcs in parallel -->
+ <target name="parallelTasks">
+  <parallel>
+   <antcall target="pdepend"/>
+   <antcall target="phpmd"/>
+   <antcall target="phpcpd"/>
+   <antcall target="phpcs"/>
+   <antcall target="phpdoc"/>
+  </parallel>
+ </target>
+
+ <!-- Generate jdepend.xml and software metrics charts -->
+ <target name="pdepend">
+  <exec executable="php">
+   <arg line="-c php.ini ${tooldir}/pdepend
+              --jdepend-xml=${basedir}/build/logs/jdepend.xml
+              --jdepend-chart=${basedir}/build/pdepend/dependencies.svg
+              --overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg
+              lib" />
+  </exec>
+ </target>
+
+ <!-- Generate pmd.xml -->
+ <target name="phpmd">
+  <exec executable="php">
+   <arg line="-c php.ini ${tooldir}/phpmd
+              lib xml codesize,unusedcode --reportfile ${basedir}/build/logs/pmd.xml" />
+  </exec>
+ </target>
+
+ <!-- Generate pmd-cpd.xml -->
+ <target name="phpcpd">
+  <exec executable="php">
+   <arg line="-c php.ini ${tooldir}/phpcpd
+              --log-pmd ${basedir}/build/logs/pmd-cpd.xml lib" />
+  </exec>
+ </target>
+
+ <!-- Generate checkstyle.xml -->
+ <target name="phpcs">
+  <exec executable="php" output="/dev/null">
+   <arg line="-c php.ini ${tooldir}/phpcs
+              --report=checkstyle
+              --report-file=${basedir}/build/logs/checkstyle.xml
+              --standard=PEAR
+              lib" />
+  </exec>
+ </target>
+
+ <!-- Generate API documentation -->
+ <target name="phpdoc">
+  <exec executable="php">
+   <arg line="-c php.ini ${tooldir}/phpdoc --
+              -d lib -t build/api" />
+  </exec>
+ </target>
+
+ <target name="phpcb">
+  <exec executable="php">
+   <arg line="-c php.ini ${tooldir}/phpcb
+              --log=${basedir}/build/logs
+              --source=${basedir}/lib
+              --output=${basedir}/build/code-browser" />
+  </exec>
+ </target>
+
+ <target name="build" depends="clean,pdepend,phpcpd,phpcs,phpdoc,phpmd,phpunit,phpcb"/>
+</project>
diff --git a/framework/Element/data/hudson-element-config.xml.template b/framework/Element/data/hudson-element-config.xml.template
new file mode 100644 (file)
index 0000000..68a62d6
--- /dev/null
@@ -0,0 +1,260 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<project>
+  <actions/>
+  <description>%4$s</description>
+  <logRotator>
+    <daysToKeep>5</daysToKeep>
+    <numToKeep>10</numToKeep>
+    <artifactDaysToKeep>-1</artifactDaysToKeep>
+    <artifactNumToKeep>-1</artifactNumToKeep>
+  </logRotator>
+  <keepDependencies>false</keepDependencies>
+  <properties/>
+  <scm class="hudson.scm.NullSCM"/>
+  <canRoam>true</canRoam>
+  <disabled>false</disabled>
+  <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
+  <triggers class="vector"/>
+  <concurrentBuild>false</concurrentBuild>
+  <builders>
+    <hudson.tasks.Shell>
+      <command>cp -r ${WORKSPACE}/../../%2$s/workspace/%1$s/* ${WORKSPACE}/
+echo &quot;include_path = \&quot;.:${WORKSPACE}/lib:${WORKSPACE}/deps/pear/php:${WORKSPACE}/../../%3$s/php\&quot;&quot; &gt; ${WORKSPACE}/php.ini
+php -c php.ini ../../%3$s/horde-element --install=${WORKSPACE}/deps ../../%2$s/workspace/%1$s
+php -c php.ini ../../%3$s/horde-element --ciprebuild=${WORKSPACE} ../../%2$s/workspace/%1$s</command>
+    </hudson.tasks.Shell>
+    <hudson.tasks.Ant>
+      <targets></targets>
+    </hudson.tasks.Ant>
+  </builders>
+  <publishers>
+    <hudson.plugins.pmd.PmdPublisher>
+      <threshold></threshold>
+      <newThreshold></newThreshold>
+      <failureThreshold></failureThreshold>
+      <newFailureThreshold></newFailureThreshold>
+      <healthy></healthy>
+      <unHealthy></unHealthy>
+      <pluginName>[PMD] </pluginName>
+      <thresholdLimit>low</thresholdLimit>
+      <defaultEncoding></defaultEncoding>
+      <useDeltaValues>false</useDeltaValues>
+      <canRunOnFailed>false</canRunOnFailed>
+      <pattern>build/logs/pmd.xml</pattern>
+    </hudson.plugins.pmd.PmdPublisher>
+    <hudson.plugins.checkstyle.CheckStylePublisher>
+      <threshold></threshold>
+      <newThreshold></newThreshold>
+      <failureThreshold></failureThreshold>
+      <newFailureThreshold></newFailureThreshold>
+      <healthy></healthy>
+      <unHealthy></unHealthy>
+      <pluginName>[CHECKSTYLE] </pluginName>
+      <thresholdLimit>low</thresholdLimit>
+      <defaultEncoding></defaultEncoding>
+      <useDeltaValues>false</useDeltaValues>
+      <canRunOnFailed>false</canRunOnFailed>
+      <pattern>build/logs/checkstyle.xml</pattern>
+    </hudson.plugins.checkstyle.CheckStylePublisher>
+    <hudson.plugins.dry.DryPublisher>
+      <threshold></threshold>
+      <newThreshold></newThreshold>
+      <failureThreshold></failureThreshold>
+      <newFailureThreshold></newFailureThreshold>
+      <healthy></healthy>
+      <unHealthy></unHealthy>
+      <pluginName>[DRY] </pluginName>
+      <thresholdLimit>low</thresholdLimit>
+      <defaultEncoding></defaultEncoding>
+      <useDeltaValues>false</useDeltaValues>
+      <canRunOnFailed>false</canRunOnFailed>
+      <pattern>build/logs/pmd-cpd.xml</pattern>
+      <highThreshold>50</highThreshold>
+      <normalThreshold>25</normalThreshold>
+    </hudson.plugins.dry.DryPublisher>
+    <hudson.plugins.jdepend.JDependRecorder>
+      <configuredJDependFile>build/logs/jdepend.xml</configuredJDependFile>
+    </hudson.plugins.jdepend.JDependRecorder>
+    <hudson.plugins.clover.CloverPublisher>
+      <cloverReportDir>build/logs</cloverReportDir>
+      <cloverReportFileName>clover.xml</cloverReportFileName>
+      <healthyTarget>
+        <methodCoverage>70</methodCoverage>
+        <conditionalCoverage>80</conditionalCoverage>
+        <statementCoverage>80</statementCoverage>
+      </healthyTarget>
+      <unhealthyTarget/>
+      <failingTarget/>
+    </hudson.plugins.clover.CloverPublisher>
+    <hudson.plugins.violations.ViolationsPublisher>
+      <config>
+        <suppressions class="tree-set">
+          <no-comparator/>
+        </suppressions>
+        <typeConfigs>
+          <no-comparator/>
+          <entry>
+            <string>checkstyle</string>
+            <hudson.plugins.violations.TypeConfig>
+              <type>checkstyle</type>
+              <min>10</min>
+              <max>999</max>
+              <unstable>999</unstable>
+              <usePattern>false</usePattern>
+              <pattern>build/logs/checkstyle.xml</pattern>
+            </hudson.plugins.violations.TypeConfig>
+          </entry>
+          <entry>
+            <string>cpd</string>
+            <hudson.plugins.violations.TypeConfig>
+              <type>cpd</type>
+              <min>10</min>
+              <max>999</max>
+              <unstable>999</unstable>
+              <usePattern>false</usePattern>
+              <pattern>build/logs/pmd-cpd.xml</pattern>
+            </hudson.plugins.violations.TypeConfig>
+          </entry>
+          <entry>
+            <string>findbugs</string>
+            <hudson.plugins.violations.TypeConfig>
+              <type>findbugs</type>
+              <min>10</min>
+              <max>999</max>
+              <unstable>999</unstable>
+              <usePattern>false</usePattern>
+              <pattern></pattern>
+            </hudson.plugins.violations.TypeConfig>
+          </entry>
+          <entry>
+            <string>fxcop</string>
+            <hudson.plugins.violations.TypeConfig>
+              <type>fxcop</type>
+              <min>10</min>
+              <max>999</max>
+              <unstable>999</unstable>
+              <usePattern>false</usePattern>
+              <pattern></pattern>
+            </hudson.plugins.violations.TypeConfig>
+          </entry>
+          <entry>
+            <string>gendarme</string>
+            <hudson.plugins.violations.TypeConfig>
+              <type>gendarme</type>
+              <min>10</min>
+              <max>999</max>
+              <unstable>999</unstable>
+              <usePattern>false</usePattern>
+              <pattern></pattern>
+            </hudson.plugins.violations.TypeConfig>
+          </entry>
+          <entry>
+            <string>jcreport</string>
+            <hudson.plugins.violations.TypeConfig>
+              <type>jcreport</type>
+              <min>10</min>
+              <max>999</max>
+              <unstable>999</unstable>
+              <usePattern>false</usePattern>
+              <pattern></pattern>
+            </hudson.plugins.violations.TypeConfig>
+          </entry>
+          <entry>
+            <string>jslint</string>
+            <hudson.plugins.violations.TypeConfig>
+              <type>jslint</type>
+              <min>10</min>
+              <max>999</max>
+              <unstable>999</unstable>
+              <usePattern>false</usePattern>
+              <pattern></pattern>
+            </hudson.plugins.violations.TypeConfig>
+          </entry>
+          <entry>
+            <string>pmd</string>
+            <hudson.plugins.violations.TypeConfig>
+              <type>pmd</type>
+              <min>10</min>
+              <max>999</max>
+              <unstable>999</unstable>
+              <usePattern>false</usePattern>
+              <pattern>build/logs/pmd.xml</pattern>
+            </hudson.plugins.violations.TypeConfig>
+          </entry>
+          <entry>
+            <string>pylint</string>
+            <hudson.plugins.violations.TypeConfig>
+              <type>pylint</type>
+              <min>10</min>
+              <max>999</max>
+              <unstable>999</unstable>
+              <usePattern>false</usePattern>
+              <pattern></pattern>
+            </hudson.plugins.violations.TypeConfig>
+          </entry>
+          <entry>
+            <string>simian</string>
+            <hudson.plugins.violations.TypeConfig>
+              <type>simian</type>
+              <min>10</min>
+              <max>999</max>
+              <unstable>999</unstable>
+              <usePattern>false</usePattern>
+              <pattern></pattern>
+            </hudson.plugins.violations.TypeConfig>
+          </entry>
+          <entry>
+            <string>stylecop</string>
+            <hudson.plugins.violations.TypeConfig>
+              <type>stylecop</type>
+              <min>10</min>
+              <max>999</max>
+              <unstable>999</unstable>
+              <usePattern>false</usePattern>
+              <pattern></pattern>
+            </hudson.plugins.violations.TypeConfig>
+          </entry>
+        </typeConfigs>
+        <limit>100</limit>
+        <sourcePathPattern></sourcePathPattern>
+        <fauxProjectPath></fauxProjectPath>
+        <encoding>default</encoding>
+      </config>
+    </hudson.plugins.violations.ViolationsPublisher>
+    <htmlpublisher.HtmlPublisher>
+      <reportTargets>
+        <htmlpublisher.HtmlPublisherTarget>
+          <reportName>API Documentation</reportName>
+          <reportDir>build/api</reportDir>
+          <reportFiles>index.html</reportFiles>
+          <keepAll>false</keepAll>
+          <wrapperName>htmlpublisher-wrapper.html</wrapperName>
+        </htmlpublisher.HtmlPublisherTarget>
+        <htmlpublisher.HtmlPublisherTarget>
+          <reportName>Code Browser</reportName>
+          <reportDir>build/code-browser</reportDir>
+          <reportFiles>index.html</reportFiles>
+          <keepAll>false</keepAll>
+          <wrapperName>htmlpublisher-wrapper.html</wrapperName>
+        </htmlpublisher.HtmlPublisherTarget>
+        <htmlpublisher.HtmlPublisherTarget>
+          <reportName>Code Coverage</reportName>
+          <reportDir>build/coverage</reportDir>
+          <reportFiles>index.html</reportFiles>
+          <keepAll>false</keepAll>
+          <wrapperName>htmlpublisher-wrapper.html</wrapperName>
+        </htmlpublisher.HtmlPublisherTarget>
+      </reportTargets>
+    </htmlpublisher.HtmlPublisher>
+    <com.thalesgroup.hudson.plugins.xunit.XUnitPublisher>
+      <types>
+        <com.thalesgroup.dtkit.metrics.hudson.model.PHPUnitHudsonTestType>
+          <pattern>build/logs/junit.xml</pattern>
+          <faildedIfNotNew>true</faildedIfNotNew>
+          <deleteOutputFiles>true</deleteOutputFiles>
+        </com.thalesgroup.dtkit.metrics.hudson.model.PHPUnitHudsonTestType>
+      </types>
+    </com.thalesgroup.hudson.plugins.xunit.XUnitPublisher>
+  </publishers>
+  <buildWrappers/>
+</project>
diff --git a/framework/Element/data/hudson-element-phpunit.xml.template b/framework/Element/data/hudson-element-phpunit.xml.template
new file mode 100644 (file)
index 0000000..5a7fa06
--- /dev/null
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<phpunit backupGlobals="false"
+         backupStaticAttributes="false"
+         syntaxCheck="false">
+  <testsuites>
+    <testsuite name="Horde_%1$s_AllTests">
+      <directory suffix="AllTests.php">test/Horde/%2$s</directory>
+    </testsuite>
+  </testsuites>
+
+  <logging>
+    <log type="coverage-html" target="build/coverage" title="%1$s"
+         charset="UTF-8" yui="true" highlight="true"
+         lowUpperBound="35" highLowerBound="80"/>
+    <log type="coverage-clover" target="build/logs/clover.xml"/>
+    <log type="junit" target="build/logs/junit.xml" logIncompleteSkipped="false"/>
+  </logging>
+
+  <filter>
+    <whitelist addUncoveredFilesFromWhitelist="true">
+      <directory suffix=".php">lib</directory>
+    </whitelist>
+  </filter>
+</phpunit>
diff --git a/framework/Element/lib/Horde/Element/Constants.php b/framework/Element/lib/Horde/Element/Constants.php
new file mode 100644 (file)
index 0000000..42f8e9f
--- /dev/null
@@ -0,0 +1,42 @@
+<?php
+/**
+ * Horde_Element_Constants:: provides the constants for this package.
+ *
+ * PHP version 5
+ *
+ * @category Horde
+ * @package  Element
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Element
+ */
+
+/**
+ * Horde_Element_Constants:: provides the constants for this package.
+ *
+ * Copyright 2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Horde
+ * @package  Element
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Element
+ */
+class Horde_Element_Constants
+{
+    const DATA_DIR = '@data_dir@';
+
+    static public function getDataDirectory()
+    {
+        if (strpos(self::DATA_DIR, '@data_dir') === 0) {
+            return join(
+                DIRECTORY_SEPARATOR,
+                array(dirname(__FILE__), '..', '..', '..', 'data')
+            );
+        }
+        return self::DATA_DIR . DIRECTORY_SEPARATOR . 'Element';
+    }
+}
index 18e4826..50b3f02 100644 (file)
@@ -24,8 +24,8 @@
   <email>jan@horde.org</email>
   <active>yes</active>
  </lead>
- <date>2010-08-23</date>
- <time>17:28:27</time>
+ <date>2010-08-25</date>
+ <time>09:00:14</time>
  <version>
   <release>0.0.1</release>
   <api>0.0.1</api>
  </notes>
  <contents>
   <dir baseinstalldir="/" name="/">
+   <dir name="data">
+    <file name="hudson-element-build.xml.template" role="data" />
+    <file name="hudson-element-config.xml.template" role="data" />
+    <file name="hudson-element-phpunit.xml.template" role="data" />
+   </dir> <!-- /data -->
    <dir name="lib">
     <dir name="Horde">
      <dir name="Element">
@@ -53,6 +58,9 @@
       </dir> <!-- /lib/Horde/Element/Module -->
       <file name="Config.php" role="php" />
       <file name="Configs.php" role="php" />
+      <file name="Constants.php" role="php">
+       <replace from="@data_dir@" to="data_dir" type="pear-config"/>
+      </file>
       <file name="Exception.php" role="php" />
       <file name="Module.php" role="php" />
       <file name="Modules.php" role="php" />
  </dependencies>
  <phprelease>
   <filelist>
+   <install as="hudson-element-build.xml.template" name="data/hudson-element-build.xml.template" />
+   <install as="hudson-element-config.xml.template" name="data/hudson-element-config.xml.template" />
+   <install as="hudson-element-phpunit.xml.template" name="data/hudson-element-phpunit.xml.template" />
    <install as="Horde/Element.php" name="lib/Horde/Element.php" />
    <install as="Horde/Element/Config.php" name="lib/Horde/Element/Config.php" />
    <install as="Horde/Element/Configs.php" name="lib/Horde/Element/Configs.php" />
+   <install as="Horde/Element/Constants.php" name="lib/Horde/Element/Constants.php" />
    <install as="Horde/Element/Exception.php" name="lib/Horde/Element/Exception.php" />
    <install as="Horde/Element/Module.php" name="lib/Horde/Element/Module.php" />
    <install as="Horde/Element/Modules.php" name="lib/Horde/Element/Modules.php" />
     <release>alpha</release>
     <api>alpha</api>
    </stability>
-   <date>2010-08-23</date>
+   <date>2010-08-25</date>
    <license uri="http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html">LGPL</license>
    <notes>
 * Initial release