ant的condition任务
1、istrue isfalse:断言 真 假
- <project name="testCondition">
- <target name="test">
- <condition property="scondition">
- <istrue value="true"/>
- </condition>
- <antcall target="isTrue"></antcall>
- <antcall target="isFalse"></antcall>
- </target>
- <target name="isTrue" if="scondition">
- <echo>is ture</echo>
- </target>
- <target name="isFalse" unless="scondition">
- <echo>is false</echo>
- </target>
- </project>
2、逻辑运算
2.1、not 逻辑非
- <project name="testCondition" default="test">
- <target name="test">
- <condition property="scondition">
- <not>
- <istrue value="true"/>
- </not>
- </condition>
- <antcall target="isTrue"></antcall>
- <antcall target="isFalse"></antcall>
- </target>
- <target name="isTrue" if="scondition">
- <echo>is ture</echo>
- </target>
- <target name="isFalse" unless="scondition">
- <echo>is false</echo>
- </target>
- </project>
2.2、and 逻辑与
- <project name="testCondition" default="test">
- <target name="test">
- <condition property="scondition">
- <and>
- <istrue value="true"/>
- <istrue value="false"/>
- </and>
- </condition>
- <antcall target="isTrue"></antcall>
- <antcall target="isFalse"></antcall>
- </target>
- <target name="isTrue" if="scondition">
- <echo>is ture</echo>
- </target>
- <target name="isFalse" unless="scondition">
- <echo>is false</echo>
- </target>
- </project>
2.3、or 逻辑或 xor异或 (语法上与and类似)
3、available 是否可用
- <project name="testCondition" default="test">
- <path id="all.test.classes">
- <pathelement location="bin"/>
- </path>
- <target name="test">
- <condition property="scondition">
- <!--在指定的classpath路径下是否存在资源 TestTest.class-->
- <available resource="TestTest.class">
- <classpath refid="all.test.classes" />
- </available>
- </condition>
- <antcall target="isTrue"></antcall>
- <antcall target="isFalse"></antcall>
- </target>
- <target name="isTrue" if="scondition">
- <echo>is ture</echo>
- </target>
- <target name="isFalse" unless="scondition">
- <echo>is false</echo>
- </target>
- </project>
4、isset 指定属性是否存在
- <project name="testCondition" default="test">
- <!--属性也能够通过ant參数-D来设置-->
- <property name="name" value="this is name"/>
- <target name="test">
- <condition property="scondition">
- <!--假设属性name不存在则返回false-->
- <isset property="name"/>
- </condition>
- <antcall target="isTrue"></antcall>
- <antcall target="isFalse"></antcall>
- </target>
- <target name="isTrue" if="scondition">
- <echo>is ture</echo>
- </target>
- <target name="isFalse" unless="scondition">
- <echo>is false</echo>
- </target>
- </project>
5、equals 是否相等
- <project name="testCondition">
- <!--属性也能够通过ant參数-D来设置-->
- <property name="name" value="this is name"/>
- <target name="test">
- <condition property="scondition">
- <!--假设arg1的值与arg2的值相等返回true,否则为false-->
- <equals arg1="${name}" arg2="this is name"/>
- </condition>
- <antcall target="isTrue"></antcall>
- <antcall target="isFalse"></antcall>
- </target>
- <target name="isTrue" if="scondition">
- <echo>is ture</echo>
- </target>
- <target name="isFalse" unless="scondition">
- <echo>is false</echo>
- </target>
- </project>
6、filesmatch 比較文件
- <project name="testCondition">
- <target name="test">
- <condition property="scondition">
- <!--假设file1所代表的文件与file2所代表的文件相等返回true,否则为false-->
- <filesmatch file1="testfile1.txt" file2="testfile2.txt"/>
- </condition>
- <antcall target="isTrue"></antcall>
- <antcall target="isFalse"></antcall>
- </target>
- <target name="isTrue" if="scondition">
- <echo>is ture</echo>
- </target>
- <target name="isFalse" unless="scondition">
- <echo>is false</echo>
- </target>
- </project>
ant的condition任务的更多相关文章
- 从源码角度深入分析ant
Ant的基本概念 首先是ant的基本概念:Project,Target,Tasks,Properties,Paths 1.Project <project> build.xml文件最顶层的 ...
- 从源码角度深入分析 ant
[转自] http://www.tuicool.com/articles/eQvIRbA Ant的基本概念 首先是ant的基本概念: Project,Target,Tasks,Properties,P ...
- React Native初试:Windows下Andriod环境搭建
最近想写个App,又觉得Native App 太无趣了Web App又没那么成熟然后发现了Facebook在9月发布的React Native比较新奇,所以决定捣鼓看看: React Native为F ...
- ANDROID STUDIO, GRADLE AND NDK INTEGRATION
Originally posted on:http://ph0b.com/android-studio-gradle-and-ndk-integration/ With the recent chan ...
- NDK 开发实例二(添加 Eigen库)
上一篇,我已经阐述了如何创建一个简单的NDK实例: NDK 开发实例一(Android.mk环境配置下) 在上一篇的基础上,我们来添加Eigen库,然后做一个简单实例. Eigen是一个高层次的C + ...
- NetBeans部署项目(Extjs)报错(一)
NetBeans部署项目(Extjs)报错(一) 1.用NetBeans将项目部署到Tomcat中,报错. 具体如下: ant -f D:\\NetBeans\\workspace\\Foundati ...
- Cocos2d-x游戏导出android工程,提取cocos的so文件
Cocos2d-x游戏导出android工程,提取cocos的so文件 原本cocos游戏的android工程编译时,需要将cocos的库文件进行编译,这些文件大部分是cpp文件, 使用ndk ...
- React Native Android入门实战及深入源代码分析系列(2)——React Native源代码编译
本文为老曾原创.转载需注明出处:viewmode=contents">http://blog.csdn.net/minimicall?viewmode=contents 在上一节中,我 ...
- Android 使用OpenCV的三种方式(Android Studio)
http://blog.csdn.net/sbsujjbcy/article/details/49520791 其实最早接触OpenCV是很久很久之前的事了,大概在2013年的5,6月份,当时还是个菜 ...
随机推荐
- POJ 1325 Machine Schedule(zoj 1364) 最小覆盖数
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=364 http://poj.org/problem?id=1325 题目大意: ...
- 【CS Round #48 (Div. 2 only)】Water Volume
[链接]h在这里写链接 [题意] 在这里写题意 [题解] 枚举0在哪个位置就好. [错的次数] 0 [反思] 在这了写反思 [代码] #include <bits/stdc++.h> us ...
- Maven学习总结(17)——深入理解maven灵活的构建
一个优秀的构建系统必须足够灵活,应该能够让项目在不同的环境下都能成功构建.maven为了支持构建的灵活性,内置了三大特性,即:属性.profile和资源过滤. 1.maven属性 maven属性分6类 ...
- BestCoder Round #11 (Div. 2) 前三题题解
题目链接: huangjing hdu5054 Alice and Bob 思路: 就是(x,y)在两个參考系中的表示演全然一样.那么仅仅可能在这个矩形的中点.. 题目: Alice and Bob ...
- PatentTips - SNMP firewall
BACKGROUND OF THE INVENTION [0001] The present invention relates to communications and, more particu ...
- dll = MinGW gcc 生成动态链接库 dll 的一些问题汇总
MinGW gcc 生成动态链接库 dll 的一些问题汇总 https://blog.csdn.net/liyuanbhu/article/details/42612365 网络上关于用 MinGW ...
- JAVA中try-catch异常逃逸
有时候一些小的细节,确实比较纠结,对于try-catch-finally代码块中代码依次执行,当try中有exception抛出时,将会有catch拦截并执行,如果没有catch区块,那么except ...
- [Angular2] Map keyboards events to Function
The idea is when we tape the arrow keys on the keyboard, we want the ball move accodingly. const lef ...
- 【u011】乘法难题
Time Limit: 1 second Memory Limit: 128 MB [问题描述] 乘法难题是一种用一行的卡片来玩的单人游戏,每张卡片上有一个正整数.在游戏者从中拿出一卡片,并且得到一个 ...
- React Native 四:图片
一.展示图片资源 1.在ReactNative中.图片使用Image组件进行展示,以下我们就以静态.混合和网络资源等多种方式演示图片展示. 2.将图片放在代码目录img处: