我需要处理一个目录,如果它有至少有一个修改过的文件。 我写道,减少了文件集中包含这些文件的目录的唯一列表块,但我认为这将是更容易,如果有办法做到这一点,而无需脚本。
有没有办法?
我需要处理一个目录,如果它有至少有一个修改过的文件。 我写道,减少了文件集中包含这些文件的目录的唯一列表块,但我认为这将是更容易,如果有办法做到这一点,而无需脚本。
有没有办法?
整蛊与核心ANT做到这一点。
下面是使用嵌入式的例子常规脚本:
<project name="demo" default="process-modified-dirs">
<path id="build.path">
<pathelement location="/path/to/groovy-all/jar/groovy-all-2.1.1.jar"/>
</path>
<fileset id="modifiedfiles" dir="src">
<modified/>
</fileset>
<target name="process-modified-dirs">
<taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpathref="build.path"/>
<groovy>
dirs = project.references.modifiedfiles.collect {
new File(it.toString()).parent
}
dirs.unique().each {
ant.echo("Do something with this dir: ${it}")
}
</groovy>
</target>
</project>