ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ivan \"Rambius\" Ivanov" <rambiusparkisan...@yahoo.com>
Subject RE: macrodef
Date Tue, 17 Jan 2006 20:58:48 GMT
Hello Paulo,

it depends on the macrodef. I had a situation where I
wrapped <junit> and <junitreport> in one macrodef
since that piece of code  was repeated several times.
Later, it turned out that some invoka
tions of that macrodef required different
<sysproperty>'s. So I added a macrodef element that
allows passing different properties. Here is the real
code:

<macrodef name="call-junit" description="Wraps junit
task">
  <element name="sysproperties" optional="true"/>
  <sequential>
    <junit errorproperty="junit.error"
      failureproperty="junit.error"
      printsummary="withOutAndErr">
      <classpath refid="runtime.test.cp"/>
      <formatter type="plain" usefile="false"/>
      <formatter type="xml"/>
      <test todir="${project.test.data}"
name="${testcase}" if="testcase"/>
      <batchtest todir="${project.test.data}"
unless="testcase">
        <fileset dir="${project.test.classes}">
          <selector refid="${module.sel.id}"/>
        </fileset>
      </batchtest>
      <sysproperty key="project.jar"
value="${module.dist}/${module.jar}"/>
      <sysproperty key="project.basedir"
value="${basedir}"/>
      <sysproperties/> *** the important line ***
    </junit>
  </sequential>
</macrodef>

If you have access to the developer that wrote your
macrodef you can ask him do something similar.

Regards
Ivan

--- Paulo Jorge Guedes <Paulo.Guedes@artelecom.pt>
wrote:
> 
> But I have to rewrite all the macrodef settings,
> i.e., there isn't a way to just add more settings to
> the already defined macrodef?
> 
> Paulo
> 
> 
> > - Alexey.
> > 
> > Paulo Jorge Guedes wrote:
> > > Hi,
> > >
> > > I have a target (-init-macrodef-junit ) that
> initializes "junit" target
> > > using the "macrodef" element. It doesn't declare
> the "formatter" element
> > > and I need to have the reports printed. The
> thing is I can't touch that
> > > file.
> > >
> > > Is there any way to "append" the "formatter"
> child element to the junit
> > > macrodef in a target called after the one that
> initializes it
> > > (-init-macrodef-junit)? It would avoid having to
> redefine all the junit
> > > settings...
> > >
> > > Paulo
> > >
> > >
> > >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> > > For additional commands, e-mail:
> user-help@ant.apache.org
> > >
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> > For additional commands, e-mail:
> user-help@ant.apache.org
> > 
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Mime
View raw message