All,
I've reviewed the Apache contributor guidelines, but I'm still not clear as
to how the Ant team manages contributors and code changes. What is the
recommended way to submit a proposed patch to the core classes as well as a
new optional task implementation? In a prior message I send info on this
work, but I think the mail may not have made it out. Here is a better
documented version of the proposal.
I'm interested in any feedback from the development team.
Thanks,
David Dabbs
<macro> Task and Enhancements
What is it
----------
The <macro> task is a general text substution task that is built upon an
enhanced, file buffer-friendly version of Ant's internal substution core. If
you need to customize scripts, config files or any other file at build or
deploy time, then you can probably use <macro>.
Could you provide a Use Case?
---------------------------------
Sure. Your project has several environments it runs in: development, test,
staging and production. By isolating default settings and
envioronmrnt-specifig settings in properties files, one could use <macro> to
perform an environment-specific configuration when deploying the application
to that environment.
What's the Syntax?
--------------------
<!--
template and outfile are mandatory
template is asserted to exist
substitution syntax is identical Ant's, ${name}
-->
<macro template="d:\dev\jakarta-ant\dev.properties.in"
outfile="d:\dev\jakarta-ant\dev.properties.out">
<source order="1" url="props://" />
<!-- use the project.getProperties() Hashtable -->
<source order="1" url="props://user" />
<!-- use the project.getUserProperties() Hashtable -->
<source url="file://d:\dev\jakarta-ant\dev.properties.in" />
<!-- use the properties file specified after the protocol -->
<!--
* property namespace defaults to props:// is no
<source>s are specified
* no other protocols are supported, but http:// and ftp://
could easily be added, if desired
* order is not implemented, as I have yet to test to see if
tag loading order is deterministic
-->
</macro>
What changes to the core were required?
------------------------------------------
I added a replacePropertiesBuffer() 'wrapper' method in ProjectHelper.java
and enhanced the replaceProperties() method. It is now forgiving about
embedded spaces in ${} macros, as well as other tweaks, speedups and error
checks.