minor refactoring

tmp/arduino-cli-pre-rebase
Jesse Vincent 4 years ago
parent 41bad3d172
commit 0774763b94
No known key found for this signature in database
GPG Key ID: CC228463465E40BC

@ -20,7 +20,6 @@ set -e
###### ######
identify_os() { identify_os() {
## Platform-specific overrides ## Platform-specific overrides
# Shamelessly stolen from git's Makefile # Shamelessly stolen from git's Makefile
uname_S=$(uname -s 2>/dev/null || echo not) uname_S=$(uname -s 2>/dev/null || echo not)
@ -270,6 +269,7 @@ flash() {
: "${SKETCH_PID:=$(_arduino_prop 'build.pid')}" : "${SKETCH_PID:=$(_arduino_prop 'build.pid')}"
: "${BOOTLOADER_PID:=$(_arduino_prop 'bootloader.pid')}" : "${BOOTLOADER_PID:=$(_arduino_prop 'bootloader.pid')}"
: "${BOOTLOADER_VID:=$(_arduino_prop 'bootloader.vid')}" : "${BOOTLOADER_VID:=$(_arduino_prop 'bootloader.vid')}"
: "${BOOTLOADER_VID:=${VID}}"
# Check to see if we can see a keyboard bootloader port. # Check to see if we can see a keyboard bootloader port.
# If we -can-, then we should skip over the "reset to bootloader" thing # If we -can-, then we should skip over the "reset to bootloader" thing
@ -281,18 +281,15 @@ flash() {
# shellcheck disable=SC2154 # shellcheck disable=SC2154
${preFlash_HOOKS} ${preFlash_HOOKS}
find_device_port find_device_port
run_arduino_cli upload \ port="${DEVICE_PORT}"
--fqbn "${FQBN}" \ else
--port "${DEVICE_PORT}" \ port="${DEVICE_PORT_BOOTLOADER}"
--verbose
fi fi
run_arduino_cli upload \ run_arduino_cli upload \
--fqbn "${FQBN}" \ --fqbn "${FQBN}" \
--port "${DEVICE_PORT_BOOTLOADER}" \ --port "${port}" \
--verbose "${ARDUINO_VERBOSE}"
# This is defined in the (optional) user config. # This is defined in the (optional) user config.
# shellcheck disable=SC2154 # shellcheck disable=SC2154
${postFlash_HOOKS} ${postFlash_HOOKS}
@ -321,6 +318,8 @@ hex_with_bootloader() {
compile() { compile() {
find_sketch find_sketch
set_executable_paths set_executable_paths
build_paths
enable_ccache
: "${LIB_PROPERTIES_PATH:="../.."}" : "${LIB_PROPERTIES_PATH:="../.."}"
GIT_VERSION="$( GIT_VERSION="$(
@ -333,8 +332,6 @@ compile() {
)${GIT_VERSION}" )${GIT_VERSION}"
build_paths
enable_ccache
: "${OUTPUT_FILE_PREFIX:=${SKETCH_BASE_NAME}-${LIB_VERSION}}" : "${OUTPUT_FILE_PREFIX:=${SKETCH_BASE_NAME}-${LIB_VERSION}}"
: "${HEX_FILE_PATH:=${OUTPUT_PATH}/${OUTPUT_FILE_PREFIX}.hex}" : "${HEX_FILE_PATH:=${OUTPUT_PATH}/${OUTPUT_FILE_PREFIX}.hex}"
: "${HEX_FILE_WITH_BOOTLOADER_PATH:=${OUTPUT_PATH}/${OUTPUT_FILE_PREFIX}-with-bootloader.hex}" : "${HEX_FILE_WITH_BOOTLOADER_PATH:=${OUTPUT_PATH}/${OUTPUT_FILE_PREFIX}-with-bootloader.hex}"
@ -437,7 +434,6 @@ find_bootloader_ports() {
return return
fi fi
: "${BOOTLOADER_VID:=${VID}}"
if [ "${uname_S}" = "Darwin" ]; then if [ "${uname_S}" = "Darwin" ]; then
DEVICE_PORT_PROBER="${KALEIDOSCOPE_BIN_DIR}/find-device-port-macos" DEVICE_PORT_PROBER="${KALEIDOSCOPE_BIN_DIR}/find-device-port-macos"
DEVICE_PORT_BOOTLOADER="$(perl "${DEVICE_PORT_PROBER}" "${BOOTLOADER_VID}" "${BOOTLOADER_PID}")" DEVICE_PORT_BOOTLOADER="$(perl "${DEVICE_PORT_PROBER}" "${BOOTLOADER_VID}" "${BOOTLOADER_PID}")"
@ -447,9 +443,7 @@ find_bootloader_ports() {
elif [ "${uname_S}" = "FreeBSD" ]; then elif [ "${uname_S}" = "FreeBSD" ]; then
DEVICE_PORT_PROBER="${KALEIDOSCOPE_BIN_DIR}/find-device-port-freebsd" DEVICE_PORT_PROBER="${KALEIDOSCOPE_BIN_DIR}/find-device-port-freebsd"
DEVICE_PORT_BOOTLOADER="$(perl "${DEVICE_PORT_PROBER}")" DEVICE_PORT_BOOTLOADER="$(perl "${DEVICE_PORT_PROBER}")"
else else
DEVICE_PORT_PROBER="${KALEIDOSCOPE_BIN_DIR}/find-device-port-linux-udev" DEVICE_PORT_PROBER="${KALEIDOSCOPE_BIN_DIR}/find-device-port-linux-udev"
DEVICE_PORT_BOOTLOADER="$(perl "${DEVICE_PORT_PROBER}" "${BOOTLOADER_VID}" "${BOOTLOADER_PID}")" DEVICE_PORT_BOOTLOADER="$(perl "${DEVICE_PORT_PROBER}" "${BOOTLOADER_VID}" "${BOOTLOADER_PID}")"
fi fi

Loading…
Cancel
Save