From 36af0f3023e84ccd1869a6a46681be12020f4400 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sat, 24 Oct 2020 02:14:20 -0700 Subject: [PATCH] inline a couple single-call functions --- bin/kaleidoscope-builder | 50 ++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/bin/kaleidoscope-builder b/bin/kaleidoscope-builder index 24c1d67f..7e2d3cbc 100755 --- a/bin/kaleidoscope-builder +++ b/bin/kaleidoscope-builder @@ -158,18 +158,6 @@ set_executable_paths() { : "${AVR_SIZE:=${COMPILER_PATH}/${COMPILER_PREFIX}size}" } -build_version() { - : "${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}" -} - build_paths() { # We need that echo because we\re piping to cksum # shellcheck disable=SC2005 @@ -192,13 +180,6 @@ build_paths() { mkdir -p "$BUILD_PATH" } -build_filenames() { - : "${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}" -} enable_ccache() { if [ -z "${CCACHE_NOT_SUPPORTED}" ] && [ "$(command -v ccache)" ]; then @@ -264,12 +245,6 @@ find_sketch() { exit 1 } -find_device_vid_pid() { - : "${VID:=$(_arduino_prop 'build.vid')}" - : "${SKETCH_PID:=$(_arduino_prop 'build.pid')}" - : "${BOOTLOADER_PID:=$(_arduino_prop 'bootloader.pid')}" - : "${BOOTLOADER_VID:=$(_arduino_prop 'bootloader.vid')}" -} prompt_before_flashing() { flashing_instructions=$(_arduino_prop 'build.flashing_instructions') @@ -291,7 +266,11 @@ prompt_before_flashing() { flash() { compile "$@" - find_device_vid_pid + : "${VID:=$(_arduino_prop 'build.vid')}" + : "${SKETCH_PID:=$(_arduino_prop 'build.pid')}" + : "${BOOTLOADER_PID:=$(_arduino_prop 'bootloader.pid')}" + : "${BOOTLOADER_VID:=$(_arduino_prop 'bootloader.vid')}" + # Check to see if we can see a keyboard bootloader port. # If we -can-, then we should skip over the "reset to bootloader" thing find_bootloader_ports @@ -342,10 +321,25 @@ hex_with_bootloader() { compile() { find_sketch set_executable_paths - build_version + + : "${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}" + + build_paths - build_filenames enable_ccache + : "${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}" install -d "${OUTPUT_PATH}"