检查文件集中所有文件都包含在蚂蚁串 [英] check all files in fileset contain a string in ant

查看:99
本文介绍了检查文件集中所有文件都包含在蚂蚁串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以提供一个Ant构建它检查如果一个文件集的所有文件包含一些象征性的,并且不包含一些其它记号?的例子

Can anyone provide an example of an ant build which checks if all files found by a fileset contain some token and do not contain some other token?

(谷歌一直没有用这个非常有用的,所以我在这里...)

(google has not been very useful with this, so here I am...)

推荐答案

我觉得这个可以使用Ant的 resourcecontains 的条件做,但我不知道它接受多个资源(见的文档详情)。但是,它是可以做到用 resourcecount contition:

I think this can be done using ant's resourcecontains condition, but I'm not sure it accept multiple resources (see the docs for details). However, it can be done using resourcecount contition:

<project name="Test" default="main" basedir=".">

  <patternset id="filestotest">
    <include name="*.c"/>
  </patternset>

  <target name="main">
    <condition property="contain">
      <resourcecount when="greater" count="0">
        <fileset dir=".">
          <patternset refid="filestotest"/>
          <contains text="main" casesensitive="yes"/>
        </fileset>
      </resourcecount>
    </condition>
    <condition property="donotcontain">
      <isfalse value="${contain}"/>
    </condition>
    <echo message="${contain}"/>
    <echo message="${donotcontain}"/>
  </target>
</project>

您可以使用&LT; resourcecount时=平等数=0方式&gt; 来测试另一个令牌相反的条件

You can use <resourcecount when="equal" count="0"> to test for the opposite condition for another token.

这篇关于检查文件集中所有文件都包含在蚂蚁串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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