Skip to content

Commit 0a77a96

Browse files
committed
Skip installing the IDE if it's already installed
The script needs to be informed of the IDE versions that are available even if the user already has them installed or has used an alternate installation method. This change allows install_ide to be used for that purpose.
1 parent 7cf5f22 commit 0a77a96

File tree

2 files changed

+29
-23
lines changed

2 files changed

+29
-23
lines changed

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Turn on/off checking for errors with libraries that don't affect sketch verifica
5252

5353
##### `install_ide [IDEversionList]`
5454
Install a list of version(s) of the Arduino IDE.
55-
- Parameter(optional): **IDEversionList** - A list of the versions of the Arduino IDE you want installed, in order from oldest to newest. e.g. `'("1.6.5-r5" "1.6.9" "1.8.2")'`. If no arguments are supplied all IDE versions will be installed. I have defined all versions of the Arduino IDE that have a command line interface in the script for the sake of being complete but I really don't see much reason for testing with the 1.5.x versions of the Arduino IDE. Please only install the IDE versions you actually need for your test to avoid wasting Arduino's bandwidth. This will also result in the builds running faster.
55+
- Parameter(optional): **IDEversionList** - A list of the versions of the Arduino IDE you want installed, in order from oldest to newest. e.g. `'("1.6.5-r5" "1.6.9" "1.8.2")'`. If no arguments are supplied all IDE versions will be installed. I have defined all versions of the Arduino IDE that have a command line interface in the script for the sake of being complete but I really don't see much reason for testing with the 1.5.x versions of the Arduino IDE. Please only install the IDE versions you actually need for your test to avoid wasting Arduino's bandwidth. This will also result in the builds running faster. Installation of the IDE will be skipped if it's found to already be installed in the folder specified via the `set_application_folder` function so `install_ide` can also be used simply to inform the script which IDE versions are available.
5656

5757
##### `install_ide startIDEversion [endIDEversion]`
5858
Install a range of version(s) of the Arduino IDE.

Diff for: arduino-ci-script.sh

+28-22
Original file line numberDiff line numberDiff line change
@@ -246,30 +246,36 @@ function install_ide()
246246
eval "$INSTALLED_IDE_VERSION_LIST_ARRAY"
247247
local IDEversion
248248
for IDEversion in "${IDEversionListArray[@]}"; do
249-
if [[ "$ARDUINO_CI_SCRIPT_VERBOSITY_LEVEL" -eq 0 ]]; then
250-
# If the download/installation process is going slowly when installing a lot of IDE versions this function may cause the build to fail due to exceeding Travis CI's 10 minutes without log output timeout so it's necessary to periodically print something.
251-
echo "Installing: $IDEversion"
252-
fi
253-
# Determine download file extension
254-
local tgzExtensionVersionsRegex="1.5.[0-9]"
255-
if [[ "$IDEversion" =~ $tgzExtensionVersionsRegex ]]; then
256-
# The download file extension prior to 1.6.0 is .tgz
257-
local downloadFileExtension="tgz"
258-
else
259-
local downloadFileExtension="tar.xz"
260-
fi
249+
local IDEinstallFolder="$ARDUINO_CI_SCRIPT_APPLICATION_FOLDER/arduino-${IDEversion}"
261250

262-
if [[ "$IDEversion" == "hourly" ]]; then
263-
# Deal with the inaccurate name given to the hourly build download
264-
local downloadVersion="nightly"
265-
else
266-
local downloadVersion="$IDEversion"
267-
fi
251+
# Don't unnecessarily install the IDE
252+
if ! [[ -d "$IDEinstallFolder" ]]; then
253+
if [[ "$ARDUINO_CI_SCRIPT_VERBOSITY_LEVEL" -eq 0 ]]; then
254+
# If the download/installation process is going slowly when installing a lot of IDE versions this function may cause the build to fail due to exceeding Travis CI's 10 minutes without log output timeout so it's necessary to periodically print something.
255+
echo "Installing: $IDEversion"
256+
fi
268257

269-
wget --no-verbose $ARDUINO_CI_SCRIPT_QUIET_OPTION "http://downloads.arduino.cc/arduino-${downloadVersion}-linux64.${downloadFileExtension}"
270-
tar --extract --file="arduino-${downloadVersion}-linux64.${downloadFileExtension}"
271-
rm $ARDUINO_CI_SCRIPT_VERBOSITY_OPTION "arduino-${downloadVersion}-linux64.${downloadFileExtension}"
272-
mv $ARDUINO_CI_SCRIPT_VERBOSITY_OPTION "arduino-${downloadVersion}" "$ARDUINO_CI_SCRIPT_APPLICATION_FOLDER/arduino-${IDEversion}"
258+
# Determine download file extension
259+
local tgzExtensionVersionsRegex="1.5.[0-9]"
260+
if [[ "$IDEversion" =~ $tgzExtensionVersionsRegex ]]; then
261+
# The download file extension prior to 1.6.0 is .tgz
262+
local downloadFileExtension="tgz"
263+
else
264+
local downloadFileExtension="tar.xz"
265+
fi
266+
267+
if [[ "$IDEversion" == "hourly" ]]; then
268+
# Deal with the inaccurate name given to the hourly build download
269+
local downloadVersion="nightly"
270+
else
271+
local downloadVersion="$IDEversion"
272+
fi
273+
274+
wget --no-verbose $ARDUINO_CI_SCRIPT_QUIET_OPTION "http://downloads.arduino.cc/arduino-${downloadVersion}-linux64.${downloadFileExtension}"
275+
tar --extract --file="arduino-${downloadVersion}-linux64.${downloadFileExtension}"
276+
rm $ARDUINO_CI_SCRIPT_VERBOSITY_OPTION "arduino-${downloadVersion}-linux64.${downloadFileExtension}"
277+
mv $ARDUINO_CI_SCRIPT_VERBOSITY_OPTION "arduino-${downloadVersion}" "$IDEinstallFolder"
278+
fi
273279
done
274280

275281
set_ide_preference "compiler.warning_level=all"

0 commit comments

Comments
 (0)