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月份,当时还是个菜 ...
随机推荐
- springboot整合freemarker(转)
添加依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>sp ...
- 使用四种框架分别实现百万websocket常连接的服务器--转
原文地址:http://colobu.com/2015/05/22/implement-C1000K-servers-by-spray-netty-undertow-and-node-js/#Nett ...
- MongoDb 查询时常用方法
Query.All("name", "a", "b");//通过多个元素来匹配数组Query.And(Query.EQ("name ...
- 【习题 5-6 UVA-1595】Symmetry
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 每一个y坐标的点都找中点. 看看中点是不是都一样就好. [代码] #include <bits/stdc++.h> us ...
- Nginx+Memcached+Tomcat集群配置(MSM--win7 64bit)
本次主要是在win7 64 上演示操作. web应用构建 Memcached安装配置启动 Tomcat配置 所需jar包 memcached-session-manager 序列化 contextxm ...
- TensorFlow on Windows: “Couldn't open CUDA library cudnn64_5.dll”
TensorFlow on Windows: "Couldn't open CUDA library cudnn64_5.dll" 在 windows 下,使用 import te ...
- 线程堆栈大小 pthread_attr_setstacksize 的使用
pthread_create 创建线程时,若不指定分配堆栈大小,系统会分配默认值,查看默认值方法如下: # ulimit -s8192# 上述表示为8M:单位为KB. 也可以通过# ulimit -a ...
- glide 安装
glide是go的一个包管理工具 参考了 https://studygolang.com/articles/10453?fr=email 遇到的问题是,用了 go get githubXXXXX去下载 ...
- PatentTips - Highly-available OSPF routing protocol
BACKGROUND OF THE INVENTION FIG. 1A is a simplified block diagram schematically representing a typic ...
- 超级牛X的免费开源小工具之tldr
github介绍:http://tldr-pages.github.io/ github源码:https://github.com/tldr-pages/tldr 什么是tldr? 新命令行世界?还是 ...