Merge pull request #2348 from arduino/ide-1.5.x-build-xml-refactor

ant build.xml refactor
This commit is contained in:
Cristian Maglie 2014-10-09 09:31:33 +02:00
commit bf6663bc9f
1 changed files with 92 additions and 126 deletions

View File

@ -27,9 +27,6 @@
<condition property="staging_hardware_folder" value="hardware"><equals arg1="${platform}" arg2="linux32" /></condition>
<condition property="staging_hardware_folder" value="hardware"><equals arg1="${platform}" arg2="linux64" /></condition>
<condition property="launch4j-download-unpack-target-name" value="launch4j-windows"><os family="windows" /></condition>
<property name="launch4j-download-unpack-target-name" value="launch4j-linux"/>
<condition property="arch-bits" value="32">
<equals arg1="${platform}" arg2="linux32"/>
</condition>
@ -224,8 +221,11 @@
</copy>
<!-- Unzip AVR tools -->
<antcall target="unzip-avr-toolchain">
<param name="file_arch" value="mac32" />
<antcall target="unzip">
<param name="archive_file" value="${staging_folder}/avr-toolchain-mac32-gcc-4.8.1.zip" />
<param name="archive_url" value="http://downloads.arduino.cc/avr-toolchain-mac32-gcc-4.8.1.zip" />
<param name="final_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/avr" />
<param name="dest_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/avr" />
</antcall>
<!--
@ -252,10 +252,11 @@
<param name="target.path" value="macosx/work/Arduino.app/Contents/Resources/Java" />
</antcall>
<antcall target="unzip-arm-toolchain">
<param name="dist_file" value="gcc-arm-none-eabi-4.8.3-2014q1-mac.tar.gz" />
<param name="dist_url" value="http://downloads.arduino.cc/gcc-arm-none-eabi-4.8.3-2014q1-mac.tar.gz" />
<param name="dist_check_file" value="gcc-arm-none-eabi-4.8.3-2014q1" />
<antcall target="untar">
<param name="archive_file" value="${staging_folder}/dist/gcc-arm-none-eabi-4.8.3-2014q1-mac.tar.gz" />
<param name="archive_url" value="http://downloads.arduino.cc/gcc-arm-none-eabi-4.8.3-2014q1-mac.tar.gz" />
<param name="final_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/gcc-arm-none-eabi-4.8.3-2014q1" />
<param name="dest_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/" />
</antcall>
<delete includeEmptyDirs="true" quiet="true">
@ -265,7 +266,12 @@
<fileset dir="macosx/work/${staging_hardware_folder}/tools" includes="**/man"/>
</delete>
<antcall target="unzip-libastyle" />
<antcall target="unzip">
<param name="archive_file" value="./libastylej-2.04.zip" />
<param name="archive_url" value="http://downloads.arduino.cc/libastylej-2.04.zip" />
<param name="final_folder" value="${staging_folder}/libastylej" />
<param name="dest_folder" value="${staging_folder}" />
</antcall>
<copy file="macosx/libastylej/libastylej.jnilib" todir="macosx/work/Arduino.app/Contents/Resources/Java/lib/" />
<chmod perm="755" file="macosx/work/Arduino.app/Contents/Resources/Java/lib/libastylej.jnilib" />
</target>
@ -479,36 +485,49 @@
<copy todir="linux/work" file="linux/dist/arduino" />
<chmod perm="755" file="linux/work/arduino" />
<antcall target="unzip-libastyle" />
<antcall target="unzip">
<param name="archive_file" value="./libastylej-2.04.zip" />
<param name="archive_url" value="http://downloads.arduino.cc/libastylej-2.04.zip" />
<param name="final_folder" value="${staging_folder}/libastylej" />
<param name="dest_folder" value="${staging_folder}" />
</antcall>
<copy file="linux/libastylej/libastylej${arch-bits}.so" tofile="linux/work/lib/libastylej.so" />
<chmod perm="755" file="linux/work/lib/libastylej.so" />
</target>
<target name="linux32-build" depends="linux-build" description="Build linux (32-bit) version">
<!-- Unzip ARM tools -->
<antcall target="unzip-arm-toolchain">
<param name="dist_file" value="gcc-arm-none-eabi-4.8.3-2014q1-linux32.tar.gz" />
<param name="dist_url" value="http://downloads.arduino.cc/gcc-arm-none-eabi-4.8.3-2014q1-linux32.tar.gz" />
<param name="dist_check_file" value="gcc-arm-none-eabi-4.8.3-2014q1" />
<antcall target="untar">
<param name="archive_file" value="${staging_folder}/dist/gcc-arm-none-eabi-4.8.3-2014q1-linux32.tar.gz" />
<param name="archive_url" value="http://downloads.arduino.cc/gcc-arm-none-eabi-4.8.3-2014q1-linux32.tar.gz" />
<param name="final_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/gcc-arm-none-eabi-4.8.3-2014q1" />
<param name="dest_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/" />
</antcall>
<!-- Unzip AVR tools -->
<antcall target="unzip-avr-toolchain">
<param name="file_arch" value="linux32" />
<antcall target="unzip">
<param name="archive_file" value="${staging_folder}/avr-toolchain-linux32-gcc-4.8.1.zip" />
<param name="archive_url" value="http://downloads.arduino.cc/avr-toolchain-linux32-gcc-4.8.1.zip" />
<param name="final_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/avr" />
<param name="dest_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/avr" />
</antcall>
</target>
<target name="linux64-build" depends="linux-build" description="Build linux (64-bit) version">
<!-- Unzip ARM tools -->
<antcall target="unzip-tool">
<param name="dist_file" value="gcc-arm-none-eabi-4.8.3-2014q1-linux64.tar.gz" />
<param name="dist_url" value="http://downloads.arduino.cc/gcc-arm-none-eabi-4.8.3-2014q1-linux64.tar.gz" />
<param name="dist_check_file" value="gcc-arm-none-eabi-4.8.3-2014q1" />
<antcall target="untar">
<param name="archive_file" value="${staging_folder}/dist/gcc-arm-none-eabi-4.8.3-2014q1-linux64.tar.gz" />
<param name="archive_url" value="http://downloads.arduino.cc/gcc-arm-none-eabi-4.8.3-2014q1-linux64.tar.gz" />
<param name="final_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/gcc-arm-none-eabi-4.8.3-2014q1" />
<param name="dest_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/" />
</antcall>
<!-- Unzip AVR tools -->
<antcall target="unzip-avr-toolchain">
<param name="file_arch" value="linux64" />
<antcall target="unzip">
<param name="archive_file" value="${staging_folder}/avr-toolchain-linux64-gcc-4.8.1.zip" />
<param name="archive_url" value="http://downloads.arduino.cc/avr-toolchain-linux64-gcc-4.8.1.zip" />
<param name="final_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/avr" />
<param name="dest_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/avr" />
</antcall>
</target>
@ -520,112 +539,51 @@
<exec executable="./linux/work/arduino" spawn="false"/>
</target>
<target name="unzip-avr-toolchain">
<get src="http://downloads.arduino.cc/avr-toolchain-${file_arch}-gcc-4.8.1.zip" dest="${staging_folder}" usetimestamp="true" ignoreerrors="true" verbose="true" />
<!-- Set '${dist_file}_available' property if toolchain dist_file is downloaded -->
<!-- Set '${dist_file}_installed' property if toolchain is installed in working directory -->
<!-- hardware/tools/${dist_check_file} is checked for existence -->
<target name="untar-unzip-check">
<available file="${archive_file}" property="${archive_file}_available" />
<available file="${final_folder}" property="${archive_file}_installed" />
</target>
<checksum file="${staging_folder}/avr-toolchain-${file_arch}-gcc-4.8.1.zip" algorithm="sha" fileext=".sha" verifyproperty="checksum.matches"/>
<!-- Retrieve tool -->
<target name="untar-unzip-download" depends="untar-unzip-check" unless="${archive_file}_available">
<get src="${archive_url}" dest="${archive_file}" verbose="true" ignoreerrors="true" />
</target>
<target name="untar-unzip-checksum" depends="untar-unzip-download">
<echo>Testing checksum of "${archive_file}"</echo>
<checksum file="${archive_file}" algorithm="sha" fileext=".sha" verifyproperty="checksum.matches"/>
<condition property="checksum.matches.fail">
<equals arg1="${checksum.matches}" arg2="false"/>
</condition>
<fail if="checksum.matches.fail">Checksum failed.
File avr-toolchain-${file_arch}-gcc-4.8.1.zip failed checksum.
Please remove "${staging_folder}/avr-toolchain-${file_arch}-gcc-4.8.1.zip" and download it again.
File ${archive_file} failed checksum.
Please remove "${archive_file}" to download it again.
</fail>
</target>
<mkdir dir="${staging_folder}/work/${staging_hardware_folder}/tools/avr" />
<!-- Ensure that the tool is downloaded and test checksums, if everything's ok unzip it on the tools folder -->
<target name="untar" depends="untar-unzip-checksum" unless="${archive_file}_installed">
<echo>Unzipping into folder ${dest_folder}</echo>
<exec executable="tar">
<arg value="xf"/>
<arg value="${archive_file}"/>
<arg value="--directory=${dest_folder}"/>
</exec>
</target>
<target name="unzip" depends="untar-unzip-checksum" unless="${archive_file}_installed">
<echo>Unzipping into folder ${dest_folder}</echo>
<mkdir dir="${dest_folder}" />
<exec executable="unzip">
<arg value="-q" />
<arg value="-n" />
<arg value="-d" />
<arg value="${staging_folder}/work/${staging_hardware_folder}/tools/avr" />
<arg value="${staging_folder}/avr-toolchain-${file_arch}-gcc-4.8.1.zip" />
</exec>
</target>
<target name="unzip-libastyle">
<get src="http://downloads.arduino.cc/libastylej-2.04.zip" dest="." usetimestamp="true" ignoreerrors="true" verbose="true" />
<checksum file="libastylej-2.04.zip" algorithm="sha" fileext=".sha" verifyproperty="checksum.matches"/>
<condition property="checksum.matches.fail">
<equals arg1="${checksum.matches}" arg2="false"/>
</condition>
<fail if="checksum.matches.fail">Checksum failed.
File libastylej-2.04.zip failed checksum.
Please remove "libastylej-2.04.zip" and download it again.
</fail>
<unzip src="libastylej-2.04.zip" dest="${staging_folder}" overwrite="true"/>
</target>
<!-- Set '${dist_file}_available' property if toolchain dist_file is downloaded -->
<!-- Set '${dist_file}_installed' property if toolchain is installed in working directory -->
<!-- hardware/tools/${dist_check_file} is checked for existence -->
<target name="check-tool">
<available file="${staging_folder}/dist/${dist_file}" property="${dist_file}_available" />
<available file="${staging_folder}/work/hardware/tools/${dist_check_file}" property="${dist_file}_installed" />
</target>
<!-- Retrieve tool -->
<target name="get-tool" depends="check-tool" unless="${dist_file}_available">
<get src="${dist_url}" dest="${staging_folder}/dist/${dist_file}" verbose="true" ignoreerrors="true" />
</target>
<!-- Ensure that the tool is downloaded and test checksums, if everything's ok unzip it on the tools folder -->
<target name="unzip-tool" depends="get-tool, check-tool" unless="${dist_file}_installed">
<echo>Testing checksum of "${staging_folder}/dist/${dist_file}"</echo>
<checksum file="${staging_folder}/dist/${dist_file}" algorithm="sha" fileext=".sha" verifyproperty="checksum.matches"/>
<condition property="checksum.matches.fail">
<equals arg1="${checksum.matches}" arg2="false"/>
</condition>
<fail if="checksum.matches.fail">Checksum failed.
File ${dist_file} failed checksum.
Please remove "${staging_folder}/dist/${dist_file}" to download it again.
</fail>
<!-- Unzip tool to the destination folder -->
<echo>Unzipping into folder ${staging_folder}/dist/${dist_file}</echo>
<exec executable="tar">
<arg value="xfz"/>
<arg value="${staging_folder}/dist/${dist_file}"/>
<arg value="--directory=${staging_folder}/work/${staging_hardware_folder}/tools/"/>
</exec>
</target>
<!-- Set 'arm_disfile_available' property if ARM toolchain dist_file is downloaded -->
<!-- Set 'arm_toolchain_installed' property if ARM toolchain is installed in working directory -->
<target name="check-arm-toolchain">
<available file="${staging_folder}/dist/${dist_file}" property="arm_distfile_available" />
<available file="${staging_folder}/work/hardware/tools/${dist_check_file}" property="arm_toolchain_installed" />
</target>
<!-- Retrieve ARM toolchain -->
<target name="get-arm-toolchain" depends="check-arm-toolchain" unless="arm_distfile_available">
<get src="${dist_url}" dest="${staging_folder}/dist/${dist_file}" verbose="true" ignoreerrors="true" />
</target>
<target name="unzip-arm-toolchain" depends="get-arm-toolchain, check-arm-toolchain"
unless="arm_toolchain_installed">
<checksum file="${staging_folder}/dist/${dist_file}" algorithm="sha"
fileext=".sha" verifyproperty="checksum.matches"/>
<condition property="checksum.matches.fail">
<equals arg1="${checksum.matches}" arg2="false"/>
</condition>
<fail if="checksum.matches.fail">Checksum failed.
File ${dist_file} failed checksum.
Please remove "${staging_folder}/dist/${dist_file}" to download it again.
</fail>
<!-- Unzip toolchain to the destination folder -->
<exec executable="tar">
<arg value="xfz"/>
<arg value="${staging_folder}/dist/${dist_file}"/>
<arg value="--directory=${staging_folder}/work/${staging_hardware_folder}/tools/"/>
<arg value="${dest_folder}" />
<arg value="${archive_file}" />
</exec>
</target>
@ -659,7 +617,6 @@
<move file="linux/work" tofile="linux/arduino-${version}" />
<exec executable="tar" dir="linux">
<arg value="-z"/>
<arg value="-c"/>
<arg value="-f"/>
<arg value="arduino-${version}-${platform}.tgz"/>
@ -716,7 +673,7 @@
<get src="http://switch.dl.sourceforge.net/project/launch4j/launch4j-3/3.0.2/launch4j-3.0.2-linux.tgz" dest="windows" usetimestamp="true" skipexisting="true" verbose="true" />
<exec executable="tar" dir="windows/launcher">
<arg value="-xzf"/>
<arg value="-xf"/>
<arg value="../launch4j-3.0.2-linux.tgz"/>
</exec>
</target>
@ -749,11 +706,19 @@
</copy>
<!-- Unzip AVR tools -->
<antcall target="unzip-avr-toolchain">
<param name="file_arch" value="win32" />
<antcall target="unzip">
<param name="archive_file" value="${staging_folder}/avr-toolchain-win32-gcc-4.8.1.zip" />
<param name="archive_url" value="http://downloads.arduino.cc/avr-toolchain-win32-gcc-4.8.1.zip" />
<param name="final_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/avr" />
<param name="dest_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/avr" />
</antcall>
<antcall target="unzip-libastyle" />
<antcall target="unzip">
<param name="archive_file" value="./libastylej-2.04.zip" />
<param name="archive_url" value="http://downloads.arduino.cc/libastylej-2.04.zip" />
<param name="final_folder" value="${staging_folder}/libastylej" />
<param name="dest_folder" value="${staging_folder}" />
</antcall>
<copy file="windows/libastylej/AStylej.dll" todir="windows/work/lib" />
<!-- Copy bossac.exe tool -->
@ -792,10 +757,11 @@
</chmod>
<!-- Unzip ARM toolchain -->
<antcall target="unzip-arm-toolchain">
<param name="dist_file" value="gcc-arm-none-eabi-4.8.3-2014q1-windows.tar.gz" />
<param name="dist_url" value="http://downloads.arduino.cc/gcc-arm-none-eabi-4.8.3-2014q1-windows.tar.gz" />
<param name="dist_check_file" value="gcc-arm-none-eabi-4.8.3-2014q1" />
<antcall target="untar">
<param name="archive_file" value="${staging_folder}/dist/gcc-arm-none-eabi-4.8.3-2014q1-windows.tar.gz" />
<param name="archive_url" value="http://downloads.arduino.cc/gcc-arm-none-eabi-4.8.3-2014q1-windows.tar.gz" />
<param name="final_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/gcc-arm-none-eabi-4.8.3-2014q1" />
<param name="dest_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/" />
</antcall>
<delete includeEmptyDirs="true" quiet="true">