Skip to content

Removing hardware folder contents: platforms are downloaded at build time #1823

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ build/linux/libastylej*
test-bin
*.iml
.idea

.DS_Store
hardware/arduino/avr/libraries/Bridge/examples/XivelyClient/passwords.h

hardware/arduino/avr/libraries/Bridge/examples/.DS_Store
avr-toolchain-*.zip
platform-arduino-*.zip
build/shared/libastylej/*
libastylej-*.zip
18 changes: 10 additions & 8 deletions app/src/processing/app/Base.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ static public void main(String args[]) throws Exception {
}

// help 3rd party installers find the correct hardware path
Preferences.set("last.ide." + VERSION_NAME + ".hardwarepath", getHardwarePath());
Preferences.set("last.ide." + VERSION_NAME + ".hardwarepath", getHardwareFolder().getAbsolutePath());
Preferences.set("last.ide." + VERSION_NAME + ".daterun", "" + (new Date()).getTime() / 1000);

// if (System.getProperty("mrj.version") != null) {
Expand Down Expand Up @@ -2040,26 +2040,28 @@ static public String getToolsPath() {
return toolsFolder.getAbsolutePath();
}


static public File getHardwareFolder() {
// calculate on the fly because it's needed by Preferences.init() to find
// the boards.txt and programmers.txt preferences files (which happens
// before the other folders / paths get cached).
String localHardwareFolder = System.getenv("LOCAL_HARDWARE_FOLDER");
if (localHardwareFolder != null && new File(localHardwareFolder).exists() && new File(localHardwareFolder).list() != null) {
return new File(localHardwareFolder);
}
return getContentFile("hardware");
}

static public File getHardwareToolsFolder() {
return new File(getContentFile("hardware"), "tools");
}

//Get the core libraries
static public File getCoreLibraries(String path) {
return getContentFile(path);
}

static public String getHardwarePath() {
return getHardwareFolder().getAbsolutePath();
}


static public String getAvrBasePath() {
String path = getHardwarePath() + File.separator + "tools" +
String path = getHardwareToolsFolder().getAbsolutePath() +
File.separator + "avr" + File.separator + "bin" + File.separator;
if (Base.isLinux() && !(new File(path)).exists()) {
return ""; // use distribution provided avr tools if bundled tools missing
Expand Down
3 changes: 1 addition & 2 deletions app/src/processing/app/Preferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,7 @@ static protected void init(String args[]) {
}

// set some runtime constants (not saved on preferences file)
File hardwareFolder = Base.getHardwareFolder();
table.put("runtime.ide.path", hardwareFolder.getParentFile().getAbsolutePath());
table.put("runtime.ide.path", Base.getContentFile(".").getAbsolutePath());
table.put("runtime.ide.version", "" + Base.REVISION);

// check for platform-specific properties in the defaults
Expand Down
160 changes: 111 additions & 49 deletions build/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,18 @@
</copy>

<!-- Unzip AVR tools -->
<!-- <unzip dest="macosx/work/Arduino.app/Contents/Resources/Java/hardware" src="macosx/dist/tools-universal.zip" overwrite="false"/> -->
<antcall target="unzip-avr-toolchain">
<param name="file_arch" value="mac32" />
</antcall>

<antcall target="unzip-platform">
<param name="name" value="avr-1.5.5"/>
</antcall>
<antcall target="unzip-platform">
<param name="name" value="sam-1.5.5"/>
</antcall>

<!--
<exec executable="unzip">
<arg value="-q" />
<arg value="-n" />
Expand All @@ -233,16 +243,17 @@
<arg value="macosx/dist/tools-universal.zip" />
</exec>

<copy todir="macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools/avr/avr/include/avr">
<fileset file="macosx/dist/eeprom.h" />
</copy>
-->

<copy todir="macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools/">
<fileset file="macosx/dist/bossac" />
</copy>

<chmod file="macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools/bossac" perm="+x" />

<copy todir="macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools/avr/avr/include/avr">
<fileset file="macosx/dist/eeprom.h" />
</copy>

<antcall target="assemble">
<param name="target.path" value="macosx/work/Arduino.app/Contents/Resources/Java" />
</antcall>
Expand All @@ -260,9 +271,8 @@
<fileset dir="macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools" includes="**/man"/>
</delete>

