On Fri, Feb 20, 2009 at 9:08 AM, Alamgir Kahn <[email protected]> wrote:
> Mike McNally <emmecin...@...> writes:
>
>>
>> I do a similar thing, but with an Ant build rule that concatenates
>> scattered ".props" files into the single amalgamated
>> StripesResources.properties file.
>>
>
> That's cool Mike. Can you make the script available?
I just use a couple of built-in Ant tasks: My Ant build has some
definitions for target directories etc; "classes.dir" is the top of
the tree where my compiled Java classes go. It's also where I dump the
various resource files. Those generally live as .properties files
right at the root of the Java source tree.
So the first thing in the build is a call to the Ant "delete" task to
get rid of the "built" version of the StripesResources property file:
<delete file='${classes.dir}/StripesResources.properties'/>
Again - that deletes the copy of the file that's created by the build,
so that step makes sure we start off with a fresh one. Now they source
side of the tree has the base StripesResources.properties file, more
or less intact as distribued in my case. (This process assumes you've
got a "base" file, which could be empty I guess.)
The next step is to copy over all my random resource files:
<copy todir='${classes.dir}'>
<fileset dir='${src.dir}/java'>
<include name='**/*.properties'/>
<include name='**/*.json'/>
<include name='**/*.yml'/>
</fileset>
</copy>
Finally, this is the good part: find all the "*.props" files in the
Java source tree and concatenate them onto the end of the
"StripesResources.properties" file in the target directory:
<concat destfile='${classes.dir}/StripesResources.properties' append='yes'>
<fileset dir='${src.dir}/java'>
<include name='**/*.props'/>
</fileset>
</concat>
Of course this also does not solve the problem of the same property
being defined in more than one place. I only look in my Java tree, but
it'd be easy to make it scour the .jsp tree too I guess (and more
convenient, sometimes, though I have this vague recollection of
deciding it would get messy).
--
Turtle, turtle, on the ground,
Pink and shiny, turn around.
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users