1
1
#! /usr/bin/env bash
2
2
3
+ # expect to have git available
3
4
root=$( git rev-parse --show-toplevel)
4
5
6
+ # general configuration related to the builder itself
5
7
ESP8266_ARDUINO_BUILD_DIR=${ESP8266_ARDUINO_BUILD_DIR:- $root }
6
8
ESP8266_ARDUINO_BUILDER=${ESP8266_ARDUINO_BUILDER:- arduino}
7
9
ESP8266_ARDUINO_PRESERVE_CACHE=${ESP8266_ARDUINO_PRESERVE_CACHE:- }
8
10
9
- ESP8266_ARDUINO_IDE=${ESP8266_ARDUINO_IDE:- $HOME / arduino_ide}
10
- ESP8266_ARDUINO_HARDWARE=${ESP8266_ARDUINO_HARDWARE:- $HOME / Arduino/ hardware}
11
- ESP8266_ARDUINO_LIBRARIES=${ESP8266_ARDUINO_LIBRARIES:- $HOME / Arduino/ libraries}
12
-
11
+ # sketch build options
13
12
ESP8266_ARDUINO_DEBUG=${ESP8266_ARDUINO_DEBUG:- nodebug}
14
13
ESP8266_ARDUINO_LWIP=${ESP8266_ARDUINO_LWIP:- default}
15
14
ESP8266_ARDUINO_SKETCHES=${ESP8266_ARDUINO_SKETCHES:- }
16
15
16
+ ESP8266_ARDUINO_CLI=${ESP8266_ARDUINO_CLI:- $HOME / .local/ bin/ arduino-cli}
17
+
18
+ # ref. https://arduino.github.io/arduino-cli/1.2/configuration/#default-directories
19
+ case " ${RUNNER_OS:- Linux} " in
20
+ " Linux" )
21
+ ESP8266_ARDUINO_HARDWARE=${ESP8266_ARDUINO_HARDWARE:- $HOME / Arduino/ hardware}
22
+ ESP8266_ARDUINO_LIBRARIES=${ESP8266_ARDUINO_LIBRARIES:- $HOME / Arduino/ libraries}
23
+ ;;
24
+ " macOS" )
25
+ ESP8266_ARDUINO_HARDWARE=${ESP8266_ARDUINO_HARDWARE:- $HOME / Documents/ Arduino/ hardware}
26
+ ESP8266_ARDUINO_LIBRARIES=${ESP8266_ARDUINO_LIBRARIES:- $HOME / Documents/ Arduino/ libraries}
27
+ ;;
28
+ " Windows" )
29
+ ESP8266_ARDUINO_HARDWARE=${ESP8266_ARDUINO_HARDWARE:- $HOME / Documents/ Arduino/ hardware}
30
+ ESP8266_ARDUINO_LIBRARIES=${ESP8266_ARDUINO_LIBRARIES:- $HOME / Documents/ Arduino/ libraries}
31
+ ;;
32
+ * )
33
+ echo ' Unknown ${RUNNER_OS} = "' ${RUNNER_OS} ' "'
34
+ exit 2
35
+ esac
36
+
37
+ source " $root /tests/lib-skip-ino.sh"
17
38
source " $root /tests/common.sh"
18
39
19
40
cmd=${0##*/ }
@@ -22,21 +43,22 @@ ENVIRONMENT:
22
43
ESP8266_ARDUINO_SKETCHES - list of .ino files; defaults to **all available examples**
23
44
ESP8266_ARDUINO_BUILDER - arduino or platformio
24
45
25
- For Arduino IDE:
26
- ESP8266_ARDUINO_IDE - path to the IDE (portable)
46
+ For Arduino CLI:
27
47
ESP8266_ARDUINO_HARDWARE - path to the hardware directory (usually, containing our repo)
28
48
ESP8266_ARDUINO_LIBRATIES - path to the libraries directory (external dependencies)
29
49
ESP8266_ARDUINO_DEBUG - debug or nodebug
30
50
ESP8266_ARDUINO_LWIP - v4 or v6
31
51
32
52
USAGE:
33
53
$cmd <[even | odd]> - build every Nth, when '<N> % 2' is either even or odd
34
- $cmd <mod> <rem> - build every Nth, when '<N> % <mod>' is equal to 'rem'
54
+ $cmd <mod> <rem> <[cnt]> - build every Nth, when '<N> % <mod>' is equal to 'rem'
55
+ optionally, set <cnt> to start with the Nth sketch
35
56
$cmd - build every .ino file from ESP8266_ARDUINO_SKETCHES
36
57
"
37
58
38
59
mod=1
39
60
rem=0
61
+ cnt=0
40
62
41
63
if [ " $# " -eq 1 ] ; then
42
64
case " $1 " in
@@ -60,6 +82,10 @@ if [ "$#" -eq 1 ] ; then
60
82
elif [ " $# " -eq 2 ] ; then
61
83
mod=$1
62
84
rem=$2
85
+ elif [ " $# " -eq 3 ] ; then
86
+ mod=$1
87
+ rem=$2
88
+ cnt=$3
63
89
elif [ " $# " -gt 2 ] ; then
64
90
echo " $usage "
65
91
exit 1
72
98
case " $ESP8266_ARDUINO_BUILDER " in
73
99
" arduino" )
74
100
install_arduino " $ESP8266_ARDUINO_DEBUG "
75
- build_sketches_with_arduino " $mod " " $rem " " $ESP8266_ARDUINO_LWIP "
101
+ build_sketches_with_arduino " $ESP8266_ARDUINO_LWIP " " $ mod" " $rem " " $cnt "
76
102
;;
77
103
" platformio" )
78
104
install_platformio nodemcuv2
79
- build_sketches_with_platformio " $mod " " $rem "
105
+ build_sketches_with_platformio " $mod " " $rem " " $cnt "
106
+ ;;
107
+ " print" )
108
+ print_sketch_info " $mod " " $rem "
80
109
;;
81
110
* )
82
- echo " Unknown builder! Must be either arduino or platformio "
111
+ echo " Unknown builder! Must be one of - arduino, platformio or print "
83
112
exit 1
84
113
;;
85
114
esac
0 commit comments