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 29051] New: - <ant inheritRefs="true" inheritAll="true" ...> passes through <patternset id="pattern.id"> but cannot use in <patternset refid="pattern.id"> in sub build
Date Tue, 18 May 2004 05:36:02 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=29051>.
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=29051

<ant inheritRefs="true" inheritAll="true" ...> passes through <patternset id="pattern.id">
but cannot use in <patternset refid="pattern.id"> in sub build

           Summary: <ant inheritRefs="true" inheritAll="true" ...> passes
                    through <patternset id="pattern.id"> but cannot use in
                    <patternset refid="pattern.id"> in sub build
           Product: Ant
           Version: 1.6.1
          Platform: Sun
        OS/Version: Solaris
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Core
        AssignedTo: dev@ant.apache.org
        ReportedBy: johnk@nstc.nec.com.au
                CC: johnk@nstc.nec.com.au


Also present in 1.5 and 1.5.4.

We have a three level build system:

build.xml        builds the entire project
sub_build.xml    builds a subsystem within the project
common.xml       encapsulates common targets that do actual work
                 eg <javac ...>

In build.xml we have

  <!-- Want to use top.filter.id to parameterise build.xml for different
       projects using the same subsystem, to exclude parts of subsystems
       that are not required. -->

  <!-- Problem happens even if patternset is nested in target below. -->
  <patternset id="top.filter.id">
    <exclude name="**/unwanted/directory/**"
    ...
  </patternset>

  <target name="subsysname" depends="...">
    <ant antfile="path/to/sub_build.xml"
         target="${subtarget}"
         inheritAll="true"
         inheritRefs="true">
       <!-- Problem happens even if we add an explicit reference, with or
            without torefid to a new id for the sub_build.xml to use, and
            even with inheritRefs="false" and an explicit reference. -->
       <reference refid="top.filter.id"/>
    </ant>
  </target>

The value of subtarget above defaults to 'all', and there is a set of standard
targets that must be available in all sub_build.xml files.
Varying the value of subtarget property varies which target runs in sub_build.

In sub_build.xml we have targets which are driven by the standard targets, eg
'all', to do work. To standardize how that work is defined, we have common.xml

  <patternset id="sub.filter.id">
    <!-- HERE IS   THE PROBLEM -->
    <!-- ant reports Reference top.filter.id not found, so part one of the
         workaround is to comment this out and 'hack' my common.xml . -->
    <patternset refid="top.filter.id"/>
    <!-- HERE ENDS THE PROBLEM -->

    <exclude name="**/unwanted/directory/**"
    ...
  </patternset>

  <target name="compile_main">
    <ant antfile="path/to/common.xml"
         target="compile_main"
         inheritAll="true"
         inheritRefs="true">
      <property name="subname" value="sub-build-name"/>
      <property name="subdir" value="sub/build/dir"/>
    </ant>
  </target>

In common.xml we have

  <target name="compile_main">
    ...
    <javac taskname="${subname}.javac"
           destdir="${main.classes}"
           deprecation="${main.deprecation}"
           listfiles="${main.listfiles}">
      <classpath refid="main.classpath"/> <!-- inherited property -->
      <src path="${src}"/>
      <include name="${subdir}/**/*.java"/>
      <patternset refid="sub.filter.id"/> <!-- inherited reference -->
      <!-- WORKAROUND is to use top.filter.id directly in common.xml
      <patternset refid="top.filter.id"/>
      -->
    </javac>
  </target>

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


Mime
View raw message