Skip to content

Commit bf6663b

Browse files
committed
Merge pull request #2348 from arduino/ide-1.5.x-build-xml-refactor
ant build.xml refactor
2 parents b6a4c81 + f607454 commit bf6663b

File tree

1 file changed

+85
-119
lines changed

1 file changed

+85
-119
lines changed

build/build.xml

Lines changed: 85 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@
2727
<condition property="staging_hardware_folder" value="hardware"><equals arg1="${platform}" arg2="linux32" /></condition>
2828
<condition property="staging_hardware_folder" value="hardware"><equals arg1="${platform}" arg2="linux64" /></condition>
2929

30-
<condition property="launch4j-download-unpack-target-name" value="launch4j-windows"><os family="windows" /></condition>
31-
<property name="launch4j-download-unpack-target-name" value="launch4j-linux"/>
32-
3330
<condition property="arch-bits" value="32">
3431
<equals arg1="${platform}" arg2="linux32"/>
3532
</condition>
@@ -224,8 +221,11 @@
224221
</copy>
225222

226223
<!-- Unzip AVR tools -->
227-
<antcall target="unzip-avr-toolchain">
228-
<param name="file_arch" value="mac32" />
224+
<antcall target="unzip">
225+
<param name="archive_file" value="${staging_folder}/avr-toolchain-mac32-gcc-4.8.1.zip" />
226+
<param name="archive_url" value="http://downloads.arduino.cc/avr-toolchain-mac32-gcc-4.8.1.zip" />
227+
<param name="final_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/avr" />
228+
<param name="dest_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/avr" />
229229
</antcall>
230230

231231
<!--
@@ -252,10 +252,11 @@
252252
<param name="target.path" value="macosx/work/Arduino.app/Contents/Resources/Java" />
253253
</antcall>
254254

255-
<antcall target="unzip-arm-toolchain">
256-
<param name="dist_file" value="gcc-arm-none-eabi-4.8.3-2014q1-mac.tar.gz" />
257-
<param name="dist_url" value="http://downloads.arduino.cc/gcc-arm-none-eabi-4.8.3-2014q1-mac.tar.gz" />
258-
<param name="dist_check_file" value="gcc-arm-none-eabi-4.8.3-2014q1" />
255+
<antcall target="untar">
256+
<param name="archive_file" value="${staging_folder}/dist/gcc-arm-none-eabi-4.8.3-2014q1-mac.tar.gz" />
257+
<param name="archive_url" value="http://downloads.arduino.cc/gcc-arm-none-eabi-4.8.3-2014q1-mac.tar.gz" />
258+
<param name="final_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/gcc-arm-none-eabi-4.8.3-2014q1" />
259+
<param name="dest_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/" />
259260
</antcall>
260261

261262
<delete includeEmptyDirs="true" quiet="true">
@@ -265,7 +266,12 @@
265266
<fileset dir="macosx/work/${staging_hardware_folder}/tools" includes="**/man"/>
266267
</delete>
267268

268-
<antcall target="unzip-libastyle" />
269+
<antcall target="unzip">
270+
<param name="archive_file" value="./libastylej-2.04.zip" />
271+
<param name="archive_url" value="http://downloads.arduino.cc/libastylej-2.04.zip" />
272+
<param name="final_folder" value="${staging_folder}/libastylej" />
273+
<param name="dest_folder" value="${staging_folder}" />
274+
</antcall>
269275
<copy file="macosx/libastylej/libastylej.jnilib" todir="macosx/work/Arduino.app/Contents/Resources/Java/lib/" />
270276
<chmod perm="755" file="macosx/work/Arduino.app/Contents/Resources/Java/lib/libastylej.jnilib" />
271277
</target>
@@ -479,36 +485,49 @@
479485
<copy todir="linux/work" file="linux/dist/arduino" />
480486
<chmod perm="755" file="linux/work/arduino" />
481487

482-
<antcall target="unzip-libastyle" />
488+
<antcall target="unzip">
489+
<param name="archive_file" value="./libastylej-2.04.zip" />
490+
<param name="archive_url" value="http://downloads.arduino.cc/libastylej-2.04.zip" />
491+
<param name="final_folder" value="${staging_folder}/libastylej" />
492+
<param name="dest_folder" value="${staging_folder}" />
493+
</antcall>
483494
<copy file="linux/libastylej/libastylej${arch-bits}.so" tofile="linux/work/lib/libastylej.so" />
484495
<chmod perm="755" file="linux/work/lib/libastylej.so" />
485496
</target>
486497

