psst - little secret: a look into Ant´s buildfile will show some secrets ;-)
Jan >-----Ursprüngliche Nachricht----- >Von: Com Pegasus-CC-Hotline >[mailto:[EMAIL PROTECTED] >Gesendet: Montag, 19. Dezember 2005 14:08 >An: Ant Users List >Betreff: AW: How to conditionally add something to a path ? > >Hi Jan, > >wunderbar, your example works! (And I managed to adapt it to >my build file.) > >Thank you very much, I was really close to giving up! :-) > >cu, > Thomas > > >-----Ursprüngliche Nachricht----- >Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] >Gesendet: Montag, 19. Dezember 2005 12:48 >An: [email protected] >Betreff: AW: How to conditionally add something to a path ? > > >Try selectors. > >Example: >- create two files (echo . > lib1.txt) > lib1.txt : symbol for a library > lib1b.txt : symbol for a library depending on lib1 >- copy the code provided into a build.xml > >- run ant > Buildfile: build.xml > [echo] Path: > [echo] - C:\TEMP\ant-conditionalSelector\build.xml > [echo] - C:\TEMP\ant-conditionalSelector\lib1.txt > [echo] - C:\TEMP\ant-conditionalSelector\lib1b.txt > >- rename lib1.txt into lib1.txt.old >- rerun ant > Buildfile: build.xml > [echo] Path: > [echo] - C:\TEMP\ant-conditionalSelector\build.xml > > >Jan > > >---8-<-------8-<-------8-<-------8-<-------8-<-------8-<------- >8-<-------8-<---- ><project> > > <!-- check if the 'base' file is there --> > <available property="lib1.present" file="lib1.txt"/> > > <!-- all files which depend on 'base' --> > <selector id="needs.lib1"> > <or> > <filename name="lib1*.txt"/> > </or> > </selector> > > <!-- files without any dependency --> > <selector id="needs.nothing"> > <or> > <filename name="build.xml"/> > </or> > </selector> > > <!-- the path with all 'valid' files --> > <path id="p"> > <fileset dir="."> > <or> > <selector refid="needs.lib1" if="lib1.present"/> > <selector refid="needs.nothing"/> > </or> > </fileset> > </path> > > <!-- print the result --> > <pathconvert property="p.value" refid="p" >pathsep="${line.separator}- " /> > <echo>Path:${line.separator}- ${p.value}</echo> ></project> >---8-<-------8-<-------8-<-------8-<-------8-<-------8-<------- >8-<-------8-<---- > > > >>-----Ursprüngliche Nachricht----- >>Von: Com Pegasus-CC-Hotline >>[mailto:[EMAIL PROTECTED] >>Gesendet: Montag, 19. Dezember 2005 11:56 >>An: [email protected] >>Betreff: How to conditionally add something to a path ? >> >>Hello, >> >>I am trying to add an entry to a path, if some other entry is >>not existant. I'm trying since hours now,=20 without success. >>I am somewhere here: >> >> >> <available file=3D"${jarpath}/**/jacorb*.jar" >>property=3D"jacorb.present"/> >> >> <path id=3D"classpath"> >> <fileset dir=3D"${jarpath}"> >> <include name=3D"**/*.jar" /> >> <exclude name=3D"orbacus.jar" /> >> </fileset> >> <if> >> <isfalse property=3D"${jacorb.present}" /> >> <fileset dir=3D"${jarpath}"> >> <include name=3D"orbacus.jar" /> >> </fileset> >> </if> >> </path> >> >>... but it doesn't work. A fileset doesn't accept a if inside, >>and a if does not accept a fileset inside, and so on ... >> >>How can I do this??? >> >>Thomas >> >> >>PS: I also found http://ant-contrib.sourceforge.net/fileset.html >>but it just "didn't" work. (I downloaded/placed the contrib >>jar and added the line <taskdef >>resource="net/sf/antcontrib/antcontrib.properties"> >>but it still said, that the fileset doesnt know the "unless".) >> >>--------------------------------------------------------------------- >>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] > > >--------------------------------------------------------------------- >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]
