如何仅对已修改的文件执行ANT任务 [英] How to execute ANT tasks on only files that have been modified

查看:185
本文介绍了如何仅对已修改的文件执行ANT任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个构建脚本,做一些事情(最小化javascript,上传到亚马逊s3等)。最小化ANT任务只对我已修改的javascript进行操作,忽略其余的(我没有写这个脚本)。我想为亚马逊s3任务做类似的事情,只有更新的内容在任务中上传。任何关于如何做到这一点的线索将不胜感激。

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.

推荐答案

您可以选择具有修改日期标签的文件集。修改后的标签功能非常强大,请查看: Ant选择器 - 已修改

You can select a fileset with a modified date tag. The modified tag is insanely powerful, so check it out: Ant Selectors - Modified.

为了让它知道发生了什么变化,它可以保存一个属性文件中的缓存,每次成功构建后都会进行更新,除非你使用delayupdate属性 - 所以也许要测试,你可以:

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>

当然,您可以通过命令行参数或其他方式设置该commitUpdate。

And of course you could set that commitUpdate via a command-line param or something.

这篇关于如何仅对已修改的文件执行ANT任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