SHARE
TWEET

How to determine build architecture (32bit / 64bit) with ant

a guest Feb 28th, 2012 276 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ant -Dbuild.target=32 dist
  2.        
  3. ant -Dbuild.target=64 dist
  4.        
  5. <var name ="os.bitness" value ="unknown"/>
  6. <if>
  7. <os family="windows"/>
  8. <then>
  9.     <exec dir="." executable="cmd" outputproperty="command.ouput">
  10.         <arg line="/c SET ProgramFiles(x86)"/>
  11.     </exec>
  12.     <if>
  13.         <contains string="${command.ouput}" substring="Program Files (x86)"/>
  14.         <then>
  15.             <var name ="os.bitness" value ="64"/>
  16.         </then>
  17.         <else>
  18.             <var name ="os.bitness" value ="32"/>
  19.         </else>
  20.     </if>
  21. </then>
  22. <elseif>
  23.     <os family="unix"/>
  24.     <then>
  25.         <exec dir="." executable="/bin/sh" outputproperty="command.ouput">
  26.         <arg line="/c uname -m"/>
  27.         </exec>
  28.         <if>
  29.             <contains string="${command.ouput}" substring="_64"/>
  30.             <then>
  31.                 <var name ="os.bitness" value ="64"/>
  32.             </then>
  33.             <else>
  34.                 <var name ="os.bitness" value ="32"/>
  35.             </else>
  36.         </if>
  37.     </then>
  38. </elseif>
  39. </if>
  40.  
  41. <echo>OS bitness: ${os.bitness}</echo>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top