More builder refactoring to use our new functionality

pull/815/head
Jesse Vincent 5 years ago
parent 17978858ce
commit 6349cb8395
No known key found for this signature in database
GPG Key ID: CC228463465E40BC

@ -45,22 +45,12 @@ uname_O=$(uname -o 2>/dev/null || echo not)
find_max_prog_size() { find_max_prog_size() {
# SKETCH and -build-path in this command are here because of a bug introduced in Arduino 1.8.10
# https://github.com/arduino/arduino-builder/issues/341 # https://github.com/arduino/arduino-builder/issues/341
VPIDS=$("${ARDUINO_BUILDER}" \ PREFS=$(dump_arduino_prefs | grep "upload\.maximum_size=")
-hardware "${ARDUINO_PATH}/hardware" \ MAX_PROG_SIZE=${MAX_PROG_SIZE:-$(echo "${PREFS}" | head -n 1 | cut -d= -f2)}
-hardware "${BOARD_HARDWARE_PATH}" \
${ARDUINO_TOOLS_FLAG:+"${ARDUINO_TOOLS_FLAG}"} ${ARDUINO_TOOLS_PARAM:+"${ARDUINO_TOOLS_PARAM}"} \
-tools "${ARDUINO_PATH}/tools-builder" \
-fqbn "${FQBN}" \
-build-path "${ARDUINO_PATH}" \
-dump-prefs "${SKETCH_DIR}/${SKETCH}.ino" | grep "upload\.maximum_size=")
MAX_PROG_SIZE=${MAX_PROG_SIZE:-$(echo "${VPIDS}" | grep upload.maximum_size | head -n 1 | cut -d= -f2)}
} }
find_device_vid_pid() { find_device_vid_pid() {
# SKETCH and -build-path in this command are here because of a bug introduced in Arduino 1.8.10
# https://github.com/arduino/arduino-builder/issues/341
VPIDS=$(dump_arduino_prefs | grep "\.[vp]id=") VPIDS=$(dump_arduino_prefs | grep "\.[vp]id=")
VID=${VID:-$(echo "${VPIDS}" | grep build.vid= | cut -dx -f2)} VID=${VID:-$(echo "${VPIDS}" | grep build.vid= | cut -dx -f2)}
SKETCH_PID=${SKETCH_PID:-$(echo "${VPIDS}" | grep build.pid= | cut -dx -f2)} SKETCH_PID=${SKETCH_PID:-$(echo "${VPIDS}" | grep build.pid= | cut -dx -f2)}
@ -70,6 +60,8 @@ find_device_vid_pid() {
dump_arduino_prefs() { dump_arduino_prefs() {
# SKETCH and -build-path in this command are here because of a bug introduced in Arduino 1.8.10
# https://github.com/arduino/arduino-builder/issues/341
prefs=$("${ARDUINO_BUILDER}" \ prefs=$("${ARDUINO_BUILDER}" \
-hardware "${ARDUINO_PATH}/hardware" \ -hardware "${ARDUINO_PATH}/hardware" \
-hardware "${BOARD_HARDWARE_PATH}" \ -hardware "${BOARD_HARDWARE_PATH}" \
@ -112,14 +104,7 @@ find_bootloader_ports() {
} }
find_bootloader_path() { find_bootloader_path() {
BOOTLOADER_FILE=$("${ARDUINO_BUILDER}" \ BOOTLOADER_FILE=$( dump_arduino_prefs | grep "bootloader\.file=" | cut -d= -f2)
-hardware "${ARDUINO_PATH}/hardware" \
-hardware "${BOARD_HARDWARE_PATH}" \
${ARDUINO_TOOLS_FLAG:+"${ARDUINO_TOOLS_FLAG}"} ${ARDUINO_TOOLS_PARAM:+"${ARDUINO_TOOLS_PARAM}"} \
-tools "${ARDUINO_PATH}/tools-builder" \
-fqbn "${FQBN}" \
-build-path "${ARDUINO_PATH}" \
-dump-prefs "${SKETCH_DIR}/${SKETCH}.ino" | grep "bootloader\.file=" | cut -d= -f2)
BOOTLOADER_FILE="${BOOTLOADER_FILE:-caterina/Caterina.hex}" BOOTLOADER_FILE="${BOOTLOADER_FILE:-caterina/Caterina.hex}"
BOOTLOADER_PATH="${BOOTLOADER_PATH:-${BOARD_HARDWARE_PATH}/keyboardio/avr/bootloaders/${BOOTLOADER_FILE}}" BOOTLOADER_PATH="${BOOTLOADER_PATH:-${BOARD_HARDWARE_PATH}/keyboardio/avr/bootloaders/${BOOTLOADER_FILE}}"

Loading…
Cancel
Save