我在ANT中有一个目标需要在给定的文件集上运行两次编译器:一次用于调试,一次用于生产.我只想在源文件发生变化时运行编译器,所以我设置了一个<modified>选择器.但是,由于我需要为给定的修改文件运行debug和prod任务,所以我update在第一次运行时将该属性设置为false.我有类似的东西:
<!-- Do the debug build -->
<apply executable="compiler">
<fileset dir="${js.src.dir}" includes="*.js">
<!-- don't update the cache so the prod build below works -->
<modified update="false"
seldirs="true"
cache="propertyfile"
algorithm="digest"
comparator="equal">
<param name="cache.cachefile" value="cache.properties"/>
<param name="algorithm.algorithm" value="md5"/>
</modified>
</fileset>
<args for debug build/>
</apply>
<!-- Do the production build -->
<apply executable="compiler">
<fileset dir="${js.src.dir}" includes="*.js">
<modified update="true"
seldirs="true"
cache="propertyfile"
algorithm="digest"
comparator="equal">
<param name="cache.cachefile" value="cache.properties"/>
<param name="algorithm.algorithm" value="md5"/>
</modified>
</fileset>
<args for prod build/>
</apply>
Run Code Online (Sandbox Code Playgroud)
但这不起作用.我对编译器的第一次调用最终会更新缓存,第二次调用将被跳过.我在这里错过了什么?
更新:我通过使用<depend>选择器来解决问题,但仍然很好奇如何使用相同的<modified>
| 归档时间: |
|
| 查看次数: |
1993 次 |
| 最近记录: |