From 0025d44f3402dfa89eeeb07fe8b123949382fd2e Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Mon, 22 May 2017 14:29:20 -0700 Subject: [PATCH 1/2] Only calculate version and filenames as we're building. This helps unbreak build-all and out of tree builds --- tools/kaleidoscope-builder | 2 ++ tools/kaleidoscope-builder.conf | 29 +++++++++++++++-------------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/tools/kaleidoscope-builder b/tools/kaleidoscope-builder index 88529676..93e1d248 100755 --- a/tools/kaleidoscope-builder +++ b/tools/kaleidoscope-builder @@ -95,6 +95,8 @@ build () { } compile () { + build_version + build_filenames install -d "${OUTPUT_PATH}" echo "Building ${OUTPUT_DIR}/${SKETCH} (${LIB_VERSION}) ..." diff --git a/tools/kaleidoscope-builder.conf b/tools/kaleidoscope-builder.conf index 11356bfc..0d0306d1 100644 --- a/tools/kaleidoscope-builder.conf +++ b/tools/kaleidoscope-builder.conf @@ -93,20 +93,21 @@ BOOTLOADER_PATH="${BOOTLOADER_PATH:-${BOARD_HARDWARE_PATH}/keyboardio/avr/bootlo ###### Build and output configuration ###### -GIT_VERSION="$(cd $(find_sketch); git describe --abbrev=4 --dirty --always)" -LIB_VERSION="$(cd $(find_sketch); (grep version= ../../library.properties 2>/dev/null || echo version=0.0.0) | cut -d= -f2)-g${GIT_VERSION}" - -BUILD_PATH="${BUILD_PATH:-$(mktemp -d 2>/dev/null || mktemp -d -t 'build')}" -OUTPUT_DIR="${OUTPUT_DIR:-output/${LIBRARY}}" -OUTPUT_PATH="${OUTPUT_PATH:-${SOURCEDIR}/${OUTPUT_DIR}}" - - -OUTPUT_FILE_PREFIX="${SKETCH}-${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" - +build_version () { + GIT_VERSION="$(cd $(find_sketch); git describe --abbrev=4 --dirty --always)" + LIB_VERSION="$(cd $(find_sketch); (grep version= ../../library.properties 2>/dev/null || echo version=0.0.0) | cut -d= -f2)-g${GIT_VERSION}" + + BUILD_PATH="${BUILD_PATH:-$(mktemp -d 2>/dev/null || mktemp -d -t 'build')}" + OUTPUT_DIR="${OUTPUT_DIR:-output/${LIBRARY}}" + OUTPUT_PATH="${OUTPUT_PATH:-${SOURCEDIR}/${OUTPUT_DIR}}" +} + +build_filenames () { + OUTPUT_FILE_PREFIX="${SKETCH}-${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" +} From 5babb704988fd047048c7b757da998a03b0ba54c Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Mon, 22 May 2017 14:44:26 -0700 Subject: [PATCH 2/2] Move a pre-build check to somewhere it won't break on build-all --- tools/kaleidoscope-builder | 4 ++++ tools/kaleidoscope-builder.conf | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/kaleidoscope-builder b/tools/kaleidoscope-builder index 93e1d248..8822a532 100755 --- a/tools/kaleidoscope-builder +++ b/tools/kaleidoscope-builder @@ -19,6 +19,10 @@ firmware_size () { find_sketch () { SKETCH="${SKETCH:-${DEFAULT_SKETCH}}" LIBRARY="${LIBRARY:-${SKETCH}}" + if [ -z "${SKETCH}" ] || [ -z "${LIBRARY}" ] || [ -z "${ROOT}" ] || [ -z "${SOURCEDIR}" ]; then + echo "SKETCH, LIBRARY, SOURCEDIR, and ROOT need to be set before including this file!" >&2 + exit 1 + fi for path in "hardware/keyboardio/avr/libraries/Kaleidoscope-${LIBRARY}/examples/${SKETCH}" \ "examples/${LIBRARY}" \ diff --git a/tools/kaleidoscope-builder.conf b/tools/kaleidoscope-builder.conf index 0d0306d1..0cb36f87 100644 --- a/tools/kaleidoscope-builder.conf +++ b/tools/kaleidoscope-builder.conf @@ -11,10 +11,6 @@ esac SKETCH="${SKETCH:-${DEFAULT_SKETCH}}" LIBRARY="${LIBRARY:-${SKETCH}}" -if [ -z "${SKETCH}" ] || [ -z "${LIBRARY}" ] || [ -z "${ROOT}" ] || [ -z "${SOURCEDIR}" ]; then - echo "SKETCH, LIBRARY, SOURCEDIR, and ROOT need to be set before including this file!" >&2 - exit 1 -fi ########