ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 32148] New: - path/fileset confusing when using relative paths and .. (parent directory)
Date Wed, 10 Nov 2004 08:28:15 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=32148>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=32148

path/fileset confusing when using relative paths and .. (parent directory)

           Summary: path/fileset confusing when using relative paths and ..
                    (parent directory)
           Product: Ant
           Version: 1.6.2
          Platform: Sun
        OS/Version: Solaris
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Core
        AssignedTo: dev@ant.apache.org
        ReportedBy: linus@tigris.org


The following works:
  <path id="modulespecific">
    <fileset dir="${basedir}/..">
      <include name="net/build/net.jar"/>
    </fileset>
  </path>
Debug output from javac rule is:
[...]
fileset: Setup scanner in dir /[path]/modules with patternSet{ includes:
[net/build/net.jar] excludes: [] }
[...]
    [javac] '-classpath'
    [javac] '[...]:/[path]/modules/net/build/net.jar:[...]'


Then when I change to:
  <path id="modulespecific">
    <fileset dir="${basedir}">
      <include name="../net/build/net.jar"/>
    </fileset>
  </path>
It suddenly doesn't find the file anymore. The debug output is:
fileset: Setup scanner in dir /[path]/modules/ic with patternSet{ includes:
[../net/build/net.jar] excludes: [] }
[...]
    [javac] '-classpath'
    [javac] '[...net/build/net.jar not included...]'

I would have expected the second alternative to work just as well as the first
one. This is confusing. I consider it an error in ant.

I am trying to add some user libraries to the build.xml file that was included
in the jcoverage GPL-version. The whole of the modified build.xml file is here:
<?xml version="1.0" encoding="UTF-8"?>
<project name="jcoverage.examples" default="main" basedir=".">
  <description>
    jcoverage copyright (C)2003 jcoverage ltd. http://jcoverage.com/
    jcoverage is licensed under the GNU General Public License
    jcoverage licensing policy, http://jcoverage.com/license.html
    jcoverage comes with ABSOLUTELY NO WARRANTY
  </description>


  <!--
    all build artefacts are deposited under this directory.
  -->
  <property name="build.dir" value="${basedir}/build"/>

  <!--
    classes generated by the javac compiler are deposited in this
    directory.
  -->
  <property name="build.classes.dir" value="${build.dir}/classes"/>
  <property name="build.tests.dir" value="${build.dir}/tests"/>

  <!--
    instrumented classes are deposited into this directory.
  -->
  <property name="build.instrumented.dir"
value="${build.dir}/instrumented-classes"/>

  <!--
    coverage reports are deposited into this directory. For the
    HTML report, look at ${build.coverage.dir}/index.html. For the XML
    report look at ${build.coverage.dir}/coverage.xml.
  -->
  <property name="build.coverage.dir" value="${build.dir}/coverage"/>

  <!--
    unit test reports from junit are deposited in this directory.
  -->
  <property name="build.reports.dir" value="${build.dir}/reports"/>

  <!--
    the root of a jcoverage distribution
  -->
  <property name="dist.dir"
value="${basedir}/../../tools/jcoverage/jcoverage-1.0.5"/>

  <!--
    third party libraries that are also shipped with jcoverage can be
    found in this directory.
  -->
  <property name="lib.dir" value="${dist.dir}/lib"/>

  <!--
    the source code can be found in this directory.
  -->
  <property name="src.dir" value="${basedir}/src/java"/>
  <property name="testsrc.dir" value="${basedir}/src/java-tests"/>

  <target name="main" depends="clean,init,compile,instrument,test,coverage"
description="clean build, instrument and unit test"/>

  <path id="modulespecific">
    <fileset dir="${basedir}">
      <include name="../net/build/net.jar"/>
    </fileset>
  </path>

  <path id="junit">
    <fileset dir="${lib.dir}">
      <include name="junit/3.8.1/*.jar"/>
    </fileset>
  </path>

  <path id="log4j">
    <fileset dir="${lib.dir}">
      <include name="log4j/1.2.8/*.jar"/>
    </fileset>
  </path>

  <path id="jcoverage">
    <fileset dir="${dist.dir}">
      <include name="jcoverage.jar"/>
    </fileset>
  </path>

  <taskdef classpathref="jcoverage" resource="tasks.properties"/>

  <target name="clean" description="clean up build artefacts">
    <delete quiet="true">
      <fileset dir="${build.dir}"/>
      <fileset dir="${basedir}">
        <include name="jcoverage.ser"/>
        <include name="jcoverage.log"/>
      </fileset>
    </delete>
  </target>

  <target name="init" description="create build directories">
    <mkdir dir="${build.dir}"/>
    <mkdir dir="${build.classes.dir}"/>
    <mkdir dir="${build.coverage.dir}"/>
    <mkdir dir="${build.instrumented.dir}"/>
    <mkdir dir="${build.reports.dir}"/>
  </target>

  <target name="compile" description="compile all classes">
    <javac srcdir="${src.dir}" destdir="${build.classes.dir}" failonerror="yes"
debug="yes" source="1.4">
      <classpath refid="junit"/>
      <classpath refid="log4j"/>
      <classpath refid="modulespecific"/>
    </javac>
    <javac srcdir="${testsrc.dir}" destdir="${build.tests.dir}"
failonerror="yes" debug="yes" source="1.4">
      <classpath location="${build.classes.dir}"/>
      <classpath refid="junit"/>
      <classpath refid="log4j"/>
      <classpath refid="modulespecific"/>
    </javac>
  </target>

  <target name="instrument" description="Add jcoverage instrumentation">
    <!--
      instrument the application classes, writing the instrumented
      classes into ${build.instrumented.dir}.
    -->
    <instrument todir="${build.instrumented.dir}">
      <!--
        Note that the following line causes instrument to ignore any
        source line containing a reference to log4j, for the purposes
        of coverage reporting.
      -->
      <ignore regex="org.apache.log4j.*"/>

      <fileset dir="${build.classes.dir}">
        <!--
          instrument all the application classes, but don't instrument
          the test classes.
        -->
        <include name="**/*.class"/>
      </fileset>
    </instrument>
  </target>

  <target name="test" description="Unit test the application">
    <junit fork="yes" dir="${basedir}" errorProperty="test.failed"
failureProperty="test.failed">
      <!--
        note the classpath order, instrumented classes are before the
        original (uninstrumented) classes.
      -->
      <classpath location="${build.instrumented.dir}"/>
      <classpath location="${build.classes.dir}"/>
      <classpath location="${build.tests.dir}"/>
      <classpath refid="modulespecific"/>

      <!--
        the instrumented classes reference classes used by the
        jcoverage runtime.
      -->
      <classpath refid="jcoverage"/>
      <formatter type="xml"/>

      <test name="${testcase}" todir="${build.reports.dir}" if="testcase"/>

      <batchtest todir="${build.reports.dir}" unless="testcase">    	
        <fileset dir="${testsrc.dir}">
          <include name="**/Test*.java"/>
        </fileset>
      </batchtest>
    </junit>
  </target>

  <target name="coverage" description="HTML and XML coverage reports can be
found in build/coverage">
    <report srcdir="${src.dir}" destdir="${build.coverage.dir}"/>
    <report srcdir="${src.dir}" destdir="${build.coverage.dir}" format="xml"/>

    <echo>
jcoverage reports have been generated.
The HTML report is ${build.coverage.dir}/index.html
The XML report is ${build.coverage.dir}/coverage.xml
    </echo>
  </target>
</project>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message