Skip to content

Commit f09b24c

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 a59cf8e commit f09b24c

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

build/build.xml

Lines changed: 27 additions & 4 deletions
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>
@@ -856,6 +858,19 @@
856858
<unzip src="${archive_file}" dest="${dest_folder}"/>
857859
</target>
858860

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

@@ -982,7 +997,9 @@
982997
<param name="dest_folder" value="${staging_folder}" />
983998
</antcall>
984999
<copy file="windows/liblistSerials-${LIBLISTSERIAL-VERSION}/windows/listSerialsj.dll" todir="windows/work/lib/" />
985-
<chmod perm="755" file="windows/work/lib/listSerialsj.dll" />
1000+
<antcall target="make-file-executable">
1001+
<param name="file" value="windows/work/lib/listSerialsj.dll" />
1002+
</antcall>
9861003

9871004
<delete dir="${staging_folder}/arduino-builder-windows" includeemptydirs="true"/>
9881005
<mkdir dir="${staging_folder}/arduino-builder-windows"/>
@@ -993,9 +1010,13 @@
9931010
<param name="dest_folder" value="${staging_folder}/arduino-builder-windows" />
9941011
</antcall>
9951012
<copy file="${staging_folder}/arduino-builder-windows/arduino-builder.exe" tofile="windows/work/arduino-builder.exe" />
996-
<chmod perm="755" file="windows/work/arduino-builder.exe" />
1013+
<antcall target="make-file-executable">
1014+
<param name="file" value="windows/work/arduino-builder.exe" />
1015+
</antcall>
9971016
<move file="${staging_folder}/arduino-builder-windows/tools" tofile="windows/work/tools-builder"/>
998-
<chmod perm="755" file="windows/work/tools-builder/ctags/5.8-arduino11/ctags.exe" />
1017+
<antcall target="make-file-executable">
1018+
<param name="file" value="windows/work/tools-builder/ctags/5.8-arduino11/ctags.exe" />
1019+
</antcall>
9991020
<copy todir="windows/work/hardware" overwrite="true">
10001021
<fileset dir="${staging_folder}/arduino-builder-windows/hardware" includes="*.txt"/>
10011022
</copy>
@@ -1011,7 +1032,9 @@
10111032
<arg value="com/sun/jna/win32-x86/jnidispatch.dll" />
10121033
</exec>
10131034
<move file="windows/work/lib/jnidispatch.dll" tofile="windows/work/lib/jnidispatch-4.2.2-win32-x86.dll" />
1014-
<chmod perm="755" file="windows/work/lib/jnidispatch-4.2.2-win32-x86.dll" />
1035+
<antcall target="make-file-executable">
1036+
<param name="file" value="windows/work/lib/jnidispatch-4.2.2-win32-x86.dll" />
1037+
</antcall>
10151038

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

0 commit comments

Comments
 (0)