Jump to content


Photo

Build File


  • Please log in to reply
3 replies to this topic

#1 Philip

Philip

    Phailip

  • Administrators
  • 4,735 posts

Posted 12 December 2012 - 01:09 AM

Can anybody spot why the build is failing - it claims the directory doesn't exist but it is indeed being created by Jenkins...

<?xml version="1.0" encoding="UTF-8"?>
<project name="${projectName}" basedir="." default="build:main">
    <!-- Properties -->
    <property name="dir.app" value="${project.basedir}/app" />
    <property name="dir.src" value="${project.basedir}/src" />
    <property name="dir.build" value="${project.basedir}/app/build" />
    <property name="dir.docs" value="${dir.build}/docs" />
    <property name="dir.docs.phpdoc2" value="${dir.docs}/phpdoc2" />
    <property name="dir.docs.phploc" value="${dir.docs}/phploc" />
    <property name="dir.reports" value="${dir.build}/logs" />
    <property name="dir.reports.pdepend" value="${dir.reports}/pdepend" />
    <property name="dir.reports.coverage" value="${dir.reports}/coverage" />
    <property name="dir.api" value="${dir.build}/api" />

    <!-- Filesets -->
    <fileset id="sourcecode" dir="${dir.src}">
        <include name="**/*.php" />
    </fileset>


    <!-- Default target -->
    <target name="build:main"
            depends="build:clean, build:prepare, build:check, build:test, build:doc"
            description="Run all test and build everything" />

    <!-- Doc target -->
    <target name="build:doc"
            depends="build:prepare, doc:phpdoc2, doc:phploc"
            description="Generates app API documentation." />

    <!-- Check target -->
    <target name="build:check"
            depends="check:cs, check:md, check:cpd, check:depend"
            description="Analyzes app code." />

    <!-- Test target -->
    <target name="build:test"
            depends="test:unit"
            description="Executes all tests.." />

    <!-- Project build clean -->
    <target name="build:clean" description="Clean up build directories.">
        <echo msg="Cleaning build directories ..." />
        <delete dir="${dir.build}" verbose="true" />
    </target>

    <!-- Project build prepare -->
    <target name="build:prepare" description="Create build directories.">
        <echo msg="Creating build directories ..." />
        <mkdir dir="${dir.build}" />
        <mkdir dir="${dir.docs}" />
        <mkdir dir="${dir.docs.phpdoc2}" />
        <mkdir dir="${dir.reports}" />
        <mkdir dir="${dir.reports.coverage}" />
        <mkdir dir="${dir.reports.pdepend}" />
        <mkdir dir="${dir.api}" />
    </target>

    <!-- PHPDOC API documentation target -->
    <target name="doc:phpdoc2" description="Generate API documentation.">
        <echo msg="Generating API documentation with PHPDoc..." />
        <phpdoc2 title="${phing.project.name} :: API Documentation"
                destdir="${dir.docs.phpdoc2}">
            <fileset refid="sourcecode" />
        </phpdoc2>
    </target>

    <!-- PSR-1 code sniffer -->
    <target name="check:cs" description="Checks coding standard.">
        <echo msg="Checking coding standard ..." />
        <phpcodesniffer standard="PSR1"
                        showSniffs="true"
                        showWarnings="true">
            <fileset refid="sourcecode" />
            <formatter type="checkstyle" outfile="${dir.reports}/checkstyle.xml" />
        </phpcodesniffer>
    </target>

    <!-- copy/paste detector -->
    <target name="check:cpd" description="Checks similar code blocks.">
        <echo msg="Checking similar code blocks ..." />
        <phpcpd>
            <fileset refid="sourcecode" />
            <formatter type="pmd" outfile="${dir.reports}/pmd-cpd.xml" />
        </phpcpd>
    </target>

    <!-- Mess detector -->
    <target name="check:md" description="Generate code metrics.">
        <echo msg="Generating code metrics ..." />
        <phpmd rulesets="codesize,unusedcode">
            <fileset refid="sourcecode" />
            <formatter type="xml" outfile="${dir.reports}/pmd.xml" />
        </phpmd>
    </target>

    <!-- Code dependency -->
    <target name="check:depend" description="Checks coupling and dependency.">
        <echo msg="Checking coupling and dependency ..." />
        <phpdepend>
            <fileset refid="sourcecode" />
            <logger type="jdepend-xml" outfile="${dir.reports.pdepend}/jdepend.xml" />
            <logger type="jdepend-chart" outfile="${dir.reports.pdepend}/dependencies.svg" />
            <logger type="overview-pyramid" outfile="${dir.reports.pdepend}/overview-pyramid.svg" />
        </phpdepend>
    </target>

    <!-- Lines of Code -->
    <target name="doc:phploc" description="Measures and logs the size of the project" hidden="true">
        <tstamp>
            <format property="check.date.time" pattern="%Y%m%d-%H%M%S" locale="en_US"/>
        </tstamp>
        <phploc reportType="csv" reportName="${check.date.time}-report"
                reportDirectory="phploc-reports">
            <fileset dir=".">
                <include name="**/*.php" />
                <include name="*.php" />
            </fileset>
        </phploc>
    </target>

    <!-- Unit tests -->
    <target name="test:unit" description="Executes unit tests.">
        <echo msg="Running unit tests ..." />
        <exec command="phpunit --log-junit ${dir.app}/phpunit.xml --coverage-clover ${dir.reports.coverage}/clover.xml --coverage-html ${dir.reports.coverage}/ -c ${dir.app}"/>
    </target>


</project>

