Skip to content

Commit 38c5f8e

Browse files
cleveHEXladyada
authored andcommitted
Add more colors and enhance log output (#28)
* Add color definition * Replace current colors * Add some yellow and tweak color names * Fix * Add more info about Installing Arduino IDE * Improvements * Uppercase * Make esp32 pull silent * Enhancements * Fix * Fix color codes * Fix checkmarks * Add more colors! * Remove not-working coloring * Remove mkdir warning when cache is on
1 parent e38c333 commit 38c5f8e

File tree

2 files changed

+48
-32
lines changed

2 files changed

+48
-32
lines changed

.travis.yml

-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ sudo: false
33
cache:
44
directories:
55
- ~/arduino_ide
6-
# Caches Arduino IDE + ESP32 platform
76
- ~/.arduino15/packages/
8-
# Caches Arduino platforms
97
git:
108
depth: false
119
quiet: true

install.sh

+48-30
Original file line numberDiff line numberDiff line change
@@ -28,95 +28,114 @@ export IO_PLATFORMS='declare -A io_platforms=( [zero]="arduino:samd:arduino_zero
2828
sleep 3
2929
export DISPLAY=:1.0
3030

31+
# define colors
32+
GRAY='\033[1;30m'; RED='\033[0;31m'; LRED='\033[1;31m'; GREEN='\033[0;32m'; LGREEN='\033[1;32m'; ORANGE='\033[0;33m'; YELLOW='\033[1;33m'; BLUE='\033[0;34m'; LBLUE='\033[1;34m'; PURPLE='\033[0;35m'; LPURPLE='\033[1;35m'; CYAN='\033[0;36m'; LCYAN='\033[1;36m'; LGRAY='\033[0;37m'; WHITE='\033[1;37m';
33+
34+
echo -e "\n########################################################################";
35+
echo -e "${YELLOW}INSTALLING ARDUINO IDE"
36+
echo "########################################################################";
37+
3138
# if .travis.yml does not set version
32-
if [ -z $ARDUINO_IDE_VERSION ]; then export ARDUINO_IDE_VERSION="1.8.5"; fi
39+
if [ -z $ARDUINO_IDE_VERSION ]; then
40+
export ARDUINO_IDE_VERSION="1.8.5"
41+
echo "NOTE: YOUR .TRAVIS.YML DOES NOT SPECIFY ARDUINO IDE VERSION, USING $ARDUINO_IDE_VERSION"
42+
fi
3343

3444
# if newer version is requested
3545
if [ ! -f $HOME/arduino_ide/$ARDUINO_IDE_VERSION ] && [ -f $HOME/arduino_ide/arduino ]; then
46+
echo -n "DIFFERENT VERSION OF ARDUINO IDE REQUESTED: "
3647
shopt -s extglob
3748
cd $HOME/arduino_ide/
3849
rm -r -f !(esp32)
50+
if [ $? -ne 0 ]; then echo -e """$RED""\xe2\x9c\x96"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
3951
cd $OLDPWD
40-
echo "DIFFERENT VERSION OF ARDUINO IDE REQUESTED!"
4152
fi
4253

43-
# if not already cached, download and install arduino 1.8.5
54+
# if not already cached, download and install arduino IDE
55+
echo -n "ARDUINO IDE STATUS: "
4456
if [ ! -f $HOME/arduino_ide/arduino ]; then
45-
echo "DOWNLOADING ARDUINO IDE..."
57+
echo -n "DOWNLOADING: "
4658
wget --quiet https://downloads.arduino.cc/arduino-$ARDUINO_IDE_VERSION-linux64.tar.xz
47-
echo "UNPACKING ARDUINO IDE..."
48-
mkdir $HOME/arduino_ide
59+
if [ $? -ne 0 ]; then echo -e """$RED""\xe2\x9c\x96"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
60+
echo -n "UNPACKING ARDUINO IDE: "
61+
[ ! -d $HOME/arduino_ide/ ] && mkdir $HOME/arduino_ide
4962
tar xf arduino-$ARDUINO_IDE_VERSION-linux64.tar.xz -C $HOME/arduino_ide/ --strip-components=1
63+
if [ $? -ne 0 ]; then echo -e """$RED""\xe2\x9c\x96"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
5064
touch $HOME/arduino_ide/$ARDUINO_IDE_VERSION
65+
else
66+
echo -n "CACHED: "
67+
echo -e """$GREEN""\xe2\x9c\x93"
5168
fi
5269

53-
# move this library to the arduino libraries folder
54-
ln -s $PWD $HOME/arduino_ide/libraries/Adafruit_Test_Library
70+
# link test library folder to the arduino libraries folder
71+
ln -s $TRAVIS_BUILD_DIR $HOME/arduino_ide/libraries/Adafruit_Test_Library
5572

5673
# add the arduino CLI to our PATH
5774
export PATH="$HOME/arduino_ide:$PATH"
5875

5976
echo -e "\n########################################################################";
60-
echo "INSTALLING DEPENDENCIES"
77+
echo -e "${YELLOW}INSTALLING DEPENDENCIES"
6178
echo "########################################################################";
6279

6380

6481
# install the due, esp8266, and adafruit board packages
6582
echo -n "ADD PACKAGE INDEX: "
6683
DEPENDENCY_OUTPUT=$(arduino --pref "boardsmanager.additional.urls=https://adafruit.github.io/arduino-board-index/package_adafruit_index.json,http://arduino.esp8266.com/stable/package_esp8266com_index.json" --save-prefs 2>&1)
67-
if [ $? -ne 0 ]; then echo -e "\033[0;31m\xe2\x9c\x96"; else echo -e "\033[0;32m\xe2\x9c\x93"; fi
84+
if [ $? -ne 0 ]; then echo -e """$RED""\xe2\x9c\x96"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
6885

6986
echo -n "ESP32: "
7087

7188
if [ ! -d $HOME/Arduino/hardware/espressif ]; then
7289
DEPENDENCY_OUTPUT=$(mkdir -p $HOME/Arduino/hardware/espressif &&
7390
cd $HOME/Arduino/hardware/espressif &&
74-
git clone https://github.com/espressif/arduino-esp32.git esp32 &&
91+
echo -n "DOWNLOADING: " &&
92+
git clone https://github.com/espressif/arduino-esp32.git esp32 -q &&
7593
cd esp32/tools/ &&
7694
python get.py &&
7795
cd $TRAVIS_BUILD_DIR
7896
)
7997
else
8098
DEPENDENCY_OUTPUT=$(cd $HOME/Arduino/hardware/espressif &&
81-
git pull origin master &&
99+
echo -n "UPDATING: " &&
100+
git pull origin master -q &&
82101
cd esp32/tools/ &&
83102
python get.py &&
84103
cd $TRAVIS_BUILD_DIR
85104
)
86105
fi
87106

88-
if [ $? -ne 0 ]; then echo -e "\033[0;31m\xe2\x9c\x96"; else echo -e "\033[0;32m\xe2\x9c\x93"; fi
107+
if [ $? -ne 0 ]; then echo -e """$RED""\xe2\x9c\x96"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
89108

90109
echo -n "DUE: "
91110
DEPENDENCY_OUTPUT=$(arduino --install-boards arduino:sam 2>&1)
92-
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 or cached"; else echo -e "\033[0;32m\xe2\x9c\x93"; fi
111+
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 OR CACHED"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
93112

94113
echo -n "ZERO: "
95114
DEPENDENCY_OUTPUT=$(arduino --install-boards arduino:samd 2>&1)
96-
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 or cached"; else echo -e "\033[0;32m\xe2\x9c\x93"; fi
115+
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 OR CACHED"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
97116

98117
echo -n "ESP8266: "
99118
DEPENDENCY_OUTPUT=$(arduino --install-boards esp8266:esp8266 2>&1)
100-
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 or cached"; else echo -e "\033[0;32m\xe2\x9c\x93"; fi
119+
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 OR CACHED"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
101120

102121
echo -n "ADAFRUIT AVR: "
103122
DEPENDENCY_OUTPUT=$(arduino --install-boards adafruit:avr 2>&1)
104-
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 or cached"; else echo -e "\033[0;32m\xe2\x9c\x93"; fi
123+
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 OR CACHED"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
105124

106125
echo -n "ADAFRUIT SAMD: "
107126
DEPENDENCY_OUTPUT=$(arduino --install-boards adafruit:samd 2>&1)
108-
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 or cached"; else echo -e "\033[0;32m\xe2\x9c\x93"; fi
127+
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 OR CACHED"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
109128

110129
# install random lib so the arduino IDE grabs a new library index
111130
# see: https://github.com/arduino/Arduino/issues/3535
112131
echo -n "UPDATE LIBRARY INDEX: "
113132
DEPENDENCY_OUTPUT=$(arduino --install-library USBHost > /dev/null 2>&1)
114-
if [ $? -ne 0 ]; then echo -e "\033[0;31m\xe2\x9c\x96"; else echo -e "\033[0;32m\xe2\x9c\x93"; fi
133+
if [ $? -ne 0 ]; then echo -e """$RED""\xe2\x9c\x96"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
115134

116135
# set the maximal compiler warning level
117136
echo -n "SET BUILD PREFERENCES: "
118137
DEPENDENCY_OUTPUT=$(arduino --pref "compiler.warning_level=all" --save-prefs 2>&1)
119-
if [ $? -ne 0 ]; then echo -e "\033[0;31m\xe2\x9c\x96"; else echo -e "\033[0;32m\xe2\x9c\x93"; fi
138+
if [ $? -ne 0 ]; then echo -e """$RED""\xe2\x9c\x96"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
120139

121140
# init the json temp var for the current platform
122141
export PLATFORM_JSON=""
@@ -177,7 +196,7 @@ function build_platform()
177196

178197
echo -e "\n########################################################################";
179198

180-
echo -n "SWITCHING TO ${platform_key}: "
199+
echo -e -n "${YELLOW}SWITCHING TO ${platform_key}: "
181200

182201
# switch to the requested board.
183202
# we have to avoid reading the exit code of local:
@@ -191,12 +210,12 @@ function build_platform()
191210
# notify if the platform switch failed
192211
if [ $platform_switch -ne 0 ]; then
193212
# heavy X
194-
echo -e "\033[0;31m\xe2\x9c\x96"
213+
echo -e """$RED""\xe2\x9c\x96"
195214
echo $platform_stdout
196215
exit_code=1
197216
else
198217
# heavy checkmark
199-
echo -e "\033[0;32m\xe2\x9c\x93"
218+
echo -e """$GREEN""\xe2\x9c\x93"
200219
fi
201220

202221
echo "########################################################################";
@@ -221,7 +240,7 @@ function build_platform()
221240
# continue to next example if platform switch failed
222241
if [ $platform_switch -ne 0 ]; then
223242
# heavy X
224-
echo -e "\033[0;31m\xe2\x9c\x96"
243+
echo -e """$RED""\xe2\x9c\x96"
225244

226245
# add json
227246
PLATFORM_JSON="${PLATFORM_JSON}$(json_sketch 0 $example_file $last_example)"
@@ -271,10 +290,10 @@ function build_platform()
271290
if [[ $example =~ \.pde$ ]]; then
272291

273292
# heavy X
274-
echo -e "\033[0;31m\xe2\x9c\x96"
293+
echo -e """$RED""\xe2\x9c\x96"
275294

276295
echo -e "-------------------------- DEBUG OUTPUT --------------------------\n"
277-
echo "PDE EXTENSION. PLEASE UPDATE TO INO"
296+
echo "${LRED}PDE EXTENSION. PLEASE UPDATE TO INO"
278297
echo -e "\n------------------------------------------------------------------\n"
279298

280299
# add json
@@ -300,7 +319,7 @@ function build_platform()
300319
if [ $? -ne 0 ]; then
301320

302321
# heavy X
303-
echo -e "\033[0;31m\xe2\x9c\x96"
322+
echo -e """$RED""\xe2\x9c\x96"
304323

305324
echo -e "----------------------------- DEBUG OUTPUT -----------------------------\n"
306325
echo "$build_stdout"
@@ -318,7 +337,7 @@ function build_platform()
318337
else
319338

320339
# heavy checkmark
321-
echo -e "\033[0;32m\xe2\x9c\x93"
340+
echo -e """$GREEN""\xe2\x9c\x93"
322341

323342
# add json
324343
PLATFORM_JSON="${PLATFORM_JSON}$(json_sketch 1 "$example_file" $last_example)"
@@ -646,5 +665,4 @@ function json_main_platforms()
646665

647666
echo -e "||||||||||||||||||||||||||||| JSON STATUS ||||||||||||||||||||||||||||||\n"
648667

649-
}
650-
668+
}

0 commit comments

Comments
 (0)