如今愈来愈多的人用mac原本开发android的程序,那么在用ant打包时,咱们该如何去修改condition,以便打包成功呢?多说无益,下面直接写测试代码。android
<?xml version="1.0"?> <!-- build.xml 测试的Ant脚原本演示如何在不一样的操做系统下有条件地运行Ant 任务。测试适用于Mac,Windows或Unix系统。 --> <project default="GO" name="Ant Operating System Conditional Test" > <!-- first create our properties --> <condition property="isMac"> <os family="mac" /> </condition> <condition property="isWindows"> <os family="windows" /> </condition> <condition property="isUnix"> <os family="unix" /> </condition> <!-- now create our operating system specific targets --> <target name="doMac" if="isMac"> <echo message="Came into the Mac target" /> <!-- do whatever you want to do here for Mac systems --> </target> <target name="doWindows" if="isWindows"> <echo message="Came into the Windows target" /> </target> <target name="doUnix" if="isUnix"> <echo message="Came into the Unix target" /> </target> <!-- run everything from our main target --> <!-- the other targets will only be run when their properties are true --> <target name="GO" depends="doMac, doWindows, doUnix"> <echo message="Running GO target" /> <echo message="os.name = ${os.name}" /> <echo message="os.arch = ${os.arch}" /> <echo message="os.version = ${os.version}" /> </target> </project>