Skip to content

Commit

Permalink
During windows build use "icacls" tool to change file attributes
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cmaglie committed Apr 21, 2017
1 parent 18f18bf commit 7dcc135
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions build/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
<condition property="platform" value="linux64"><os family="unix" arch="amd64" /></condition>
<condition property="platform" value="linuxarm"><os family="unix" arch="arm" /></condition>

<condition property="windows_host" value="true"><os family="windows" /></condition>

<condition property="macosx"><equals arg1="${platform}" arg2="macosx" /></condition>
<condition property="windows"><equals arg1="${platform}" arg2="windows" /></condition>
<condition property="linux32"><equals arg1="${platform}" arg2="linux32" /></condition>
Expand Down Expand Up @@ -857,6 +859,19 @@
<unzip src="${archive_file}" dest="${dest_folder}"/>
</target>

<!-- Ensure that the executable flag is set in all enviroments/OS -->
<target name="make-file-executable" depends="make-file-executable-windows">
<chmod perm="755" file="${file}" />
</target>

<target name="make-file-executable-windows" if="windows_host">
<exec executable="icacls" failonerror="false">
<arg value="${file}"/>
<arg value="/grant"/>
<arg value="Everyone:(RX)"/>
</exec>
</target>

<target name="linux-dist" depends="build"
description="Build .tar.xz of linux version">

Expand Down Expand Up @@ -983,7 +998,9 @@
<param name="dest_folder" value="${staging_folder}" />
</antcall>
<copy file="windows/liblistSerials-${LIBLISTSERIAL-VERSION}/windows/listSerialsj.dll" todir="windows/work/lib/" />
<chmod perm="755" file="windows/work/lib/listSerialsj.dll" />
<antcall target="make-file-executable">
<param name="file" value="windows/work/lib/listSerialsj.dll" />
</antcall>

<delete dir="${staging_folder}/arduino-builder-windows" includeemptydirs="true"/>
<mkdir dir="${staging_folder}/arduino-builder-windows"/>
Expand All @@ -994,9 +1011,13 @@
<param name="dest_folder" value="${staging_folder}/arduino-builder-windows" />
</antcall>
<copy file="${staging_folder}/arduino-builder-windows/arduino-builder.exe" tofile="windows/work/arduino-builder.exe" />
<chmod perm="755" file="windows/work/arduino-builder.exe" />
<antcall target="make-file-executable">
<param name="file" value="windows/work/arduino-builder.exe" />
</antcall>
<move file="${staging_folder}/arduino-builder-windows/tools" tofile="windows/work/tools-builder"/>
<chmod perm="755" file="windows/work/tools-builder/ctags/5.8-arduino11/ctags.exe" />
<antcall target="make-file-executable">
<param name="file" value="windows/work/tools-builder/ctags/5.8-arduino11/ctags.exe" />
</antcall>
<copy todir="windows/work/hardware" overwrite="true">
<fileset dir="${staging_folder}/arduino-builder-windows/hardware" includes="*.txt"/>
</copy>
Expand All @@ -1012,7 +1033,9 @@
<arg value="com/sun/jna/win32-x86/jnidispatch.dll" />
</exec>
<move file="windows/work/lib/jnidispatch.dll" tofile="windows/work/lib/jnidispatch-4.2.2-win32-x86.dll" />
<chmod perm="755" file="windows/work/lib/jnidispatch-4.2.2-win32-x86.dll" />
<antcall target="make-file-executable">
<param name="file" value="windows/work/lib/jnidispatch-4.2.2-win32-x86.dll" />
</antcall>

<antcall target="assemble">
<param name="target.path" value="windows/work" />
Expand Down

0 comments on commit 7dcc135

Please sign in to comment.