Skip to content

Commit 126c79a

Browse files
committed
Replace "unzip/tar" in build.xml by Ant's provided unzip/untar method
Replace the "unzip" and "tar" command used while building Arduino by the unzip and untar method that Ant provides. This fixes #8617, meaning that "ant run" will work again and no files/directories are created with weird permissions and share names anymore.
1 parent a87024d commit 126c79a

File tree

1 file changed

+27
-50
lines changed

1 file changed

+27
-50
lines changed

build/build.xml

Lines changed: 27 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@
282282
<!-- copy hardware folder -->
283283
<target name="assemble-hardware" unless="light_bundle">
284284
<mkdir dir="${target.path}/hardware/arduino" />
285-
<antcall target="untar">
285+
<antcall target="untar-bz2">
286286
<param name="archive_file" value="avr-${AVRCORE-VERSION}.tar.bz2"/>
287287
<param name="archive_url" value="https://downloads.arduino.cc/cores/avr-${AVRCORE-VERSION}.tar.bz2"/>
288288
<param name="final_folder" value="${target.path}/hardware/arduino/avr"/>
@@ -528,9 +528,7 @@
528528
<delete dir="macosx/work/Arduino.app" />
529529

530530
<!-- Unzip unsigned app into working dir -->
531-
<exec executable="unzip" dir="macosx/work" failonerror="true">
532-
<arg line="../arduino-${version}-${platform}.zip" />
533-
</exec>
531+
<unzip src="../arduino-${version}-${platform}.zip" dest="macosx/work"/>
534532

535533
<!-- Unlock keychain file -->
536534
<exec executable="security" dir="macosx/work" failonerror="true">
@@ -895,26 +893,14 @@
895893
<!-- Ensure that the tool is downloaded and test checksums, if everything's ok unzip it on the tools folder -->
896894
<target name="untar" depends="untar-unzip-checksum" unless="${archive_file}_installed">
897895
<echo>Untarring ${archive_file} into folder ${dest_folder}</echo>
898-
<exec executable="tar" failonerror="true">
899-
<arg value="xf"/>
900-
<arg value="${archive_file}"/>
901-
<arg value="--directory=${dest_folder}"/>
902-
</exec>
896+
<untar src="${archive_file}" dest="${dest_folder}"/>
903897
</target>
904-
905-
<target name="unzip" depends="untar-unzip-checksum" unless="${archive_file}_installed">
906-
<echo>Unzipping ${archive_file} into folder ${dest_folder}</echo>
907-
<mkdir dir="${dest_folder}" />
908-
<exec executable="unzip" failonerror="true">
909-
<arg value="-q" />
910-
<arg value="-n" />
911-
<arg value="-d" />
912-
<arg value="${dest_folder}" />
913-
<arg value="${archive_file}" />
914-
</exec>
898+
<target name="untar-bz2" depends="untar-unzip-checksum" unless="${archive_file}_installed">
899+
<echo>Untarring ${archive_file} into folder ${dest_folder}</echo>
900+
<untar src="${archive_file}" dest="${dest_folder}" compression="bzip2"/>
915901
</target>
916902

917-
<target name="unzip-with-ant-task" depends="untar-unzip-checksum" unless="${archive_file}_installed">
903+
<target name="unzip" depends="untar-unzip-checksum" unless="${archive_file}_installed">
918904
<echo>Unzipping ${archive_file} into folder ${dest_folder}</echo>
919905
<mkdir dir="${dest_folder}" />
920906
<unzip src="${archive_file}" dest="${dest_folder}"/>
@@ -994,7 +980,7 @@
994980
</target>
995981

996982
<target name="download-launch4j-windows">
997-
<antcall target="unzip-with-ant-task">
983+
<antcall target="unzip">
998984
<param name="archive_file" value="windows/launch4j-3.9-win32.zip"/>
999985
<param name="archive_url" value="https://downloads.arduino.cc/tools/launch4j-3.9-win32.zip"/>
1000986
<param name="final_folder" value="windows/launcher/launch4j"/>
@@ -1068,7 +1054,7 @@
10681054