Started by GitHub push by 
Building in workspace /var/lib/jenkins/jobs/Main Site - On Commit/workspace
Checkout:workspace / /var/lib/jenkins/jobs/Main Site - On Commit/workspace - hudson.remoting.LocalChannel@58b8dfdf
Using strategy: Default
Last Built Revision: Revision 64d886f3addfa67c2b67e84b5d5e5a0fa6e20086 (origin/development)
Fetching changes from 1 remote Git repository
Fetching upstream changes from https://github.com/PHPFreaks/site.git
Seen branch in repository origin/HEAD
Seen branch in repository origin/development
Seen branch in repository origin/master
Seen branch in repository origin/premiso
Commencing build of Revision ef2183149b7c64cb77b81c0ffe23f73951f74b2f (origin/development)
Checking out Revision ef2183149b7c64cb77b81c0ffe23f73951f74b2f (origin/development)
looking for '/var/lib/jenkins/jobs/Main Site - On Commit/workspace/build.xml' ... 
use '/var/lib/jenkins/jobs/Main Site - On Commit/workspace' as a working directory. 
[workspace] $ phing -buildfile "/var/lib/jenkins/jobs/Main Site - On Commit/workspace/build.xml" -logger phing.listener.DefaultLogger
Buildfile: /var/lib/jenkins/jobs/Main Site - On Commit/workspace/build.xml

[...]

${projectName} > build:prepare:

    [echo] Creating build directories ...
    [mkdir] Created dir: /var/lib/jenkins/jobs/Main Site - On Commit/workspace/app/build
    [mkdir] Created dir: /var/lib/jenkins/jobs/Main Site - On Commit/workspace/app/build/docs
    [mkdir] Created dir: /var/lib/jenkins/jobs/Main Site - On Commit/workspace/app/build/docs/phpdoc2
    [mkdir] Created dir: /var/lib/jenkins/jobs/Main Site - On Commit/workspace/app/build/logs
    [mkdir] Created dir: /var/lib/jenkins/jobs/Main Site - On Commit/workspace/app/build/logs/coverage
    [mkdir] Created dir: /var/lib/jenkins/jobs/Main Site - On Commit/workspace/app/build/logs/pdepend
    [mkdir] Created dir: /var/lib/jenkins/jobs/Main Site - On Commit/workspace/app/build/api

[..]

BUILD FINISHED

Total time: 9.6187 seconds

[CHECKSTYLE] Collecting checkstyle analysis files...
[CHECKSTYLE] Finding all files that match the pattern app/build/logs/checkstyle.xml
[CHECKSTYLE] Parsing 1 files in /var/lib/jenkins/jobs/Main Site - On Commit/workspace
[CHECKSTYLE] Successfully parsed file /var/lib/jenkins/jobs/Main Site - On Commit/workspace/app/build/logs/checkstyle.xml of module  with 0 warnings.
[PMD] Collecting PMD analysis files...
[PMD] Finding all files that match the pattern app/build/logs/pmd.xml
[PMD] Parsing 1 files in /var/lib/jenkins/jobs/Main Site - On Commit/workspace
[PMD] Successfully parsed file /var/lib/jenkins/jobs/Main Site - On Commit/workspace/app/build/logs/pmd.xml of module  with 5 warnings.
[DRY] Collecting duplicate code analysis files...
[DRY] Finding all files that match the pattern app/build/logs/pmd-cpd.xml
[DRY] Parsing 1 files in /var/lib/jenkins/jobs/Main Site - On Commit/workspace
[DRY] Successfully parsed file /var/lib/jenkins/jobs/Main Site - On Commit/workspace/app/build/logs/pmd-cpd.xml of module  with 2 warnings.
Recording plot data
[htmlpublisher] Archiving HTML reports...
[htmlpublisher] Archiving at BUILD level /var/lib/jenkins/jobs/Main Site - On Commit/workspace/build/api to /var/lib/jenkins/jobs/Main Site - On Commit/builds/2012-12-12_00-30-36/htmlreports/API_Documentation
ERROR: Specified HTML directory '/var/lib/jenkins/jobs/Main Site - On Commit/workspace/build/api' does not exist.
Build step 'Publish HTML reports' changed build result to FAILURE
[JDepend] JDepend plugin is ready
[JDepend] Couldn't generate JDepend file at 'app/build/logs/jdepend.xml'java.io.FileNotFoundException: /var/lib/jenkins/jobs/Main Site - On Commit/workspace/app/build/logs/jdepend.xml (No such file or directory)
IRC notifier plugin: Sending notification to: #spam
IRC notifier plugin: Notifying suspects
IRC notifier plugin: Sending notification to suspect: MisterPhilip
Finished: FAILURE


#2 Christian F.

Christian F.

    Advanced Member

  • Staff Alumni
  • 3,106 posts
  • LocationNorway

Posted 13 December 2012 - 04:30 AM

Tried without the spaces?
Keeping it simple.

#3 Philip

Philip

    Phailip

  • Administrators
  • 4,735 posts

Posted 13 December 2012 - 03:54 PM

It's done automatically by Jenkins, unfortunately.

The thing that baffles me is the other directories are fine, and it is indeed created on the server.

#4 Christian F.

Christian F.

    Advanced Member

  • Staff Alumni
  • 3,106 posts
  • LocationNorway

Posted 13 December 2012 - 04:52 PM

Hmm... Sounds like there might be some escaping missing in the htmlpublisher part then, at least that's the only logical reason I can think of right now.
Not that I've ever used Jenkins myself, or studied how it works, but.. :P
Keeping it simple.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com