I have a Gradle build script that successfully creates my project and compiles all the artifacts I need.
However, in several cases, I would like to give other developers the opportunity to fix some of the files. For example, in one of the archives there is an xml file with information about database bindings - some of the developers use other versions (or even engines) and must change them before they can use the assembly output.
Instead of making changes to the version control file, which they might have made by mistake, I would like to give them the opportunity to have a local, individual patch file to which the script assembly applies.
In the old ant script, we did something like this
<target name="appcontext-patch" if="applicationContext.patch.file"> <patch patchfile="${applicationContext.patch.file}" originalfile="${dist.dir}/applicationContext.xml"/> </target>
but I can't figure out how to make an equivalent in Gradle. Is there a better (i.e. more idiomatic) way to do this than trying to directly convert this to an ant.patch call?
Some context
This is how the file gets to the archive in the first place:
into('META-INF') { from 'deployment', { include 'applicationContext.xml' rename { fn -> "jboss-spring.xml" } } }
It would be fantastic if I could just do something like
into('META-INF') { from 'deployment', { include 'applicationContext.xml' rename { fn -> "jboss-spring.xml' } patch 'local/applicationContext.xml.patch' } }
and the patch file is applied before the file is archived. I don't mind writing code to make this possible, but I'm completely new to Gradle, and I don't know where to start.