<get src="http://downloads.arduino.cc/libastylej-2.03.zip" dest="macosx" usetimestamp="true" />
<unzip src="macosx/libastylej-2.03.zip" dest="macosx" overwrite="true"/>
<copy file="macosx/libastylej/libastylej.jnilib" todir="macosx/work/Arduino.app/Contents/Resources/Java/lib/" />
<antcall target="unzip-libastyle"/>
<copy file="shared/libastylej/libastylej.jnilib" todir="macosx/work/Arduino.app/Contents/Resources/Java/lib/" />
<chmod perm="755" file="macosx/work/Arduino.app/Contents/Resources/Java/lib/libastylej.jnilib" />
</target>

Expand Down Expand Up @@ -335,9 +345,7 @@
<chmod perm="+x">
<fileset dir="macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin" includes="**/*" />
<fileset dir="macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools/avr/avr/bin" includes="**/*" />
<fileset dir="macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools/avr/avr-3/bin" includes="**/*" />
<fileset dir="macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools/avr/avr-4/bin" includes="**/*" />
<fileset dir="macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools/avr/libexec/gcc/avr/4.3.2/" includes="**/cc1*" />
<fileset dir="macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools/avr/libexec/gcc/avr/4.3.2/" includes="*" />
</chmod>

<replace file="macosx/work/Arduino.app/Contents/Info.plist"
Expand Down Expand Up @@ -464,21 +472,24 @@
<mkdir dir="linux/work/hardware/tools" />
<copy file="linux/dist/tools/adk2install" todir="linux/work/hardware/tools" />
<copy file="linux/dist/tools/adk2tool" todir="linux/work/hardware/tools" />
<copy file="linux/dist/tools/avrdude${arch-bits}" tofile="linux/work/hardware/tools/avrdude" />
<copy file="linux/dist/tools/avrdude.conf" todir="linux/work/hardware/tools" />
<copy file="linux/dist/tools/bossac${arch-bits}" tofile="linux/work/hardware/tools/bossac" />

<chmod perm="755" file="linux/work/hardware/tools/avrdude" />
<chmod perm="755" file="linux/work/hardware/tools/bossac" />
<chmod perm="755" file="linux/work/hardware/tools/adk2tool" />
<chmod perm="755" file="linux/work/hardware/tools/adk2install" />

<copy todir="linux/work" file="linux/dist/arduino" />
<chmod perm="755" file="linux/work/arduino" />

<get src="http://downloads.arduino.cc/libastylej-2.03.zip" dest="linux" usetimestamp="true" />
<unzip src="linux/libastylej-2.03.zip" dest="linux" overwrite="true"/>
<copy file="linux/libastylej/libastylej${arch-bits}.so" tofile="linux/work/lib/libastylej.so" />
<antcall target="unzip-platform">
<param name="name" value="avr-1.5.5"/>
</antcall>
<antcall target="unzip-platform">
<param name="name" value="sam-1.5.5"/>
</antcall>

<antcall target="unzip-libastyle"/>
<copy file="shared/libastylej/libastylej${arch-bits}.so" tofile="linux/work/lib/libastylej.so" />
<chmod perm="755" file="linux/work/lib/libastylej.so" />
</target>

Expand All @@ -491,18 +502,12 @@
</antcall>

<!-- Unzip AVR tools -->
<exec executable="tar" dir="linux/work/hardware">
<arg value="-xjf"/>
<arg value="../../avr_tools_linux32.tar.bz2"/>
</exec>

<antcall target="unzip-avr-toolchain">
<param name="file_arch" value="linux32" />
</antcall>
</target>