487498
<target name="linux32-build" depends="linux-build" description="Build linux (32-bit) version">
488499
<!-- Unzip ARM tools -->
489-
<antcall target="unzip-arm-toolchain">
490-
<param name="dist_file" value="gcc-arm-none-eabi-4.8.3-2014q1-linux32.tar.gz" />
491-
<param name="dist_url" value="http://downloads.arduino.cc/gcc-arm-none-eabi-4.8.3-2014q1-linux32.tar.gz" />
492-
<param name="dist_check_file" value="gcc-arm-none-eabi-4.8.3-2014q1" />
500+
<antcall target="untar">
501+
<param name="archive_file" value="${staging_folder}/dist/gcc-arm-none-eabi-4.8.3-2014q1-linux32.tar.gz" />
502+
<param name="archive_url" value="http://downloads.arduino.cc/gcc-arm-none-eabi-4.8.3-2014q1-linux32.tar.gz" />
503+
<param name="final_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/gcc-arm-none-eabi-4.8.3-2014q1" />
504+
<param name="dest_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/" />
493505
</antcall>
494506

495507
<!-- Unzip AVR tools -->
496-
<antcall target="unzip-avr-toolchain">
497-
<param name="file_arch" value="linux32" />
508+
<antcall target="unzip">
509+
<param name="archive_file" value="${staging_folder}/avr-toolchain-linux32-gcc-4.8.1.zip" />
510+
<param name="archive_url" value="http://downloads.arduino.cc/avr-toolchain-linux32-gcc-4.8.1.zip" />
511+
<param name="final_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/avr" />
512+
<param name="dest_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/avr" />
498513
</antcall>
499514
</target>
500515

501516
<target name="linux64-build" depends="linux-build" description="Build linux (64-bit) version">
502517
<!-- Unzip ARM tools -->
503-
<antcall target="unzip-tool">
504-
<param name="dist_file" value="gcc-arm-none-eabi-4.8.3-2014q1-linux64.tar.gz" />
505-
<param name="dist_url" value="http://downloads.arduino.cc/gcc-arm-none-eabi-4.8.3-2014q1-linux64.tar.gz" />
506-
<param name="dist_check_file" value="gcc-arm-none-eabi-4.8.3-2014q1" />
518+
<antcall target="untar">
519+
<param name="archive_file" value="${staging_folder}/dist/gcc-arm-none-eabi-4.8.3-2014q1-linux64.tar.gz" />
520+
<param name="archive_url" value="http://downloads.arduino.cc/gcc-arm-none-eabi-4.8.3-2014q1-linux64.tar.gz" />
521+
<param name="final_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/gcc-arm-none-eabi-4.8.3-2014q1" />
522+
<param name="dest_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/" />
507523
</antcall>
508524

509525
<!-- Unzip AVR tools -->
510-
<antcall target="unzip-avr-toolchain">
511-
<param name="file_arch" value="linux64" />
526+
<antcall target="unzip">
527+
<param name="archive_file" value="${staging_folder}/avr-toolchain-linux64-gcc-4.8.1.zip" />
528+
<param name="archive_url" value="http://downloads.arduino.cc/avr-toolchain-linux64-gcc-4.8.1.zip" />
529+
<param name="final_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/avr" />
530+
<param name="dest_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/avr" />
512531
</antcall>
513532
</target>
514533

@@ -520,112 +539,51 @@
520539
<exec executable="./linux/work/arduino" spawn="false"/>
521540
</target>
522541

