I have a build script that does a number of things (minimize javascript, upload to amazon s3 etc). The minimize ANT task only operates on the javascript that I have modified and ignores the rest (I didn't write this script). I would like to do something similar for the amazon s3 task where only the updated content is upload in the task. Any leads on how to do this would be greatly appreciated.
You can select a fileset with a modified date tag. The modified tag is insanely powerful, so check it out: Ant Selectors - Modified.
In order for it to tell what has changed, it can keep a cache in a property file, which updates after each successful build, unless you use the delayupdate attribute - so perhaps to test it, you can have:
<param name="commitUpdate" value="false" />
[...]
<ftp ...>
<fileset dir="src">
<modified delayupdate="${commitUpdate}" />
</fileset>
</ftp>
And of course you could set that commitUpdate via a command-line param or something.
You may want to consider the OutOfDate Ant Task provided by the Ant-contrib library. It allows you to set a sequential/parallel task to execute for each source file in a fileset. You can apply a file mapper to define the target files to test the source files against so only the files that have been modified run the specific sequential/parallel task.
Check out this SO thread:
How to execute an Ant task only when source files have been modified?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With