diff --git a/lib/python/qmk/json_schema.py b/lib/python/qmk/json_schema.py index b00df749cc..1d5f863807 100644 --- a/lib/python/qmk/json_schema.py +++ b/lib/python/qmk/json_schema.py @@ -7,6 +7,7 @@ from collections.abc import Mapping from functools import lru_cache from typing import OrderedDict from pathlib import Path +from copy import deepcopy from milc import cli @@ -22,7 +23,8 @@ def _dict_raise_on_duplicates(ordered_pairs): return d -def json_load(json_file, strict=True): +@lru_cache(maxsize=20) +def _json_load_impl(json_file, strict=True): """Load a json file from disk. Note: file must be a Path object. @@ -42,7 +44,11 @@ def json_load(json_file, strict=True): exit(1) -@lru_cache(maxsize=0) +def json_load(json_file, strict=True): + return deepcopy(_json_load_impl(json_file=json_file, strict=strict)) + + +@lru_cache(maxsize=20) def load_jsonschema(schema_name): """Read a jsonschema file from disk. """ @@ -57,7 +63,7 @@ def load_jsonschema(schema_name): return json_load(schema_path) -@lru_cache(maxsize=0) +@lru_cache(maxsize=1) def compile_schema_store(): """Compile all our schemas into a schema store. """ @@ -73,7 +79,7 @@ def compile_schema_store(): return schema_store -@lru_cache(maxsize=0) +@lru_cache(maxsize=20) def create_validator(schema): """Creates a validator for the given schema id. """ diff --git a/platforms/avr/platform.mk b/platforms/avr/platform.mk index aef449cadf..a625f2e5d0 100644 --- a/platforms/avr/platform.mk +++ b/platforms/avr/platform.mk @@ -201,17 +201,17 @@ else ifeq ($(strip $(BOOTLOADER)), qmk-hid) QMK_BOOTLOADER_TYPE = HID endif -bootloader: +bootloader: cpfirmware ifeq ($(strip $(QMK_BOOTLOADER_TYPE)),) $(call CATASTROPHIC_ERROR,Invalid BOOTLOADER,Please set BOOTLOADER to "qmk-dfu" or "qmk-hid" first!) else - make -C lib/lufa/Bootloaders/$(QMK_BOOTLOADER_TYPE)/ clean + make -C lib/lufa/Bootloaders/$(QMK_BOOTLOADER_TYPE)/ clean TARGET=Bootloader$(QMK_BOOTLOADER_TYPE) $(QMK_BIN) generate-dfu-header --quiet --keyboard $(KEYBOARD) --output lib/lufa/Bootloaders/$(QMK_BOOTLOADER_TYPE)/Keyboard.h $(eval MAX_SIZE=$(shell n=`$(CC) -E -mmcu=$(MCU) -D__ASSEMBLER__ $(CFLAGS) $(OPT_DEFS) platforms/avr/bootloader_size.c 2> /dev/null | sed -ne 's/\r//;/^#/n;/^AVR_SIZE:/,$${s/^AVR_SIZE: //;p;}'` && echo $$(($$n)) || echo 0)) $(eval PROGRAM_SIZE_KB=$(shell n=`expr $(MAX_SIZE) / 1024` && echo $$(($$n)) || echo 0)) $(eval BOOT_SECTION_SIZE_KB=$(shell n=`expr $(BOOTLOADER_SIZE) / 1024` && echo $$(($$n)) || echo 0)) $(eval FLASH_SIZE_KB=$(shell n=`expr $(PROGRAM_SIZE_KB) + $(BOOT_SECTION_SIZE_KB)` && echo $$(($$n)) || echo 0)) - make -C lib/lufa/Bootloaders/$(QMK_BOOTLOADER_TYPE)/ MCU=$(MCU) ARCH=$(ARCH) F_CPU=$(F_CPU) FLASH_SIZE_KB=$(FLASH_SIZE_KB) BOOT_SECTION_SIZE_KB=$(BOOT_SECTION_SIZE_KB) + make -C lib/lufa/Bootloaders/$(QMK_BOOTLOADER_TYPE)/ MCU=$(MCU) ARCH=$(ARCH) F_CPU=$(F_CPU) FLASH_SIZE_KB=$(FLASH_SIZE_KB) BOOT_SECTION_SIZE_KB=$(BOOT_SECTION_SIZE_KB) TARGET=Bootloader$(QMK_BOOTLOADER_TYPE) printf "Bootloader$(QMK_BOOTLOADER_TYPE).hex copied to $(TARGET)_bootloader.hex\n" cp lib/lufa/Bootloaders/$(QMK_BOOTLOADER_TYPE)/Bootloader$(QMK_BOOTLOADER_TYPE).hex $(TARGET)_bootloader.hex endif