523-
<target name="unzip-avr-toolchain">
524-
<get src="http://downloads.arduino.cc/avr-toolchain-${file_arch}-gcc-4.8.1.zip" dest="${staging_folder}" usetimestamp="true" ignoreerrors="true" verbose="true" />
525-
526-
<checksum file="${staging_folder}/avr-toolchain-${file_arch}-gcc-4.8.1.zip" algorithm="sha" fileext=".sha" verifyproperty="checksum.matches"/>
527-
<condition property="checksum.matches.fail">
528-
<equals arg1="${checksum.matches}" arg2="false"/>
529-
</condition>
530-
<fail if="checksum.matches.fail">Checksum failed.
531-
532-
File avr-toolchain-${file_arch}-gcc-4.8.1.zip failed checksum.
533-
Please remove "${staging_folder}/avr-toolchain-${file_arch}-gcc-4.8.1.zip" and download it again.
534-
</fail>
535-
536-
<mkdir dir="${staging_folder}/work/${staging_hardware_folder}/tools/avr" />
537-
<exec executable="unzip">
538-
<arg value="-q" />
539-
<arg value="-n" />
540-
<arg value="-d" />
541-
<arg value="${staging_folder}/work/${staging_hardware_folder}/tools/avr" />
542-
<arg value="${staging_folder}/avr-toolchain-${file_arch}-gcc-4.8.1.zip" />
543-
</exec>
544-
</target>
545-
546-
<target name="unzip-libastyle">
547-
<get src="http://downloads.arduino.cc/libastylej-2.04.zip" dest="." usetimestamp="true" ignoreerrors="true" verbose="true" />
548-
549-
<checksum file="libastylej-2.04.zip" algorithm="sha" fileext=".sha" verifyproperty="checksum.matches"/>
550-
<condition property="checksum.matches.fail">
551-
<equals arg1="${checksum.matches}" arg2="false"/>
552-
</condition>
553-
<fail if="checksum.matches.fail">Checksum failed.
554-
555-
File libastylej-2.04.zip failed checksum.
556-
Please remove "libastylej-2.04.zip" and download it again.
557-
</fail>
558-
559-
<unzip src="libastylej-2.04.zip" dest="${staging_folder}" overwrite="true"/>
560-
</target>
561-
562542
<!-- Set '${dist_file}_available' property if toolchain dist_file is downloaded -->
563543
<!-- Set '${dist_file}_installed' property if toolchain is installed in working directory -->
564544
<!-- hardware/tools/${dist_check_file} is checked for existence -->
565-
<target name="check-tool">
566-
<available file="${staging_folder}/dist/${dist_file}" property="${dist_file}_available" />
567-
<available file="${staging_folder}/work/hardware/tools/${dist_check_file}" property="${dist_file}_installed" />
545+
<target name="untar-unzip-check">
546+
<available file="${archive_file}" property="${archive_file}_available" />
547+
<available file="${final_folder}" property="${archive_file}_installed" />
568548
</target>
569549

570550
<!-- Retrieve tool -->
571-
<target name="get-tool" depends="check-tool" unless="${dist_file}_available">
572-
<get src="${dist_url}" dest="${staging_folder}/dist/${dist_file}" verbose="true" ignoreerrors="true" />
551+
<target name="untar-unzip-download" depends="untar-unzip-check" unless="${archive_file}_available">
552+
<get src="${archive_url}" dest="${archive_file}" verbose="true" ignoreerrors="true" />
573553
</target>
574554

575-
<!-- Ensure that the tool is downloaded and test checksums, if everything's ok unzip it on the tools folder -->
576-
<target name="unzip-tool" depends="get-tool, check-tool" unless="${dist_file}_installed">
577-
<echo>Testing checksum of "${staging_folder}/dist/${dist_file}"</echo>
578-
<checksum file="${staging_folder}/dist/${dist_file}" algorithm="sha" fileext=".sha" verifyproperty="checksum.matches"/>
555+
<target name="untar-unzip-checksum" depends="untar-unzip-download">
556+
<echo>Testing checksum of "${archive_file}"</echo>
557+
<checksum file="${archive_file}" algorithm="sha" fileext=".sha" verifyproperty="checksum.matches"/>
579558
<condition property="checksum.matches.fail">
580559
<equals arg1="${checksum.matches}" arg2="false"/>
581560
</condition>
582561
<fail if="checksum.matches.fail">Checksum failed.
583562

584-
File ${dist_file} failed checksum.
585-
Please remove "${staging_folder}/dist/${dist_file}" to download it again.
563+
File ${archive_file} failed checksum.
564+
Please remove "${archive_file}" to download it again.
586565
</fail>
566+
</target>
587567

588-
<!-- Unzip tool to the destination folder -->
589-
<echo>Unzipping into folder ${staging_folder}/dist/${dist_file}</echo>
568+
<!-- Ensure that the tool is downloaded and test checksums, if everything's ok unzip it on the tools folder -->
569+
<target name="untar" depends="untar-unzip-checksum" unless="${archive_file}_installed">
570+
<echo>Unzipping into folder ${dest_folder}</echo>
590571
<exec executable="tar">
591-
<arg value="xfz"/>
592-
<arg value="${staging_folder}/dist/${dist_file}"/>
593-
<arg value="--directory=${staging_folder}/work/${staging_hardware_folder}/tools/"/>
572+
<arg value="xf"/>
573+
<arg value="${archive_file}"/>
574+
<arg value="--directory=${dest_folder}"/>
594575
</exec>
595576
</target>
596577

