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:[EMAIL PROTECTED] > 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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Tuesday, July 22, 2003 2:41 PM > To: [EMAIL PROTECTED] > 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:[EMAIL PROTECTED] > > 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: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] >
