Skip to content

Commit 30d4c89

Browse files
author
Federico Fissore
committed
build.xml: made untar-tool (and dependencies) easier to reuse
1 parent 24be377 commit 30d4c89

File tree

1 file changed

+33
-29
lines changed

1 file changed

+33
-29
lines changed

build/build.xml

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,11 @@
252252
<param name="target.path" value="macosx/work/Arduino.app/Contents/Resources/Java" />
253253
</antcall>
254254

255-
<antcall target="untar-tool">
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">
@@ -486,10 +487,11 @@
486487

487488
<target name="linux32-build" depends="linux-build" description="Build linux (32-bit) version">
488489
<!-- Unzip ARM tools -->
489-
<antcall target="untar-tool">
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" />
490+
<antcall target="untar">
491+
<param name="archive_file" value="${staging_folder}/dist/gcc-arm-none-eabi-4.8.3-2014q1-linux32.tar.gz" />
492+
<param name="archive_url" value="http://downloads.arduino.cc/gcc-arm-none-eabi-4.8.3-2014q1-linux32.tar.gz" />
493+
<param name="final_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/gcc-arm-none-eabi-4.8.3-2014q1" />
494+
<param name="dest_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/" />
493495
</antcall>
494496

495497
<!-- Unzip AVR tools -->
@@ -500,10 +502,11 @@
500502

501503
<target name="linux64-build" depends="linux-build" description="Build linux (64-bit) version">
502504
<!-- Unzip ARM tools -->
503-
<antcall target="untar-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" />
505+
<antcall target="untar">
506+
<param name="archive_file" value="${staging_folder}/dist/gcc-arm-none-eabi-4.8.3-2014q1-linux64.tar.gz" />
507+
<param name="archive_url" value="http://downloads.arduino.cc/gcc-arm-none-eabi-4.8.3-2014q1-linux64.tar.gz" />
508+
<param name="final_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/gcc-arm-none-eabi-4.8.3-2014q1" />
509+
<param name="dest_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/" />
507510
</antcall>
508511

509512
<!-- Unzip AVR tools -->
@@ -562,35 +565,35 @@
562565
<!-- Set '${dist_file}_available' property if toolchain dist_file is downloaded -->
563566
<!-- Set '${dist_file}_installed' property if toolchain is installed in working directory -->
564567
<!-- 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" />
568+
<target name="untar-unzip-check">
569+
<available file="${archive_file}" property="${archive_file}_available" />
570+
<available file="${final_folder}" property="${archive_file}_installed" />
568571
</target>
569572

570573
<!-- 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" />
574+
<target name="untar-unzip-download" depends="untar-unzip-check" unless="${archive_file}_available">
575+
<get src="${archive_url}" dest="${archive_file}" verbose="true" ignoreerrors="true" />
573576
</target>
574577

575578
<!-- Ensure that the tool is downloaded and test checksums, if everything's ok unzip it on the tools folder -->
576-
<target name="untar-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"/>
579+
<target name="untar" depends="untar-unzip-download" unless="${dist_file}_installed">
580+
<echo>Testing checksum of "${archive_file}"</echo>
581+
<checksum file="${archive_file}" algorithm="sha" fileext=".sha" verifyproperty="checksum.matches"/>
579582
<condition property="checksum.matches.fail">
580583
<equals arg1="${checksum.matches}" arg2="false"/>
581584
</condition>
582585
<fail if="checksum.matches.fail">Checksum failed.
583586

584-
File ${dist_file} failed checksum.
585-
Please remove "${staging_folder}/dist/${dist_file}" to download it again.
587+
File ${archive_file} failed checksum.
588+
Please remove "${archive_file}" to download it again.
586589
</fail>
587590

588591
<!-- Unzip tool to the destination folder -->
589-
<echo>Unzipping into folder ${staging_folder}/dist/${dist_file}</echo>
592+
<echo>Unzipping into folder ${dest_folder}</echo>
590593
<exec executable="tar">
591594
<arg value="xfz"/>
592-
<arg value="${staging_folder}/dist/${dist_file}"/>
593-
<arg value="--directory=${staging_folder}/work/${staging_hardware_folder}/tools/"/>
595+
<arg value="${archive_file}"/>
596+
<arg value="--directory=${dest_folder}"/>
594597
</exec>
595598
</target>
596599

@@ -771,10 +774,11 @@
771774
</chmod>
772775

773776
<!-- Unzip ARM toolchain -->
774-
<antcall target="untar-tool">
775-
<param name="dist_file" value="gcc-arm-none-eabi-4.8.3-2014q1-windows.tar.gz" />
776-
<param name="dist_url" value="http://downloads.arduino.cc/gcc-arm-none-eabi-4.8.3-2014q1-windows.tar.gz" />
777-
<param name="dist_check_file" value="gcc-arm-none-eabi-4.8.3-2014q1" />
777+
<antcall target="untar">
778+
<param name="archive_file" value="${staging_folder}/dist/gcc-arm-none-eabi-4.8.3-2014q1-windows.tar.gz" />
779+
<param name="archive_url" value="http://downloads.arduino.cc/gcc-arm-none-eabi-4.8.3-2014q1-windows.tar.gz" />
780+
<param name="final_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/gcc-arm-none-eabi-4.8.3-2014q1" />
781+
<param name="dest_folder" value="${staging_folder}/work/${staging_hardware_folder}/tools/" />
778782
</antcall>
779783

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

0 commit comments

Comments
 (0)