From 1b117b9eb08b8841a214b5de8f9cf2a41e3e8805 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sun, 23 Feb 2020 22:47:05 -0800 Subject: [PATCH] Extract the compilation step from the flashing preparation step --- bin/kaleidoscope-builder | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/bin/kaleidoscope-builder b/bin/kaleidoscope-builder index 1e44abd7..60ac9bb9 100755 --- a/bin/kaleidoscope-builder +++ b/bin/kaleidoscope-builder @@ -142,12 +142,9 @@ find_sketch () { exit 1 } -prepare_to_flash () { - if [ ! -e "${HEX_FILE_PATH}" ]; then - compile - size - fi - + + +prompt_before_flashing () { flashing_instructions=$(get_arduino_pref 'build.flashing_instructions') if [ "x${flashing_instructions}x" == "xx" ]; then @@ -165,7 +162,8 @@ prepare_to_flash () { } flash () { - prepare_to_flash + maybe_build + prompt_before_flashing # This is defined in the (optional) user config. # shellcheck disable=SC2154 @@ -196,13 +194,15 @@ flash_over_usb () { } flash_from_bootloader() { - prepare_to_flash + maybe_build + prompt_before_flashing find_bootloader_ports check_bootloader_port_and_flash } program() { - prepare_to_flash + maybe_build + prompt_before_flashing flash_with_programmer } @@ -238,6 +238,13 @@ hex_with_bootloader () { EOF } +maybe_build () { + if [ ! -e "${HEX_FILE_PATH}" ]; then + build + fi + +} + build () { compile "$@" size "$@"