extract out commonalities between various things that do stuff with sketches

tmp/arduino-cli-pre-rebase
Jesse Vincent 4 years ago
parent 36f9582135
commit 856d7a91a8
No known key found for this signature in database
GPG Key ID: CC228463465E40BC

@ -225,10 +225,7 @@ _prompt_before_flashing() {
flash() { flash() {
_find_sketch _set_up_environment
_ensure_sketch_found
_set_build_paths
_set_executable_paths
# Check to see if we can see a keyboard bootloader port. # Check to see if we can see a keyboard bootloader port.
@ -254,10 +251,7 @@ flash() {
hex_with_bootloader() { hex_with_bootloader() {
_find_sketch _set_up_environment
_ensure_sketch_found
_set_build_paths
_set_executable_paths
: "${BOOTLOADER_PATH:=$(_arduino_prop 'runtime.platform.path')/bootloaders/$(_arduino_prop 'bootloader.file')}" : "${BOOTLOADER_PATH:=$(_arduino_prop 'runtime.platform.path')/bootloaders/$(_arduino_prop 'bootloader.file')}"
@ -276,10 +270,7 @@ hex_with_bootloader() {
} }
compile() { compile() {
_find_sketch _set_up_environment
_ensure_sketch_found
_set_build_paths
_set_executable_paths
install -d "${OUTPUT_PATH}" install -d "${OUTPUT_PATH}"
@ -340,29 +331,27 @@ compile() {
} }
size_map() { size_map() {
_find_sketch _set_up_environment
_ensure_sketch_found
_set_build_paths
_set_executable_paths
"${AVR_NM}" --size-sort -C -r -l -t decimal "${ELF_FILE_PATH}" "${AVR_NM}" --size-sort -C -r -l -t decimal "${ELF_FILE_PATH}"
} }
disassemble() { disassemble() {
_find_sketch _set_up_environment
_ensure_sketch_found
_set_build_paths
_set_executable_paths
"${AVR_OBJDUMP}" -C -d "${ELF_FILE_PATH}" "${AVR_OBJDUMP}" -C -d "${ELF_FILE_PATH}"
} }
clean() { clean() {
_set_up_environment
if [ -d "$OUTPUT_PATH" ]; then
rm -rf -- "${OUTPUT_PATH}"
fi
}
_set_up_environment() {
_find_sketch _find_sketch
_ensure_sketch_found _ensure_sketch_found
_set_build_paths _set_build_paths
_set_executable_paths _set_executable_paths
if [ -d "$OUTPUT_PATH" ]; then
rm -rf -- "${OUTPUT_PATH}"
fi
} }
_find_bootloader_port() { _find_bootloader_port() {

Loading…
Cancel
Save