Extract the compilation step from the flashing preparation step

pull/815/head
Jesse Vincent 5 years ago
parent 010f4b466c
commit 1b117b9eb0
No known key found for this signature in database
GPG Key ID: CC228463465E40BC

@ -142,12 +142,9 @@ find_sketch () {
exit 1 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') flashing_instructions=$(get_arduino_pref 'build.flashing_instructions')
if [ "x${flashing_instructions}x" == "xx" ]; then if [ "x${flashing_instructions}x" == "xx" ]; then
@ -165,7 +162,8 @@ prepare_to_flash () {
} }
flash () { flash () {
prepare_to_flash maybe_build
prompt_before_flashing
# This is defined in the (optional) user config. # This is defined in the (optional) user config.
# shellcheck disable=SC2154 # shellcheck disable=SC2154
@ -196,13 +194,15 @@ flash_over_usb () {
} }
flash_from_bootloader() { flash_from_bootloader() {
prepare_to_flash maybe_build
prompt_before_flashing
find_bootloader_ports find_bootloader_ports
check_bootloader_port_and_flash check_bootloader_port_and_flash
} }
program() { program() {
prepare_to_flash maybe_build
prompt_before_flashing
flash_with_programmer flash_with_programmer
} }
@ -238,6 +238,13 @@ hex_with_bootloader () {
EOF EOF
} }
maybe_build () {
if [ ! -e "${HEX_FILE_PATH}" ]; then
build
fi
}
build () { build () {
compile "$@" compile "$@"
size "$@" size "$@"

Loading…
Cancel
Save