ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ken Gentle <j.kenneth.gen...@acm.org>
Subject Re: Copy a directory list
Date Mon, 23 Jan 2006 17:24:09 GMT
Just for the record, the word is "purist" - Mary, Mother of Jesus, is 
reported to have be "the purest".  :)

Um, Clifton, the first solution I showed you is 100%, pure, core 
ANT.  It does involve a file read.  I have a similar issue in my 
current project that necessitates writing properties to a file so 
that they can be read back in as tokens.  A bit of a pain, but a 
macrodef and preset def handle it quite well.

scriptdef is 100% pure ant as well; do it in your scripting language 
of choice and hand it back.

There are ways around this problem.  They are workarounds.

I wish I had such tools to work around bugs (and I mean DEFECTS in 
IDEA) - ant is really, amazingly, quite flexible.

         Ken


At 09:03 2006-01-23, you wrote:
>See, herein lies the problem. I'm not open to Ant-contrib. I'm what you might
>call a purest. I believe that this should be possible using vanilla Ant
>declarative syntax. I refuse to muddy up my build with forced procedural
>logic when it doesn't need to be included. I don't have the list in a file
>nor do I want it in a file. The idea is that the caller should not need to be
>exposed to patternset syntax and should only need to pass in a list
>(separated by commas), of configurations to deploy. The configurations are
>coincident with the names of subfolders containing the projects dependencies.
>The target in question needs to take the list of configurations and deploy
>from all of the subfolders indicated by the list. I could make it such that
>the list didn't tie directly to the folder naming scheme, rather it specified
>individual target names to invoke, but in the interest of doing the simplest
>thing that works I'm trying to incrementally work my way towards that point
>if it is at all necessary.
>---------------------------------------------------
>Clifton C. Craig, Software Engineer
>Intelligent Computer Systems -  A Division of GBG
>ccc@icsaward.com
>ccraig@gbg.com
>
>On Sunday 22 January 2006 12:50 am, Ken Gentle wrote:
> > At 15:57 2006-01-21, you wrote:
> > > >       Here is the error: the includes attribute should contain patterns
> > > > matching the file names you want copied.
> > > > The patterns only match the directories.
> > > >       Try: includes="**/*.jar""
> > >
> > >Tommy,
> > >
> > >I know where the error is my real problem is the property friving
> > >the selector
> > >needs to be a comma separated list which describes the configurations to
> > >deploy. I want to use that value to drive the copy. In other words
> > > changing the comma separated values to resemble a patternset pattern is
> > > not an option. So that leaves me with few options. I can define some
> > > custom task to do a regex replace on the property value appending "/**/*"
> > > sequences on each entry or I can use beanshell with a script task to  do
> > > the same. Neither of those options are what I consider appealing. I
> > > thought I might be overlooking some simple functionality in Ant when I
> > > ran into the problem but it just doesn't seem to easy to copy directories
> > > specified in a CSV list without exposing patternset syntax to the creator
> > > of the list.
> >
> > This will load the file and do the replacements:
> >
> > <project default="default">
> >    <target name="default">
> >      <loadfile srcfile="confs-to-deploy.csv"
> > property="confs-to-deploy-pattern">
> >        <filterchain>
> >          <tokenfilter>
> >            <linetokenizer/>
> >            <replaceregex pattern="([^,]+),?"
> >                          flags="g"
> >                          replace="\1/** "/>
> >          </tokenfilter>
> >        </filterchain>
> >
> >      </loadfile>
> >      <echo>${confs-to-deploy-pattern}</echo>
> >    </target>
> > </project>
> >
> > kgentle@ALPHA $ ant -f prop-regex.xml
> > Buildfile: prop-regex.xml
> >
> > default:
> >       [echo] default/** debug/** prod/**
> >
> > BUILD SUCCESSFUL
> > Total time: 0 seconds
> >
> >
> > Or if you already have the property and you're open to AntContrib
> > tasks, you can use the PropertyRegex to do the replacements:
> >
> > <project default="default">
> >    <taskdef resource="net/sf/antcontrib/antlib.xml">
> >      <classpath>
> >        <pathelement
> > location="../lib/build/ant-contrib-1.0b2/lib/ant-contrib.jar"/>
> >      </classpath>
> >    </taskdef>
> >
> >    <target name="default">
> >      <property name="confs-to-deploy" value="default,debug,prod"/>
> >      <propertyregex property="confs-to-deploy-pattern"
> >                     input="${confs-to-deploy}"
> >                     regexp="([^,]+),?"
> >                     replace="\1/** " />
> >      <echo>${confs-to-deploy-pattern}</echo>
> >    </target>
> > </project>
> >
> > kgentle@ALPHA $ ant -f prop-regex.xml
> > Buildfile: prop-regex.xml
> >
> > default:
> >       [echo] default/** debug/** prod/**
> >
> > BUILD SUCCESSFUL
> > Total time: 0 seconds
> >
> > >---------------------------------------------------
> > >Clifton C. Craig, Software Engineer
> > >Intelligent Computer Systems -  A Division of GBG
> > >ccc@icsaward.com
> > >ccraig@gbg.com
> > >
> > >---------------------------------------------------------------------
> > >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



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


Mime
View raw message