<target name="linux64-build" depends="linux-build" description="Build linux (64-bit) version">
<copy tofile="linux/work/hardware/tools/avrdude" file="linux/dist/tools/avrdude64" overwrite="true" />

<chmod perm="755" file="linux/work/hardware/tools/avrdude" />

<!-- Unzip ARM tools -->
<antcall target="unzip-arm-toolchain">
<param name="dist_file" value="gcc-arm-none-eabi-4.4.1-2010q1-188-linux32.tar.gz" />
Expand All @@ -511,10 +516,9 @@
</antcall>

<!-- Unzip AVR tools -->
<exec executable="tar" dir="linux/work/hardware">
<arg value="-xjf"/>
<arg value="../../avr_tools_linux64.tar.bz2"/>
</exec>
<antcall target="unzip-avr-toolchain">
<param name="file_arch" value="linux64" />
</antcall>
</target>

<target name="linux32-run" depends="linux32-build" description="Run Linux (32-bit) version">
Expand All @@ -525,6 +529,69 @@
<exec executable="./linux/work/arduino" spawn="false"/>
</target>

<target name="unzip-libastyle">
<get src="http://downloads.arduino.cc/libastylej-2.03.zip" dest="shared" usetimestamp="true" ignoreerrors="true"/>

<checksum file="shared/libastylej-2.03.zip" algorithm="sha" fileext=".sha" verifyproperty="checksum.matches"/>
<condition property="checksum.matches.fail">
<equals arg1="${checksum.matches}" arg2="false"/>
</condition>
<fail if="checksum.matches.fail">Checksum failed.

File libastylej-2.03.zip failed checksum.
Please remove "shared/libastylej-2.03.zip" and download it again.
</fail>

<mkdir dir="${staging_folder}/work/${staging_hardware_folder}/" />
<unzip src="shared/libastylej-2.03.zip" dest="shared" overwrite="true"/>
</target>

<target name="unzip-platform" unless="LOCAL_HARDWARE_FOLDER">
<get src="http://downloads.arduino.cc/platform-arduino-${name}.zip" dest="shared" usetimestamp="true" ignoreerrors="true"/>

<checksum file="shared/platform-arduino-${name}.zip" algorithm="sha" fileext=".sha" verifyproperty="checksum.matches"/>
<condition property="checksum.matches.fail">
<equals arg1="${checksum.matches}" arg2="false"/>
</condition>
<fail if="checksum.matches.fail">Checksum failed.

File platform-arduino-${name}.zip failed checksum.
Please remove "shared/platform-arduino-${name}.zip" and download it again.
</fail>

<mkdir dir="${staging_folder}/work/${staging_hardware_folder}/arduino/" />
<exec executable="unzip">
<arg value="-q" />
<arg value="-n" />
<arg value="-d" />
<arg value="${staging_folder}/work/${staging_hardware_folder}/arduino/" />
<arg value="shared/platform-arduino-${name}.zip" />
</exec>
</target>

<target name="unzip-avr-toolchain">
<get src="http://downloads.arduino.cc/avr-toolchain-${file_arch}-gcc-4.3.2.zip" dest="${staging_folder}" usetimestamp="true" ignoreerrors="true"/>

<checksum file="${staging_folder}/avr-toolchain-${file_arch}-gcc-4.3.2.zip" algorithm="sha" fileext=".sha" verifyproperty="checksum.matches"/>
<condition property="checksum.matches.fail">
<equals arg1="${checksum.matches}" arg2="false"/>
</condition>
<fail if="checksum.matches.fail">Checksum failed.

File avr-toolchain-${file_arch}-gcc-4.3.2.zip failed checksum.
Please remove "${staging_folder}/avr-toolchain-${file_arch}-gcc-4.3.2.zip" and download it again.
</fail>

<mkdir dir="${staging_folder}/work/${staging_hardware_folder}/tools/avr" />
<exec executable="unzip">
<arg value="-q" />
<arg value="-n" />
<arg value="-d" />
<arg value="${staging_folder}/work/${staging_hardware_folder}/tools/avr" />
<arg value="${staging_folder}/avr-toolchain-${file_arch}-gcc-4.3.2.zip" />
</exec>
</target>

