ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject RE: Zvi_Q: know the number of token in a file
Date Tue, 22 Jul 2003 12:37:08 GMT
Manual
http://ant-contrib.sourceforge.net/tasks/propertyregex.html

Sourcen
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/ant-contrib/ant-contrib/src/n
et/sf/antcontrib/property/RegexTask.java?rev=HEAD&content-type=text/vnd.view
cvs-markup


Jan

> -----Original Message-----
> From: Rahamim, Zvi (Zvi) ** CTR ** [mailto:rahamim@avaya.com]
> Sent: Tuesday, July 22, 2003 2:28 PM
> To: Ant Users List
> Subject: RE: Zvi_Q: know the number of token in a file
> 
> 
> I cna't see this task, or any that relates to regexp.
> 
> -----Original Message-----
> From: Jan.Materne@rzf.fin-nrw.de [mailto:Jan.Materne@rzf.fin-nrw.de]
> Sent: Tuesday, July 22, 2003 3:22 PM
> To: user@ant.apache.org
> Subject: RE: Zvi_Q: know the number of token in a file
> 
> 
> Part of AntContrib.
> 
> 
> Ant-Contrib:
>   Homepage:   http://sourceforge.net/projects/ant-contrib/
>   CVS-Source:
>
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/ant-contrib/ant-contrib/src/n
et/sf/antcontrib/
>   CVS-Manual:
> http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/ant-contrib/ant
> -contrib/manua
> l/index.html
> 	
> http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/ant-
> contrib/ant-co
> ntrib/manual/tasks/index.html
>   Binary:     http://gump.covalent.net/jars/latest/ant-contrib/
> 
> 
> 
> Jan
> 
> > -----Original Message-----
> > From: Rahamim, Zvi (Zvi) ** CTR ** [mailto:rahamim@avaya.com]
> > Sent: Tuesday, July 22, 2003 2:08 PM
> > To: Ant Users List
> > Subject: RE: Zvi_Q: know the number of token in a file
> > 
> > 
> > Thanks,
> > where can I find the propertyregex task?
> > 
> > -----Original Message-----
> > From: Jan.Materne@rzf.fin-nrw.de [mailto:Jan.Materne@rzf.fin-nrw.de]
> > Sent: Tuesday, July 22, 2003 2:41 PM
> > To: user@ant.apache.org
> > Subject: RE: Zvi_Q: know the number of token in a file
> > 
> > 
> > I did a quick hack using AntContrib:
> > 
> > 
> > <?xml version="1.0" encoding="ISO-8859-1"?>
> > <project name="test" basedir="." default="main">
> >     <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
> > 
> >     <target name="main">
> >         <property name="token" value="ant"/>
> >         <property name="file" value="1.txt"/>
> >         <loadfile property="tmp" srcfile="src/${file}"/>
> >         <propertyregex property="nofail" input="${tmp}" 
> > regexp="${token}"
> > select="\1"/>
> >         <fail message="token '${token}' not found" unless="nofail"/>
> >     </target>
> > 
> > </project>
> > 
> > 
> > 
> > First I read the whole content of the file into a property 
> > (prerequisite for
> > the next step).
> > The I use the same regexp which you use for your <regexp> in
> > <propertyregex>. <propertyregex>
> > copies the result of the regexp matching into the property or 
> > doesn´t create
> > that property
> > if nothing matches.
> > So I can use <fail> with 'unless' attribute.
> > 
> > Short test with:
> > 1.txt
> > -----
> > this file
> > contains
> > no token
> > 
> > 2.txt
> > -----
> > this file
> > contains the
> > token ant.
> > 
> > 
> > gave: 
> > 
> > 
> > ant -Dfile=1.txt
> > BUILD FAILED
> > C:\temp\x\build.xml:10: token 'ant' not found
> > 
> > ant -Dfile=2.txt
> > BUILD SUCCESSFUL
> > 
> > 
> > 
> > Maybe you can start here ...
> > If you want to fail if no files contains that regexp and 
> > sucess if one or
> > more contains
> > that, you can create a temporary file with <concat> and all 
> > files. Then read
> > that file.
> > BUT: this could eat much memory ...
> > 
> > 
> > Jan
> > 
> > 
> > 
> > > -----Original Message-----
> > > From: Rahamim, Zvi (Zvi) ** CTR ** [mailto:rahamim@avaya.com]
> > > Sent: Tuesday, July 22, 2003 1:22 PM
> > > To: Ant Users List
> > > Subject: Zvi_Q: know the number of token in a file
> > > 
> > > 
> > > Hi!
> > > I want to use the replace task to replace tokens.
> > > But... I also want that if no token is found, the build fails.
> > > Can you help me?
> > > Thanks!!!
> > > 
> > > 
> > 
> ---------------------------------------------------------------------
> > > 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
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message