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

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

问题描述

我有一个构建脚本,可以做很多事情(最小化 javascript,上传到 amazon 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 Selectors - Modified.

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天全站免登陆