<!-- Set 'arm_disfile_available' property if ARM toolchain dist_file is downloaded -->
<!-- Set 'arm_toolchain_installed' property if ARM toolchain is installed in working directory -->
<target name="check-arm-toolchain">
Expand All @@ -534,7 +601,7 @@

<!-- Retrieve ARM toolchain -->
<target name="get-arm-toolchain" depends="check-arm-toolchain" unless="arm_distfile_available">
<get src="${dist_url}" dest="${staging_folder}/dist/${dist_file}" verbose="true" />
<get src="${dist_url}" dest="${staging_folder}/dist/${dist_file}" ignoreerrors="true"/>
</target>

<target name="unzip-arm-toolchain" depends="get-arm-toolchain, check-arm-toolchain"
Expand Down Expand Up @@ -664,16 +731,19 @@
</copy>

<!-- Unzip AVR tools -->
<get src="http://downloads.arduino.cc/WinAVR-20081205-arduino-2.zip" dest="windows" usetimestamp="true" skipexisting="true" verbose="true" />
<unzip dest="windows/work/hardware" src="windows/WinAVR-20081205-arduino-2.zip" overwrite="false"/>
<antcall target="unzip-avr-toolchain">
<param name="file_arch" value="win32" />
</antcall>

<copy todir="windows/work/hardware/tools/avr/avr/include/avr">
<fileset file="windows/eeprom.h" />
</copy>
<antcall target="unzip-platform">
<param name="name" value="avr-1.5.5"/>
</antcall>
<antcall target="unzip-platform">
<param name="name" value="sam-1.5.5"/>
</antcall>

<get src="http://downloads.arduino.cc/libastylej-2.03.zip" dest="windows" usetimestamp="true" />
<unzip src="windows/libastylej-2.03.zip" dest="windows" overwrite="true"/>
<copy file="windows/libastylej/AStylej.dll" todir="windows/work/lib" />
<antcall target="unzip-libastyle"/>
<copy file="shared/libastylej/AStylej.dll" todir="windows/work/lib" />

<!-- Copy bossac.exe tool -->
<copy todir="windows/work/hardware/tools">
Expand Down Expand Up @@ -725,10 +795,9 @@
dir="windows/work" spawn="true"/>
</target>

<target name="windows-dist" depends="windows-build"
description="Create .zip files of windows version">
<target name="windows-dist" depends="windows-build" description="Create .zip files of windows version">

<get src="http://downloads.arduino.cc/jre_7u40_windows_i586.zip" dest="windows/jre.zip" usetimestamp="true" />
<get src="http://downloads.arduino.cc/jre_7u40_windows_i586.zip" dest="windows/jre.zip" usetimestamp="true" ignoreerrors="true"/>

<unzip dest="windows/work" src="windows/jre.zip" overwrite="false"/>

Expand All @@ -747,18 +816,11 @@
prefix="arduino-${version}" />
</zip>

<zip destfile="windows/arduino-${version}-${platform}-expert.zip" level="9">
<zipfileset dir="windows/work"
prefix="arduino-${version}"
excludes="java/**" />
</zip>

<echo>
=======================================================
Arduino for Windows was built. Grab the archive from

windows/arduino-${version}-${platform}.zip
windows/arduino-${version}-${platform}-expert.zip
=======================================================
</echo>
</target>
Expand Down
1 change: 1 addition & 0 deletions build/linux/avr-toolchain-linux32-gcc-4.3.2.zip.sha
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2d1d17a26f1125ae387f4168fb18d40bf52d367c
1 change: 1 addition & 0 deletions build/linux/avr-toolchain-linux64-gcc-4.3.2.zip.sha
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2b97b772bfda8de052663bc48895367142ed79ca
Binary file removed build/linux/avr_tools_linux32.tar.bz2
Binary file not shown.
Binary file removed build/linux/avr_tools_linux64.tar.bz2
Binary file not shown.
Loading