如今愈來愈多的人用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>