10691055
<delete dir="${staging_folder}/arduino-builder-windows" includeemptydirs="true"/>
10701056
<mkdir dir="${staging_folder}/arduino-builder-windows"/>
1071-
<antcall target="unzip-with-ant-task">
1057+
<antcall target="unzip">
10721058
<param name="archive_file" value="./arduino-builder-windows-${ARDUINO-BUILDER-VERSION}.zip" />
10731059
<param name="archive_url" value="https://downloads.arduino.cc/tools/arduino-builder-windows-${ARDUINO-BUILDER-VERSION}.zip" />
10741060
<param name="final_folder" value="${staging_folder}/arduino-builder-windows/arduino-builder.exe" />
@@ -1087,42 +1073,33 @@
10871073
</copy>
10881074
<delete dir="${staging_folder}/arduino-builder-windows" includeemptydirs="true"/>
10891075

1090-
<exec executable="unzip" failonerror="true">
1091-
<arg value="-q" />
1092-
<arg value="-n" />
1093-
<arg value="-j" />
1094-
<arg value="-d" />
1095-
<arg value="windows/work/lib" />
1096-
<arg value="../arduino-core/lib/jna-4.2.2.jar" />
1097-
<arg value="com/sun/jna/win32-x86/jnidispatch.dll" />
1098-
</exec>
1076+
<unzip src="../arduino-core/lib/jna-4.2.2.jar" dest="windows/work/lib">
1077+
<patternset>
1078+
<include name="com/sun/jna/win32-x86/jnidispatch.dll"/>
1079+
</patternset>
1080+
<mapper type="flatten"/>
1081+
</unzip>
10991082
<move file="windows/work/lib/jnidispatch.dll" tofile="windows/work/lib/jnidispatch-4.2.2-win32-x86.dll" />
11001083
<antcall target="make-file-executable">
11011084
<param name="file" value="windows/work/lib/jnidispatch-4.2.2-win32-x86.dll" />
11021085
</antcall>
11031086

1104-
<exec executable="unzip" failonerror="true">
1105-
<arg value="-q" />
1106-
<arg value="-n" />
1107-
<arg value="-j" />
1108-
<arg value="-d" />
1109-
<arg value="windows/work/lib" />
1110-
<arg value="../arduino-core/lib/jssc-2.8.0-arduino3.jar" />
1111-
<arg value="libs/windows/jSSC-2.8_x86.dll" />
1112-
</exec>
1087+
<unzip src="../arduino-core/lib/jssc-2.8.0-arduino3.jar" dest="windows/work/lib">
1088+
<patternset>
1089+
<include name="libs/windows/jSSC-2.8_x86.dll"/>
1090+
</patternset>
1091+
<mapper type="flatten"/>
1092+
</unzip>
11131093
<move file="windows/work/lib/jSSC-2.8_x86.dll" tofile="windows/work/lib/jSSC-2.8_x86.dll" />
11141094
<antcall target="make-file-executable">
11151095
<param name="file" value="windows/work/lib/jSSC-2.8_x86.dll" />
11161096
</antcall>
1117-
<exec executable="unzip" failonerror="true">
1118-
<arg value="-q" />
1119-
<arg value="-n" />
1120-
<arg value="-j" />
1121-
<arg value="-d" />
1122-
<arg value="windows/work/lib" />
1123-
<arg value="../arduino-core/lib/jssc-2.8.0-arduino3.jar" />
1124-
<arg value="libs/windows/jSSC-2.8_x86_64.dll" />
1125-
</exec>
1097+
<unzip src="../arduino-core/lib/jssc-2.8.0-arduino3.jar" dest="windows/work/lib">
1098+
<patternset>
1099+
<include name="libs/windows/jSSC-2.8_x86_64.dll"/>
1100+
</patternset>
1101+
<mapper type="flatten"/>
1102+
</unzip>
11261103
<move file="windows/work/lib/jSSC-2.8_x86_64.dll" tofile="windows/work/lib/jSSC-2.8_x86_64.dll" />
11271104
<antcall target="make-file-executable">
11281105
<param name="file" value="windows/work/lib/jSSC-2.8_x86_64.dll" />

0 commit comments

Comments
 (0)