Search code examples
phpantphploc

Why is phploc ignoring excludes in ant


In my buildfile I use phploc as described in jenkins-php.org but it just won't ignore folders.

<target name="phploc" description="Measure project size using PHPLOC">
    <exec executable="phploc">
        <arg value="--log-csv" />
        <arg value="${basedir}/build/logs/phploc.csv" />
        <arg value="--exclude"/>
        <arg value="${basedir}/include/library" />
        <arg path="${basedir}"/>
    </exec>
</target>

It works with this command on console in the project directory:

phploc --log-csv build/logs/phploc.csv --exclude include/library .

But why not in my buildfile? It always runs through the whole Zend library under library.

Oh and phpcpd is the same issue. In the console it's right, running it with ant not...


Solution

  • I'm guessing here, but in your command-line run you use

    --exclude include/library
    

    Whereas in the Ant buildfile you have

    <arg value="--exclude"/>
    <arg value="${basedir}/include/library" />
    

    which is effectively

    --exclude ${basedir}/include/library
    

    with basedir set to whatever you have.

    Perhaps try

    <arg value="--exclude"/>
    <arg value="include/library" />
    

    instead.