Skip to content

Commit 7dcc135

Browse files
committed
During windows build use "icacls" tool to change file attributes
Previously the ant call "chmod" was used, but this is a no-op on Windows, so it would works only if the IDE is cross-built from a unix host. This patch allows to build a distribution of the IDE also from a Windows host.
1 parent 18f18bf commit 7dcc135

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

build/build.xml

+27-4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
<condition property="platform" value="linux64"><os family="unix" arch="amd64" /></condition>
2525
<condition property="platform" value="linuxarm"><os family="unix" arch="arm" /></condition>
2626

27+
<condition property="windows_host" value="true"><os family="windows" /></condition>
28+
2729
<condition property="macosx"><equals arg1="${platform}" arg2="macosx" /></condition>
2830
<condition property="windows"><equals arg1="${platform}" arg2="windows" /></condition>
2931
<condition property="linux32"><equals arg1="${platform}" arg2="linux32" /></condition>
@@ -857,6 +859,19 @@
857859
<unzip src="${archive_file}" dest="${dest_folder}"/>
858860
</target>
859861

862+
<!-- Ensure that the executable flag is set in all enviroments/OS -->
863+
<target name="make-file-executable" depends="make-file-executable-windows">
864+
<chmod perm="755" file="${file}" />
865+
</target>
866+
867+
<target name="make-file-executable-windows" if="windows_host">
868+
<exec executable="icacls" failonerror="false">
869+
<arg value="${file}"/>
870+
<arg value="/grant"/>
871+
<arg value="Everyone:(RX)"/>
872+
</exec>
873+
</target>
874+
860875
<target name="linux-dist" depends="build"
861876
description="Build .tar.xz of linux version">
862877

@@ -983,7 +998,9 @@
983998
<param name="dest_folder" value="${staging_folder}" />
984999
</antcall>
9851000
<copy file="windows/liblistSerials-${LIBLISTSERIAL-VERSION}/windows/listSerialsj.dll" todir="windows/work/lib/" />
986-
<chmod perm="755" file="windows/work/lib/listSerialsj.dll" />
1001+
<antcall target="make-file-executable">
1002+
<param name="file" value="windows/work/lib/listSerialsj.dll" />
1003+
</antcall>
9871004

9881005
<delete dir="${staging_folder}/arduino-builder-windows" includeemptydirs="true"/>
9891006
<mkdir dir="${staging_folder}/arduino-builder-windows"/>
@@ -994,9 +1011,13 @@
9941011
<param name="dest_folder" value="${staging_folder}/arduino-builder-windows" />
9951012
</antcall>
9961013
<copy file="${staging_folder}/arduino-builder-windows/arduino-builder.exe" tofile="windows/work/arduino-builder.exe" />
997-
<chmod perm="755" file="windows/work/arduino-builder.exe" />
1014+
<antcall target="make-file-executable">
1015+
<param name="file" value="windows/work/arduino-builder.exe" />
1016+
</antcall>
9981017
<move file="${staging_folder}/arduino-builder-windows/tools" tofile="windows/work/tools-builder"/>
999-
<chmod perm="755" file="windows/work/tools-builder/ctags/5.8-arduino11/ctags.exe" />
1018+
<antcall target="make-file-executable">
1019+
<param name="file" value="windows/work/tools-builder/ctags/5.8-arduino11/ctags.exe" />
1020+
</antcall>
10001021
<copy todir="windows/work/hardware" overwrite="true">
10011022
<fileset dir="${staging_folder}/arduino-builder-windows/hardware" includes="*.txt"/>
10021023
</copy>
@@ -1012,7 +1033,9 @@
10121033
<arg value="com/sun/jna/win32-x86/jnidispatch.dll" />
10131034
</exec>
10141035
<move file="windows/work/lib/jnidispatch.dll" tofile="windows/work/lib/jnidispatch-4.2.2-win32-x86.dll" />
1015-
<chmod perm="755" file="windows/work/lib/jnidispatch-4.2.2-win32-x86.dll" />
1036+
<antcall target="make-file-executable">
1037+
<param name="file" value="windows/work/lib/jnidispatch-4.2.2-win32-x86.dll" />
1038+
</antcall>
10161039

10171040
<antcall target="assemble">
10181041
<param name="target.path" value="windows/work" />

0 commit comments

Comments
 (0)