-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild-with-cli.sh
executable file
·66 lines (55 loc) · 2.08 KB
/
build-with-cli.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
##############################################################################
#
# Module: build-with-cli.sh
#
# Function:
# This script must be sourced; it sets variables used by other
# scripts in this directory.
#
# Usage:
# build-with-cli.sh --help
#
# Copyright and License:
# See accompanying LICENSE.md file
#
# Author:
# Terry Moore, MCCI February 2021
#
##############################################################################
# install arduino-cli from github using:
# curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
# if Linux, to set up:
# sudo dpkg --add-architecture i386
# sudo apt install libc6-i386
# exit if any errors encountered
set -e
# get the path to this file as the default for the build path.
PDIR=$(realpath "$(dirname "$0")")
# export the root name of this script for use by build-common.
PNAME=$(basename "$0")
export PNAME
# so the build directory shows up where this script lives, CD here.
cd "$PDIR"
# launch the common script and pass in the args.
. "${PDIR}/extra/tools-build-with-cli/build-with-cli-lib.sh"
function _setProject {
#---- project settings -----
readonly OPTOUTPUTNAME_DEFAULT=Catena4430_Sensor
readonly OPTARDUINO_SOURCE_DEFAULT=sketches/Catena4430_Sensor/Catena4430_Sensor.ino
readonly OPTARDUINO_BOARD_DEFAULT=4610
readonly OPTKEYFILE_DEFAULT="$INVOKEDIR/keys/project.pem"
readonly OPTREGION_DEFAULT=us915
readonly OPTNETWORK_DEFAULT=ttn
readonly OPTSUBBAND_DEFAULT=default
readonly OPTCLOCK_DEFAULT=2
readonly OPTXSERIAL_DEFAULT=hw
}
# result is version as either x.y.z-N or x.y.z (if pre-release tag is -0)
_debug "Override _getversion"
function _getversion {
sed -n -e '/^constexpr std::uint32_t kAppVersion /s/^.*makeVersion[ \t]*([ \t]*\([0-9]*\)[ \t]*,[ \t]*\([0-9]*\)[ \t]*,[ \t]*\([0-9]*\)[ \t]*,[ \t]*\([0-9]*\)[ \t]*).*/\1.\2.\3_pre\4/p' \
-e '/^constexpr std::uint32_t kAppVersion /s/^.*makeVersion[ \t]*([ \t]*\([0-9]*\)[ \t]*,[ \t]*\([0-9]*\)[ \t]*,[ \t]*\([0-9]*\)[ \t]*).*/\1.\2.\3/p' "$1" |
sed -e 's/_pre0$//'
}
_doBuild "$@"