-
Notifications
You must be signed in to change notification settings - Fork 8
/
entrypoint.sh
executable file
·44 lines (37 loc) · 1.09 KB
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh
set -e
BUILDER_PATH="/opt/arduino"
LIBRARIES_PATH="$BUILDER_PATH/libraries:$GITHUB_WORKSPACE/../"
SKETCH_PATH="$INPUT_SKETCH"
BOARD_NAME="$INPUT_BOARD"
SKETCH_DIRECTORY_PATH="$INPUT_SKETCHDIRECTORY"
if [ -d "$INPUT_LIBRARIES" ]; then
LIBRARIES_PATH="$LIBRARIES_PATH:$INPUT_LIBRARIES"
fi
getLibraryOptions() {
local IFS=":"
for library in $1
do
echo -n " -libraries $library"
done
}
BUILDER_OPTIONS="-hardware $BUILDER_PATH/hardware -tools $BUILDER_PATH/hardware/tools/avr -tools $BUILDER_PATH/tools-builder `getLibraryOptions $LIBRARIES_PATH` -fqbn $BOARD_NAME"
if [ -d "$INPUT_HARDWARE" ]; then
BUILDER_OPTIONS="$BUILDER_OPTIONS -hardware $INPUT_HARDWARE"
fi
if [ -n "$SKETCH_PATH" ]; then
if [ -z "$1" ]; then
arduino-builder $BUILDER_OPTIONS "$SKETCH_PATH"
else
arduino-builder "$@" "$SKETCH_PATH"
fi
else
for sketch in `find "$SKETCH_DIRECTORY_PATH" -name '*.ino'`
do
if [ -z "$1" ]; then
arduino-builder $BUILDER_OPTIONS "$sketch"
else
arduino-builder "$@" "$sketch"
fi
done
fi