sebastianbergmann / phploc

A tool for quickly measuring the size of a PHP project.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Write error when launching from Ant task

lferro9000 opened this issue · comments

Running:

$> phploc --count-tests --log-csv build/logs/phploc.csv --log-xml build/logs/phploc.xml agent dbEngine phplib www

Runs fine.

With the following ant task:

<target name="phploc-ci"
        unless="phploc.done"
        depends="prepare"
        description="Measure project size using PHPLOC and log result in CSV and XML format. Intended for usage within a continuous integration environment.">
    <exec executable="${phploc}" taskname="phploc">
        <arg value="--count-tests" />
        <arg value="--log-csv" />
        <arg value="build/logs/phploc.csv" />
        <arg value="--log-xml" />
        <arg value="build/logs/phploc.xml" />
        <arg value="agent"/>
        <arg value="dbEngine"/>
        <arg value="phplib"/>
        <arg value="www"/>
    </exec>

    <property name="phploc.done" value="true"/>
</target>

And running:
$> ant phploc

It generates the following error:

[phploc] PHP Warning:  file_put_contents(/Users/Shared/Jenkins/Home/workspace/dbe/agent): failed to open stream: Is a directory in phar:///usr/local/Cellar/phploc/3.0.0/libexec/phploc-3.0.0.phar/src/Log/XML.php on line 53
[phploc] PHP Stack trace:
[phploc] PHP   1. {main}() /usr/local/Cellar/phploc/3.0.0/libexec/phploc-3.0.0.phar:0
[phploc] PHP   2. Symfony\Component\Console\Application->run() /usr/local/Cellar/phploc/3.0.0/libexec/phploc-3.0.0.phar:182
[phploc] PHP   3. SebastianBergmann\PHPLOC\CLI\Application->doRun() phar:///usr/local/Cellar/phploc/3.0.0/libexec/phploc-3.0.0.phar/symfony/console/Application.php:117
[phploc] PHP   4. Symfony\Component\Console\Application->doRun() phar:///usr/local/Cellar/phploc/3.0.0/libexec/phploc-3.0.0.phar/src/CLI/Application.php:98
[phploc] PHP   5. Symfony\Component\Console\Application->doRunCommand() phar:///usr/local/Cellar/phploc/3.0.0/libexec/phploc-3.0.0.phar/symfony/console/Application.php:186
[phploc] PHP   6. Symfony\Component\Console\Command\Command->run() phar:///usr/local/Cellar/phploc/3.0.0/libexec/phploc-3.0.0.phar/symfony/console/Application.php:787
[phploc] PHP   7. SebastianBergmann\PHPLOC\CLI\Command->execute() phar:///usr/local/Cellar/phploc/3.0.0/libexec/phploc-3.0.0.phar/symfony/console/Command/Command.php:256
[phploc] PHP   8. SebastianBergmann\PHPLOC\CLI\Command->executeSingle() phar:///usr/local/Cellar/phploc/3.0.0/libexec/phploc-3.0.0.phar/src/CLI/Command.php:109
[phploc] PHP   9. SebastianBergmann\PHPLOC\Log\XML->printResult() phar:///usr/local/Cellar/phploc/3.0.0/libexec/phploc-3.0.0.phar/src/CLI/Command.php:151
[phploc] PHP  10. file_put_contents() phar:///usr/local/Cellar/phploc/3.0.0/libexec/phploc-3.0.0.phar/src/Log/XML.php:53

Environment: Mac / Homebrew

phploc 3.0.0 by Sebastian Bergmann
PHP 5.6.18 (cli) (built: Feb 6 2016 06:53:53)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
with Xdebug v2.3.3, Copyright (c) 2002-2015, by Derick Rethans
Apache Ant(TM) version 1.9.6 compiled on June 29 2015

Any ideas on what is the problem?

Try this

Change

<arg value="agent"/>
 <arg value="dbEngine"/>
 <arg value="phplib"/>
 <arg value="www"/>

To

 <arg path="${basedir}/agent"/>
 <arg path="${basedir}/dbEngine"/>
 <arg path="${basedir}/phplib"/>
 <arg path="${basedir}/www"/>

Does not look like a phploc issue to me.