597-
598-
599-
<!-- Set 'arm_disfile_available' property if ARM toolchain dist_file is downloaded -->
600-
<!-- Set 'arm_toolchain_installed' property if ARM toolchain is installed in working directory -->
601-
<target name="check-arm-toolchain">
602-
<available file="${staging_folder}/dist/${dist_file}" property="arm_distfile_available" />
603-
<available file="${staging_folder}/work/hardware/tools/${dist_check_file}" property="arm_toolchain_installed" />
604-
</target>
605-
606-
<!-- Retrieve ARM toolchain -->
607-
<target name="get-arm-toolchain" depends="check-arm-toolchain" unless="arm_distfile_available">
608-
<get src="${dist_url}" dest="${staging_folder}/dist/${dist_file}" verbose="true" ignoreerrors="true" />
609-
</target>
610-
611-
<target name="unzip-arm-toolchain" depends="get-arm-toolchain, check-arm-toolchain"
612-
unless="arm_toolchain_installed">
613-
<checksum file="${staging_folder}/dist/${dist_file}" algorithm="sha"
614-
fileext=".sha" verifyproperty="checksum.matches"/>
615-
<condition property="checksum.matches.fail">
616-
<equals arg1="${checksum.matches}" arg2="false"/>
617-
</condition>
618-
<fail if="checksum.matches.fail">Checksum failed.
619-
620-
File ${dist_file} failed checksum.
621-
Please remove "${staging_folder}/dist/${dist_file}" to download it again.
622-
</fail>
623-
624-
<!-- Unzip toolchain to the destination folder -->
625-
<exec executable="tar">
626-
<arg value="xfz"/>
627-
<arg value="${staging_folder}/dist/${dist_file}"/>
628-
<arg value="--directory=${staging_folder}/work/${staging_hardware_folder}/tools/"/>
578+
<target name="unzip" depends="untar-unzip-checksum" unless="${archive_file}_installed">
579+
<echo>Unzipping into folder ${dest_folder}</echo>
580+
<mkdir dir="${dest_folder}" />
581+
<exec executable="unzip">
582+
<arg value="-q" />
583+
<arg value="-n" />
584+
<arg value="-d" />
585+
<arg value="${dest_folder}" />
586+
<arg value="${archive_file}" />
629587
</exec>
630588
</target>
631589

@@ -659,7 +617,6 @@
659617
<move file="linux/work" tofile="linux/arduino-${version}" />
660618

661619
<exec executable="tar" dir="linux">
662-
<arg value="-z"/>
663620
<arg value="-c"/>
664621
<arg value="-f"/>
665622
<arg value="arduino-${version}-${platform}.tgz"/>
@@ -716,7 +673,7 @@
716673
<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" />
717674

718675
<exec executable="tar" dir="windows/launcher">
719-
<arg value="-xzf"/>
676+
<arg value="-xf"/>
720677
<arg value="../launch4j-3.0.2-linux.tgz"/>
721678
</exec>
722679
</target>
@@ -749,11 +706,19 @@
749706
</copy>
750707

751708
<!-- Unzip AVR tools -->
752-
<antcall target="unzip-avr-toolchain">
753-
<param name="file_arch" value="win32" />
709+
<antcall target="unzip">
710+
<param name="archive_file" value="${staging_folder}/avr-toolchain-win32-gcc-4.8.1.zip" />
711+
<param name="archive_url" value="http://downloads.arduino.cc/avr-toolchain-win32-gcc-4.8.1.zip" />
712+
<param name="final_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/avr" />
713+
<param name="dest_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/avr" />
754714
</antcall>
755715

756-
<antcall target="unzip-libastyle" />
716+
<antcall target="unzip">
717+
<param name="archive_file" value="./libastylej-2.04.zip" />
718+
<param name="archive_url" value="http://downloads.arduino.cc/libastylej-2.04.zip" />
719+
<param name="final_folder" value="${staging_folder}/libastylej" />
720+
<param name="dest_folder" value="${staging_folder}" />
721+
</antcall>
757722
<copy file="windows/libastylej/AStylej.dll" todir="windows/work/lib" />
758723

759724
<!-- Copy bossac.exe tool -->
@@ -792,10 +757,11 @@
792757
</chmod>
793758

794759
<!-- Unzip ARM toolchain -->
795-
<antcall target="unzip-arm-toolchain">
796-
<param name="dist_file" value="gcc-arm-none-eabi-4.8.3-2014q1-windows.tar.gz" />
797-
<param name="dist_url" value="http://downloads.arduino.cc/gcc-arm-none-eabi-4.8.3-2014q1-windows.tar.gz" />
798-
<param name="dist_check_file" value="gcc-arm-none-eabi-4.8.3-2014q1" />
760+
<antcall target="untar">
761+
<param name="archive_file" value="${staging_folder}/dist/gcc-arm-none-eabi-4.8.3-2014q1-windows.tar.gz" />
762+
<param name="archive_url" value="http://downloads.arduino.cc/gcc-arm-none-eabi-4.8.3-2014q1-windows.tar.gz" />
763+
<param name="final_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/gcc-arm-none-eabi-4.8.3-2014q1" />
764+
<param name="dest_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/" />
799765
</antcall>
800766

801767
<delete includeEmptyDirs="true" quiet="true">

0 commit comments

Comments
 (0)