From dbb4f3b1ae8a850a8a622c1ad0e6b9c6e3d3fb3f Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Fri, 16 Oct 2020 20:50:57 -0700 Subject: [PATCH 1/7] migrate check-docs from generic makefile --- Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makefile b/Makefile index ca085b2d..3415d2b1 100644 --- a/Makefile +++ b/Makefile @@ -121,6 +121,12 @@ shellcheck: shellcheck ${SHELL_FILES}; \ fi + +check-docs: + doxygen $(PLUGIN_TEST_SUPPORT_DIR)/quality/etc/check-docs.conf 2> /dev/null >/dev/null + python $(PLUGIN_TEST_SUPPORT_DIR)/quality/doxy-coverage.py /tmp/undocced/xml + + SMOKE_SKETCHES=$(shell if [ -d ./examples ]; then find ./examples -type f -name \*ino | xargs -n 1 dirname; fi) smoke-sketches: $(SMOKE_SKETCHES) From a91c6a556e380f9534d100357bb7a4321d517e9a Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Fri, 16 Oct 2020 21:08:20 -0700 Subject: [PATCH 2/7] refactor config file list to all be in one place --- bin/kaleidoscope-builder | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/bin/kaleidoscope-builder b/bin/kaleidoscope-builder index 7973d2a4..2323de5b 100755 --- a/bin/kaleidoscope-builder +++ b/bin/kaleidoscope-builder @@ -32,14 +32,11 @@ build_version () { } build_paths() { - - # We need that echo because we\re piping to cksum # shellcheck disable=SC2005 SKETCH_IDENTIFIER="$(echo "${SKETCH_FILE_PATH}" | cksum | cut -d ' ' -f 1)-${SKETCH_FILE_NAME}" KALEIDOSCOPE_TEMP_PATH="${KALEIDOSCOPE_TEMP_PATH:-${TMPDIR:-/tmp}/kaleidoscope-${USER}}" - KALEIDOSCOPE_BUILD_PATH="${KALEIDOSCOPE_BUILD_PATH:-${KALEIDOSCOPE_TEMP_PATH}/sketch}" KALEIDOSCOPE_OUTPUT_PATH="${KALEIDOSCOPE_OUTPUT_PATH:-${KALEIDOSCOPE_TEMP_PATH}/sketch}" @@ -665,23 +662,20 @@ KALEIDOSCOPE_BIN_DIR="${KALEIDOSCOPE_DIR}/bin/" # shellcheck disable=SC2155 export SOURCEDIR="$(pwd)" -if [ -e "${HOME}/.kaleidoscope-builder.conf" ]; then - # shellcheck disable=SC1090 - . "${HOME}/.kaleidoscope-builder.conf" -fi -if [ -e "${SOURCEDIR}/.kaleidoscope-builder.conf" ]; then - # shellcheck disable=SC1090 - . "${SOURCEDIR}/.kaleidoscope-builder.conf" -fi +for conf_file in \ + "${HOME}/.kaleidoscope-builder.conf" \ + "${SOURCEDIR}/.kaleidoscope-builder.conf" \ + "${SOURCEDIR}/kaleidoscope-builder.conf" \ + "${KALEIDOSCOPE_DIR}/etc/kaleidoscope-builder.conf"; do + if [ -e "${conf_file}" ]; then + # shellcheck disable=SC1090 + . "${conf_file}" + fi -if [ -e "${SOURCEDIR}/kaleidoscope-builder.conf" ]; then - # shellcheck disable=SC1090 - . "${SOURCEDIR}/kaleidoscope-builder.conf" -fi +done # shellcheck disable=SC1090 -. "${KALEIDOSCOPE_DIR}/etc/kaleidoscope-builder.conf" if [ -n "${VERBOSE}" ] && [[ "${VERBOSE}" -gt 0 ]]; then ARDUINO_VERBOSE="-verbose" From 6e8d1d020a0961032954d4b97aa52763b6fb56ee Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Fri, 16 Oct 2020 22:55:59 -0700 Subject: [PATCH 3/7] Switch to a less verbose way to set defaults for environment variables By reducing duplication, we improve readability and reduce errors --- bin/kaleidoscope-builder | 36 ++++++++-------- etc/kaleidoscope-builder.conf | 80 +++++++++++++++++------------------ 2 files changed, 58 insertions(+), 58 deletions(-) diff --git a/bin/kaleidoscope-builder b/bin/kaleidoscope-builder index 2323de5b..ba25fab1 100755 --- a/bin/kaleidoscope-builder +++ b/bin/kaleidoscope-builder @@ -26,7 +26,7 @@ absolute_filename() { build_version () { - LIB_PROPERTIES_PATH="${LIB_PROPERTIES_PATH:-"../.."}" + : "${LIB_PROPERTIES_PATH:="../.."}" GIT_VERSION="$(cd "${SKETCH_DIR}"; if [ -d .git ]; then echo -n '-g' && git describe --abbrev=4 --dirty --always; fi)" LIB_VERSION="$(cd "${SKETCH_DIR}"; (grep version= "${LIB_PROPERTIES_PATH}/library.properties" 2>/dev/null || echo version=0.0.0) | cut -d= -f2)${GIT_VERSION}" } @@ -35,30 +35,30 @@ build_paths() { # We need that echo because we\re piping to cksum # shellcheck disable=SC2005 SKETCH_IDENTIFIER="$(echo "${SKETCH_FILE_PATH}" | cksum | cut -d ' ' -f 1)-${SKETCH_FILE_NAME}" - KALEIDOSCOPE_TEMP_PATH="${KALEIDOSCOPE_TEMP_PATH:-${TMPDIR:-/tmp}/kaleidoscope-${USER}}" + : "${KALEIDOSCOPE_TEMP_PATH:=${TMPDIR:-/tmp}/kaleidoscope-${USER}}" - KALEIDOSCOPE_BUILD_PATH="${KALEIDOSCOPE_BUILD_PATH:-${KALEIDOSCOPE_TEMP_PATH}/sketch}" - KALEIDOSCOPE_OUTPUT_PATH="${KALEIDOSCOPE_OUTPUT_PATH:-${KALEIDOSCOPE_TEMP_PATH}/sketch}" + : "${KALEIDOSCOPE_BUILD_PATH:=${KALEIDOSCOPE_TEMP_PATH}/sketch}" + : "${KALEIDOSCOPE_OUTPUT_PATH:=${KALEIDOSCOPE_TEMP_PATH}/sketch}" - SKETCH_OUTPUT_DIR="${SKETCH_OUTPUT_DIR:-${SKETCH_IDENTIFIER}/output}" - SKETCH_BUILD_DIR="${SKETCH_BUILD_DIR:-${SKETCH_IDENTIFIER}/build}" + : "${SKETCH_OUTPUT_DIR:=${SKETCH_IDENTIFIER}/output}" + : "${SKETCH_BUILD_DIR:=${SKETCH_IDENTIFIER}/build}" - BUILD_PATH="${BUILD_PATH:-${KALEIDOSCOPE_BUILD_PATH}/${SKETCH_BUILD_DIR}}" - OUTPUT_PATH="${OUTPUT_PATH:-${KALEIDOSCOPE_OUTPUT_PATH}/${SKETCH_OUTPUT_DIR}}" + : "${BUILD_PATH:=${KALEIDOSCOPE_BUILD_PATH}/${SKETCH_BUILD_DIR}}" + : "${OUTPUT_PATH:=${KALEIDOSCOPE_OUTPUT_PATH}/${SKETCH_OUTPUT_DIR}}" - CCACHE_WRAPPER_PATH="${CCACHE_WRAPPER_PATH:-${KALEIDOSCOPE_TEMP_PATH}/ccache/bin}" - CORE_CACHE_PATH="${CORE_CACHE_PATH:-${KALEIDOSCOPE_TEMP_PATH}/arduino-cores}" + : "${CCACHE_WRAPPER_PATH:=${KALEIDOSCOPE_TEMP_PATH}/ccache/bin}" + : "${CORE_CACHE_PATH:=${KALEIDOSCOPE_TEMP_PATH}/arduino-cores}" mkdir -p "$CORE_CACHE_PATH" mkdir -p "$BUILD_PATH" } build_filenames () { - OUTPUT_FILE_PREFIX="${OUTPUT_FILE_PREFIX:-${SKETCH_BASE_NAME}-${LIB_VERSION}}" - HEX_FILE_PATH="${HEX_FILE_PATH:-${OUTPUT_PATH}/${OUTPUT_FILE_PREFIX}.hex}" - HEX_FILE_WITH_BOOTLOADER_PATH="${HEX_FILE_WITH_BOOTLOADER_PATH:-${OUTPUT_PATH}/${OUTPUT_FILE_PREFIX}-with-bootloader.hex}" - ELF_FILE_PATH="${ELF_FILE_PATH:-${OUTPUT_PATH}/${OUTPUT_FILE_PREFIX}.elf}" - LIB_FILE_PATH="${LIB_FILE_PATH:-${OUTPUT_PATH}/${OUTPUT_FILE_PREFIX}.a}" + : "${OUTPUT_FILE_PREFIX:=${SKETCH_BASE_NAME}-${LIB_VERSION}}" + : "${HEX_FILE_PATH:=${OUTPUT_PATH}/${OUTPUT_FILE_PREFIX}.hex}" + : "${HEX_FILE_WITH_BOOTLOADER_PATH:=${OUTPUT_PATH}/${OUTPUT_FILE_PREFIX}-with-bootloader.hex}" + : "${ELF_FILE_PATH:=${OUTPUT_PATH}/${OUTPUT_FILE_PREFIX}.elf}" + : "${LIB_FILE_PATH:=${OUTPUT_PATH}/${OUTPUT_FILE_PREFIX}.a}" } @@ -104,7 +104,7 @@ firmware_size () { return fi - MAX_PROG_SIZE=${MAX_PROG_SIZE:-$(get_arduino_pref 'upload.maximum_size')} + : "${MAX_PROG_SIZE:=$(get_arduino_pref 'upload.maximum_size')}" ## This is a terrible hack, please don't hurt me. - algernon @@ -301,8 +301,8 @@ flash_with_programmer() { find_bootloader_path() { BOOTLOADER_FILE=$( get_arduino_pref 'bootloader.file' ) - BOOTLOADER_FILE="${BOOTLOADER_FILE:-caterina/Caterina.hex}" - BOOTLOADER_PATH="${BOOTLOADER_PATH:-${BOARD_HARDWARE_PATH}/keyboardio/avr/bootloaders/${BOOTLOADER_FILE}}" + : "${BOOTLOADER_FILE:=caterina/Caterina.hex}" + : "${BOOTLOADER_PATH:=${BOARD_HARDWARE_PATH}/keyboardio/avr/bootloaders/${BOOTLOADER_FILE}}" } diff --git a/etc/kaleidoscope-builder.conf b/etc/kaleidoscope-builder.conf index bc528f30..d66716aa 100644 --- a/etc/kaleidoscope-builder.conf +++ b/etc/kaleidoscope-builder.conf @@ -9,15 +9,15 @@ SKETCH="${SKETCH:-${DEFAULT_SKETCH}}" ######## Keyboard hardware definitions ######## -BOARD="${BOARD:-model01}" -MCU="${MCU:-atmega32u4}" +: "${BOARD:=model01}" +: "${MCU:=atmega32u4}" if [ -z "${ARCH}" ]; then ARCH=$(echo "${FQBN}" | sed -n -e 's/^[^:]\+:\([^:]\+\).*/\1/p') fi if [ "${ARCH}" = "virtual" ]; then - FQBN="${FQBN:-keyboardio:virtual:${BOARD}}" + : "${FQBN:=keyboardio:virtual:${BOARD}}" # Set the compiler path for virtual builds # @@ -31,7 +31,7 @@ else fi if [ -z "${FQBN}" ]; then - FQBN="${FQBN:-keyboardio:avr:${BOARD}}" + : "${FQBN:=keyboardio:avr:${BOARD}}" fi ######## @@ -45,10 +45,10 @@ uname_O=$(uname -o 2>/dev/null || echo not) find_device_vid_pid() { - VID=${VID:-$(get_arduino_pref 'build.vid')} - SKETCH_PID=${SKETCH_PID:-$(get_arduino_pref 'build.pid')} - BOOTLOADER_PID=${BOOTLOADER_PID:-$(get_arduino_pref 'bootloader.pid')} - BOOTLOADER_VID=${BOOTLOADER_VID:-$(get_arduino_pref 'bootloader.vid')} + : ${VID:=$(get_arduino_pref 'build.vid')} + : ${SKETCH_PID:=$(get_arduino_pref 'build.pid')} + : ${BOOTLOADER_PID:=$(get_arduino_pref 'bootloader.pid')} + : ${BOOTLOADER_VID:=$(get_arduino_pref 'bootloader.vid')} } @@ -96,7 +96,7 @@ reset_device_cmd() { find_bootloader_ports() { find_device_vid_pid - BOOTLOADER_VID="${BOOTLOADER_VID:-${VID}}" + : "${BOOTLOADER_VID:=${VID}}" DEVICE_PORT_PROBER="${KALEIDOSCOPE_BIN_DIR}/find-device-port-linux-udev" if [[ "${DEVICE_PORT_BOOTLOADER}" = "" ]]; then DEVICE_PORT_BOOTLOADER="$(perl ${DEVICE_PORT_PROBER} ${BOOTLOADER_VID} ${BOOTLOADER_PID})" @@ -119,15 +119,15 @@ if [ "${uname_S}" = "Darwin" ]; then /bin/stty -f ${DEVICE_PORT} 1200 } - ARDUINO_PATH="${ARDUINO_PATH:-/Applications/Arduino.app/Contents/Java/}" - ARDUINO_PACKAGE_PATH="${ARDUINO_PACKAGE_PATH:-${HOME}/Library/Arduino15/packages}" - ARDUINO_LOCAL_LIB_PATH="${ARDUINO_LOCAL_LIB_PATH:-${HOME}/Documents/Arduino}" + : "${ARDUINO_PATH:=/Applications/Arduino.app/Contents/Java/}" + : "${ARDUINO_PACKAGE_PATH:=${HOME}/Library/Arduino15/packages}" + : "${ARDUINO_LOCAL_LIB_PATH:=${HOME}/Documents/Arduino}" MD5="md5" find_bootloader_ports() { find_device_vid_pid - BOOTLOADER_VID="${BOOTLOADER_VID:-${VID}}" + : "${BOOTLOADER_VID:=${VID}}" DEVICE_PORT_PROBER="${KALEIDOSCOPE_BIN_DIR}/find-device-port-macos" if [[ "${DEVICE_PORT_BOOTLOADER}" = "" ]]; then DEVICE_PORT_BOOTLOADER="$(perl ${DEVICE_PORT_PROBER} ${BOOTLOADER_VID} ${BOOTLOADER_PID})" @@ -148,12 +148,12 @@ elif [ "${uname_S}" = "FreeBSD" ]; then } MD5="md5" - AVR_SIZE="${AVR_SIZE:-/usr/local/bin/avr-size}" - AVR_NM="${AVR_NM:-/usr/local/bin/avr-nm}" - AVR_OBJDUMP="${AVR_OBJDUMP:-/usr/local/bin/avr-objdump}" - AVRDUDE="${AVRDUDE:-/usr/local/bin/avrdude}" - AVRDUDE_CONF="${AVRDUDE_CONF:-/usr/local/etc/avrdude.conf}" - ARDUINO_BUILDER="${ARDUINO_BUILDER:-/usr/local/bin/arduino-builder}" + : "${AVR_SIZE:=/usr/local/bin/avr-size}" + : "${AVR_NM:=/usr/local/bin/avr-nm}" + : "${AVR_OBJDUMP:=/usr/local/bin/avr-objdump}" + : "${AVRDUDE:=/usr/local/bin/avrdude}" + : "${AVRDUDE_CONF:=/usr/local/etc/avrdude.conf}" + : "${ARDUINO_BUILDER:=/usr/local/bin/arduino-builder}" find_bootloader_ports() { DEVICE_PORT_PROBER="${KALEIDOSCPE_BIN_DIR}/find-device-port-freebsd" @@ -161,7 +161,7 @@ elif [ "${uname_S}" = "FreeBSD" ]; then } if [ "${ARCH}" = "virtual" ]; then - COMPILER_PATH="${COMPILER_PATH:-/usr/local/bin/}" + : "${COMPILER_PATH:=/usr/local/bin/}" fi elif [ "${uname_O}" = "Cygwin" ]; then @@ -173,9 +173,9 @@ elif [ "${uname_O}" = "Cygwin" ]; then # # It's important that all of these be underneath /cygdrive/c so they can be converted to Windows paths that the # Windows Arduino binaries can understand. - ARDUINO_PATH="${ARDUINO_PATH:-/cygdrive/c/Program\ Files\ (x86)/Arduino}" - ARDUINO_PACKAGE_PATH="${ARDUINO_PACKAGE_PATH:-/cygdrive/c/Users/${USER}/AppData/Local/Arduino15/packages}" - ARDUINO_LOCAL_LIB_PATH="${ARDUINO_LOCAL_LIB_PATH:-/cygdrive/c/Users/${USER}/Arduino}" + : "${ARDUINO_PATH:=/cygdrive/c/Program\ Files\ (x86)/Arduino}" + : "${ARDUINO_PACKAGE_PATH:=/cygdrive/c/Users/${USER}/AppData/Local/Arduino15/packages}" + : "${ARDUINO_LOCAL_LIB_PATH:=/cygdrive/c/Users/${USER}/Arduino}" TMPDIR="${ARDUINO_LOCAL_LIB_PATH:-/cygdrive/c/Users/${USER}/AppData/Local/Temp}" # We need to prevent Windows executables from being passed parameters that are absolute paths, since they won't @@ -207,7 +207,7 @@ elif [ "${uname_O}" = "Cygwin" ]; then find_bootloader_ports() { find_device_vid_pid - BOOTLOADER_VID="${BOOTLOADER_VID:-${VID}}" + : "${BOOTLOADER_VID:=${VID}}" DEVICE_PORT_PROBER="${KALEIDOSCOPE_BIN_DIR}/find-device-port-windows.ps1" DEVICE_PORT_BOOTLOADER="$(powershell -noprofile -executionpolicy bypass ${DEVICE_PORT_PROBER} ${BOOTLOADER_VID} ${BOOTLOADER_PID} -Format COM)" } @@ -218,12 +218,12 @@ fi ###### Arduino tools configuration ###### -ARDUINO_PATH="${ARDUINO_PATH:-/usr/local/arduino}" -ARDUINO_LOCAL_LIB_PATH="${ARDUINO_LOCAL_LIB_PATH:-${HOME}/Arduino}" -ARDUINO_TOOLS_PATH="${ARDUINO_TOOLS_PATH:-${ARDUINO_PATH}/hardware/tools}" -ARDUINO_PACKAGE_PATH="${ARDUINO_PACKAGE_PATH:-${HOME}/.arduino15/packages}" +: "${ARDUINO_PATH:=/usr/local/arduino}" +: "${ARDUINO_LOCAL_LIB_PATH:=${HOME}/Arduino}" +: "${ARDUINO_TOOLS_PATH:=${ARDUINO_PATH}/hardware/tools}" +: "${ARDUINO_PACKAGE_PATH:=${HOME}/.arduino15/packages}" -ARDUINO_BUILDER="${ARDUINO_BUILDER:-${ARDUINO_PATH}/arduino-builder}" +: "${ARDUINO_BUILDER:=${ARDUINO_PATH}/arduino-builder}" ARDUINO_IDE_VERSION="10607" ###### @@ -231,7 +231,7 @@ ARDUINO_IDE_VERSION="10607" ###### # Allow the compiler path to be empty for virtual builds -COMPILER_PATH="${COMPILER_PATH-${ARDUINO_TOOLS_PATH}/avr/bin/}" +: "${COMPILER_PATH=${ARDUINO_TOOLS_PATH}/avr/bin/}" COMPILER_SUFFIX="" @@ -242,25 +242,25 @@ OBJCOPY_BASENAME=$(basename ${OBJCOPY:-objcopy}) # Allow the compiler prefix to be empty for virtual builds COMPILER_PREFIX="${COMPILER_PREFIX-avr-}" -AVR_SIZE="${AVR_SIZE:-${COMPILER_PATH}/${COMPILER_PREFIX}size}" -AVR_SIZE_FLAGS="${AVR_SIZE_FLAGS:--C --mcu=${MCU}}" -AVR_OBJDUMP="${AVR_OBJDUMP:-${COMPILER_PATH}/${COMPILER_PREFIX}objdump}" -AVR_OBJCOPY="${AVR_OBJCOPY:-${COMPILER_PATH}/${COMPILER_PREFIX}objcopy}" -AVR_NM="${AVR_NM:-${COMPILER_PATH}/${COMPILER_PREFIX}nm}" -AVR_AR="${AVR_AR:-${COMPILER_PATH}/${COMPILER_PREFIX}ar}" -AVR_GCC="${AVR_GCC:-${COMPILER_PATH}/${COMPILER_PREFIX}${C_COMPILER_BASENAME}}" +: "${AVR_SIZE:=${COMPILER_PATH}/${COMPILER_PREFIX}size}" +: "${AVR_SIZE_FLAGS:=-C --mcu=${MCU}}" +: "${AVR_OBJDUMP:=${COMPILER_PATH}/${COMPILER_PREFIX}objdump}" +: "${AVR_OBJCOPY:=${COMPILER_PATH}/${COMPILER_PREFIX}objcopy}" +: "${AVR_NM:=${COMPILER_PATH}/${COMPILER_PREFIX}nm}" +: "${AVR_AR:=${COMPILER_PATH}/${COMPILER_PREFIX}ar}" +: "${AVR_GCC:=${COMPILER_PATH}/${COMPILER_PREFIX}${C_COMPILER_BASENAME}}" AVR_GPLUSPLUS="${AVR_GCC:-${COMPILER_PATH}/${COMPILER_PREFIX}${CXX_COMPILER_BASENAME}}" -AVRDUDE="${AVRDUDE:-${ARDUINO_TOOLS_PATH}/avr/bin/avrdude}" -AVRDUDE_CONF="${AVRDUDE_CONF:-${ARDUINO_TOOLS_PATH}/avr/etc/avrdude.conf}" +: "${AVRDUDE:=${ARDUINO_TOOLS_PATH}/avr/bin/avrdude}" +: "${AVRDUDE_CONF:=${ARDUINO_TOOLS_PATH}/avr/etc/avrdude.conf}" ###### ###### Source files and dependencies ###### -BOARD_HARDWARE_PATH="${BOARD_HARDWARE_PATH:-${ARDUINO_LOCAL_LIB_PATH}/hardware}" +: "${BOARD_HARDWARE_PATH:=${ARDUINO_LOCAL_LIB_PATH}/hardware}" if [ ! -z "${ARDUINO_TOOLS_PATH}" ]; then ARDUINO_TOOLS_PARAM="${ARDUINO_TOOLS_PATH}" From de062ea8972c85064d59aa0b2c2bfd59591b873b Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Fri, 16 Oct 2020 23:42:19 -0700 Subject: [PATCH 4/7] missed one --- etc/kaleidoscope-builder.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/kaleidoscope-builder.conf b/etc/kaleidoscope-builder.conf index d66716aa..5032de7a 100644 --- a/etc/kaleidoscope-builder.conf +++ b/etc/kaleidoscope-builder.conf @@ -241,7 +241,7 @@ AR_BASENAME=$(basename ${AR:-ar}) OBJCOPY_BASENAME=$(basename ${OBJCOPY:-objcopy}) # Allow the compiler prefix to be empty for virtual builds -COMPILER_PREFIX="${COMPILER_PREFIX-avr-}" +: "${COMPILER_PREFIX:=avr-}" : "${AVR_SIZE:=${COMPILER_PATH}/${COMPILER_PREFIX}size}" : "${AVR_SIZE_FLAGS:=-C --mcu=${MCU}}" : "${AVR_OBJDUMP:=${COMPILER_PATH}/${COMPILER_PREFIX}objdump}" From 5bea41f6304bb12d624d76ee6bba84c850ac7b30 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Fri, 16 Oct 2020 23:48:02 -0700 Subject: [PATCH 5/7] reduce a bit of code duplication --- bin/kaleidoscope-builder | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bin/kaleidoscope-builder b/bin/kaleidoscope-builder index ba25fab1..427bf27d 100755 --- a/bin/kaleidoscope-builder +++ b/bin/kaleidoscope-builder @@ -357,9 +357,8 @@ prepare_ccache () { compile () { find_sketch build_version - build_paths + prepare_ccache build_filenames - enable_ccache install -d "${OUTPUT_PATH}" From c98b513636e887477d239ed2922a1839c87a9e93 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sat, 17 Oct 2020 00:02:22 -0700 Subject: [PATCH 6/7] Revert "missed one" This reverts commit de062ea8972c85064d59aa0b2c2bfd59591b873b. --- etc/kaleidoscope-builder.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/kaleidoscope-builder.conf b/etc/kaleidoscope-builder.conf index 5032de7a..d66716aa 100644 --- a/etc/kaleidoscope-builder.conf +++ b/etc/kaleidoscope-builder.conf @@ -241,7 +241,7 @@ AR_BASENAME=$(basename ${AR:-ar}) OBJCOPY_BASENAME=$(basename ${OBJCOPY:-objcopy}) # Allow the compiler prefix to be empty for virtual builds -: "${COMPILER_PREFIX:=avr-}" +COMPILER_PREFIX="${COMPILER_PREFIX-avr-}" : "${AVR_SIZE:=${COMPILER_PATH}/${COMPILER_PREFIX}size}" : "${AVR_SIZE_FLAGS:=-C --mcu=${MCU}}" : "${AVR_OBJDUMP:=${COMPILER_PATH}/${COMPILER_PREFIX}objdump}" From 34b428c4a94d9a98ea53decc92d3d88fc229735e Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sat, 17 Oct 2020 00:00:16 -0700 Subject: [PATCH 7/7] Simplify conditional building --- bin/kaleidoscope-builder | 52 ++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 32 deletions(-) diff --git a/bin/kaleidoscope-builder b/bin/kaleidoscope-builder index 427bf27d..26fbd174 100755 --- a/bin/kaleidoscope-builder +++ b/bin/kaleidoscope-builder @@ -171,7 +171,7 @@ prompt_before_flashing () { } flash () { - maybe_build "$@" + compile "$@" # Check to see if we can see a keyboard bootloader port. # If we -can-, then we should skip over the "reset to bootloader" thing @@ -277,14 +277,14 @@ flash_over_usb () { } flash_from_bootloader() { - maybe_build "$@" + compile "$@" prompt_before_flashing find_bootloader_ports check_bootloader_port_and_flash } program() { - maybe_build "$@" + compile "$@" prompt_before_flashing flash_with_programmer } @@ -307,9 +307,7 @@ find_bootloader_path() { hex_with_bootloader () { - if [ ! -e "${HEX_FILE_PATH}" ]; then - compile - fi + compile find_bootloader_path @@ -328,7 +326,17 @@ hex_with_bootloader () { EOF } -maybe_build () { +build () { + compile "$@" + size "$@" +} + + +prepare_ccache () { + build_paths + enable_ccache +} +compile () { find_sketch build_version build_paths @@ -338,27 +346,14 @@ maybe_build () { # But it's less broken for most user use cases # TODO(anyone): Make this suck less if [ "${HEX_FILE_PATH}" -ot "${SKETCH_FILE_PATH}" ]; then - build "$@" + do_compile "$@" fi } -build () { - compile "$@" - size "$@" -} - - -prepare_ccache () { - build_paths - enable_ccache -} -compile () { - find_sketch - build_version +do_compile () { prepare_ccache - build_filenames install -d "${OUTPUT_PATH}" @@ -492,9 +487,7 @@ compile_all () { size () { - if [ ! -e "${HEX_FILE_PATH}" ]; then - compile - fi + compile echo "- Size: ${ELF_FILE_PATH}" # shellcheck disable=SC2086 @@ -503,18 +496,13 @@ size () { } size_map () { - if [ ! -e "${HEX_FILE_PATH}" ]; then - compile - fi + compile "${AVR_NM}" --size-sort -C -r -l -t decimal "${ELF_FILE_PATH}" } disassemble () { - - if [ ! -e "${HEX_FILE_PATH}" ]; then - compile - fi + compile "${AVR_OBJDUMP}" -C -d "${ELF_FILE_PATH}" }