Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QMK Userspace #22222

Merged
merged 118 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
fb216c2
Userspace support.
tzarc Aug 28, 2023
b441da6
Auto-detect userspace directory.
tzarc Aug 31, 2023
5477193
`qmk new-keymap` now locates the new keymap inside userspace if set.
tzarc Sep 2, 2023
da39824
Don't accidentally resolve qmk_firmware as userspace if it's the curr…
tzarc Sep 2, 2023
926ad82
Userspace workflow.
tzarc Sep 3, 2023
a750b85
Workflow update.
tzarc Sep 3, 2023
c4b133c
Workflow paths.
tzarc Sep 3, 2023
d1562c5
Swapped GHA for release
tzarc Sep 3, 2023
3716172
Review comments
tzarc Sep 3, 2023
7521a11
Use `qmk/.github` for workflow definition.
tzarc Sep 4, 2023
dc86e60
Add userspace for json builds
tzarc Sep 7, 2023
0fde99b
Merge remote-tracking branch 'upstream/master' into qmk-userspace
tzarc Sep 10, 2023
95d6779
Consistency in naming.
tzarc Sep 10, 2023
b8bb66e
Merge remote-tracking branch 'upstream/master' into qmk-userspace
tzarc Sep 13, 2023
a649e8a
`qmk.json` and associated validation schema.
tzarc Sep 14, 2023
bf3bf24
Merge remote-tracking branch 'upstream/master' into qmk-userspace
tzarc Sep 16, 2023
4c4efa9
Userspace CLI stubs.
tzarc Sep 16, 2023
4f923b5
Formatting.
tzarc Sep 16, 2023
7502772
Hook up `qmk userspace-doctor` with `qmk doctor`
tzarc Sep 16, 2023
e12d3e2
`qmk pytest`
tzarc Sep 16, 2023
946ae03
Sequencing.
tzarc Sep 16, 2023
b9df68d
Direct compilation.
tzarc Sep 22, 2023
077f544
Merge remote-tracking branch 'upstream/master' into qmk-userspace
tzarc Sep 22, 2023
7bd2706
Validation errors.
tzarc Sep 22, 2023
90d211b
Userspace `qmk.json` save API.
tzarc Sep 22, 2023
6a5ffb1
Collect validation errors when loading userspace.
tzarc Sep 22, 2023
01e3808
`qmk userspace-(add|remove|list)`
tzarc Sep 22, 2023
9e9c09f
Try to determine userspace from qmk config, if set.
tzarc Sep 22, 2023
0e807a5
Validate keymap targets.
tzarc Sep 22, 2023
83a5b60
Validate targets for `qmk userspace-list`
tzarc Sep 23, 2023
42a5761
`qmk userspace-compile` for consistency.
tzarc Sep 23, 2023
f4f263b
Merge remote-tracking branch 'upstream/master' into qmk-userspace
tzarc Sep 23, 2023
0df2317
Allow for `qmk mass-compile all:<keymap>`
tzarc Sep 23, 2023
8474a3e
Merge remote-tracking branch 'upstream/master' into qmk-userspace
tzarc Sep 28, 2023
317cfed
Allow for disabling of parallel processing of `qmk find` and `qmk mas…
tzarc Sep 29, 2023
260dee6
`qmk userspace-compile`
tzarc Sep 29, 2023
6c0740b
Allow for disabling of parallel processing of `qmk find` and `qmk mas…
tzarc Sep 29, 2023
2808171
Parameterise `search_keymap_targets()` so that it can be fed an array…
tzarc Sep 29, 2023
06316a1
Simplification of parallelisation.
tzarc Sep 29, 2023
6803275
Typos and cleanup.
tzarc Sep 29, 2023
0110a4f
Move `parallelize` to util.py.
tzarc Sep 29, 2023
bf40eeb
`qmk format-python`
tzarc Sep 29, 2023
4a4cb6c
`cli.args` should not be used for "saveable" settings.
tzarc Sep 29, 2023
e038310
Merge branch 'cli/parallel-cleanup' into qmk-userspace
tzarc Sep 29, 2023
07b4cec
Use config values.
tzarc Sep 29, 2023
7a7b647
Fixup `qmk userspace-list`
tzarc Sep 29, 2023
5f97a8e
Cleanup.
tzarc Sep 29, 2023
c5aaa25
`qmk config`
tzarc Sep 29, 2023
74d37f8
Further simplification.
tzarc Sep 29, 2023
d300b55
Actually allow for `False`
tzarc Sep 29, 2023
79b892f
Merge branch 'cli/parallel-cleanup' into qmk-userspace
tzarc Sep 29, 2023
7c3f69a
missing `qmk.json` should not validate as OK
tzarc Sep 29, 2023
fdab617
Sigh.
tzarc Sep 29, 2023
996d717
Merge remote-tracking branch 'upstream/master' into qmk-userspace
tzarc Oct 3, 2023
6566ff9
Additionally search aliases for keymaps when we have userspace.
tzarc Oct 5, 2023
b39fcb3
Merge remote-tracking branch 'upstream/master' into qmk-userspace
tzarc Oct 5, 2023
dbce007
Fixup `qmk new-keymap`
tzarc Oct 5, 2023
5c1f3d5
Merge remote-tracking branch 'upstream/master' into qmk-userspace
tzarc Oct 6, 2023
b8fd11e
Update lib/python/qmk/util.py
tzarc Oct 7, 2023
6b1fcb6
Merge branch 'cli/parallel-cleanup' into cli/build-target-refactor
tzarc Oct 7, 2023
0888ee3
Start refactoring build targets.
tzarc Oct 7, 2023
88bdabb
More refactoring.
tzarc Oct 8, 2023
4fa09b5
Fix tests.
tzarc Oct 8, 2023
8501251
Fix tests.
tzarc Oct 8, 2023
4b3a454
Refactoring.
tzarc Oct 9, 2023
b4fab9f
Refactoring.
tzarc Oct 9, 2023
5b62587
Refactoring.
tzarc Oct 9, 2023
24cfc17
Refactoring.
tzarc Oct 9, 2023
5c68b61
Commentary.
tzarc Oct 9, 2023
bc8ff2d
Refactoring.
tzarc Oct 9, 2023
09fdab9
Refactoring.
tzarc Oct 9, 2023
9a1758f
Refactoring.
tzarc Oct 9, 2023
a4fb79a
Commentary.
tzarc Oct 12, 2023
2a5e474
Merge remote-tracking branch 'upstream/master' into cli/parallel-cleanup
tzarc Oct 15, 2023
e87bbfa
Merge branch 'cli/parallel-cleanup' into cli/build-target-refactor
tzarc Oct 15, 2023
82c767b
Merge branch 'cli/build-target-refactor' into qmk-userspace
tzarc Oct 15, 2023
931b10b
`qmk pytest`
tzarc Oct 15, 2023
4554eab
Fixup use of multiprocessing.
tzarc Oct 16, 2023
88b4c33
Ensure consistent experience with `parallelize()`, regardless of back…
tzarc Oct 16, 2023
14d5fba
Merge branch 'cli/parallel-cleanup' into cli/build-target-refactor
tzarc Oct 16, 2023
16d3839
Merge branch 'cli/build-target-refactor' into qmk-userspace
tzarc Oct 16, 2023
347a40c
Merge remote-tracking branch 'upstream/master' into cli/build-target-…
tzarc Oct 16, 2023
0f82d80
Merge remote-tracking branch 'upstream/master' into qmk-userspace
tzarc Oct 22, 2023
37fcb4e
Fixups.
tzarc Oct 22, 2023
2dee948
Merge remote-tracking branch 'upstream/master' into qmk-userspace
tzarc Oct 30, 2023
57e507b
Fixup compiledb
tzarc Oct 30, 2023
29a45ce
Merge remote-tracking branch 'upstream/master' into cli/build-target-…
tzarc Oct 30, 2023
8d2fdd1
Fixup compiledb
tzarc Oct 30, 2023
60ac8f2
Merge branch 'cli/build-target-refactor' into qmk-userspace
tzarc Oct 30, 2023
c50dcfa
Add support for json keymaps in `qmk mass-compile`
tzarc Oct 31, 2023
55b1b09
Merge branch 'cli/build-target-refactor' into qmk-userspace
tzarc Oct 31, 2023
55820da
Initial support for json builds in userspace.
tzarc Oct 31, 2023
329d0ff
API cleanup
tzarc Nov 1, 2023
2207501
Merge branch 'cli/build-target-refactor' into qmk-userspace
tzarc Nov 1, 2023
d0d4d51
API resync
tzarc Nov 1, 2023
34df028
Deal with dotty_dict.
tzarc Nov 1, 2023
c59afc0
Merge branch 'cli/build-target-refactor' into qmk-userspace
tzarc Nov 1, 2023
3104b43
Userspace add/remove.
tzarc Nov 1, 2023
2ab8e76
Command help, actually add the json files.
tzarc Nov 1, 2023
5c48e58
Fixup list.
tzarc Nov 1, 2023
45f89dd
Resolve aliases.
tzarc Nov 1, 2023
3c4caae
Merge branch 'cli/build-target-refactor' into qmk-userspace
tzarc Nov 1, 2023
7a4542a
License headers.
tzarc Nov 1, 2023
47a2ef8
Merge remote-tracking branch 'upstream/master' into cli/build-target-…
tzarc Nov 1, 2023
a1c1f75
Merge branch 'cli/build-target-refactor' into qmk-userspace
tzarc Nov 1, 2023
a1c7143
Merge remote-tracking branch 'upstream/develop' into cli/build-target…
tzarc Nov 1, 2023
38955cd
Merge branch 'cli/build-target-refactor' into qmk-userspace
tzarc Nov 1, 2023
c09472b
Merge remote-tracking branch 'upstream/develop' into qmk-userspace
tzarc Nov 11, 2023
d79c5e6
Merge remote-tracking branch 'upstream/develop' into qmk-userspace
tzarc Nov 15, 2023
01bb7c2
Prevent insertion of same json file multiple times.
tzarc Nov 17, 2023
1c1f617
Merge remote-tracking branch 'upstream/develop' into qmk-userspace
tzarc Nov 22, 2023
bdee41f
Speed improvements.
tzarc Nov 22, 2023
3cc6de8
Automatically invoke `qmk new-keymap` if running `qmk userspace-add` …
tzarc Nov 22, 2023
f4cd690
Fixup VPATH when userspace is present. Auto-add build target with `qm…
tzarc Nov 22, 2023
1a542e7
Merge remote-tracking branch 'upstream/develop' into qmk-userspace
tzarc Nov 26, 2023
71a2a04
Initial docs.
tzarc Nov 26, 2023
53f90ce
Docs updates.
tzarc Nov 27, 2023
4d745e1
Docs updates.
tzarc Nov 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ $(info QMK Firmware $(QMK_VERSION))
endif
endif

# Try to determine userspace from qmk config, if set.
ifeq ($(QMK_USERSPACE),)
QMK_USERSPACE = $(shell qmk config -ro user.overlay_dir | cut -d= -f2 | sed -e 's@^None$$@@g')
endif

# Determine which qmk cli to use
QMK_BIN := qmk

Expand Down Expand Up @@ -191,9 +196,20 @@ define PARSE_KEYBOARD
KEYMAPS += $$(notdir $$(patsubst %/.,%,$$(wildcard $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_4)/keymaps/*/.)))
KEYMAPS += $$(notdir $$(patsubst %/.,%,$$(wildcard $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_5)/keymaps/*/.)))

ifneq ($(QMK_USERSPACE),)
KEYMAPS += $$(notdir $$(patsubst %/.,%,$$(wildcard $(QMK_USERSPACE)/keyboards/$$(KEYBOARD_FOLDER_PATH_1)/keymaps/*/.)))
KEYMAPS += $$(notdir $$(patsubst %/.,%,$$(wildcard $(QMK_USERSPACE)/keyboards/$$(KEYBOARD_FOLDER_PATH_2)/keymaps/*/.)))
KEYMAPS += $$(notdir $$(patsubst %/.,%,$$(wildcard $(QMK_USERSPACE)/keyboards/$$(KEYBOARD_FOLDER_PATH_3)/keymaps/*/.)))
KEYMAPS += $$(notdir $$(patsubst %/.,%,$$(wildcard $(QMK_USERSPACE)/keyboards/$$(KEYBOARD_FOLDER_PATH_4)/keymaps/*/.)))
KEYMAPS += $$(notdir $$(patsubst %/.,%,$$(wildcard $(QMK_USERSPACE)/keyboards/$$(KEYBOARD_FOLDER_PATH_5)/keymaps/*/.)))
endif

KEYBOARD_LAYOUTS := $(shell $(QMK_BIN) list-layouts --keyboard $1)
LAYOUT_KEYMAPS :=
$$(foreach LAYOUT,$$(KEYBOARD_LAYOUTS),$$(eval LAYOUT_KEYMAPS += $$(notdir $$(patsubst %/.,%,$$(wildcard $(ROOT_DIR)/layouts/*/$$(LAYOUT)/*/.)))))
ifneq ($(QMK_USERSPACE),)
$$(foreach LAYOUT,$$(KEYBOARD_LAYOUTS),$$(eval LAYOUT_KEYMAPS += $$(notdir $$(patsubst %/.,%,$$(wildcard $(QMK_USERSPACE)/layouts/$$(LAYOUT)/*/.)))))
endif

KEYMAPS := $$(sort $$(KEYMAPS) $$(LAYOUT_KEYMAPS))

Expand Down Expand Up @@ -431,8 +447,18 @@ clean:
rm -rf $(BUILD_DIR)
echo 'done.'

.PHONY: distclean
distclean: clean
.PHONY: distclean distclean_qmk
distclean: distclean_qmk
distclean_qmk: clean
echo -n 'Deleting *.bin, *.hex, and *.uf2 ... '
rm -f *.bin *.hex *.uf2
echo 'done.'

ifneq ($(QMK_USERSPACE),)
.PHONY: distclean_userspace
distclean: distclean_userspace
distclean_userspace: clean
echo -n 'Deleting userspace *.bin, *.hex, and *.uf2 ... '
rm -f $(QMK_USERSPACE)/*.bin $(QMK_USERSPACE)/*.hex $(QMK_USERSPACE)/*.uf2
echo 'done.'
endif
19 changes: 19 additions & 0 deletions builddefs/build_json.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,22 @@ else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_1)/keymap.json)","")
KEYMAP_JSON := $(MAIN_KEYMAP_PATH_1)/keymap.json
KEYMAP_JSON_PATH := $(MAIN_KEYMAP_PATH_1)
endif

ifneq ($(QMK_USERSPACE),)
ifneq ("$(wildcard $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_5)/keymap.json)","")
KEYMAP_JSON := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_5)/keymap.json
KEYMAP_PATH := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_5)
else ifneq ("$(wildcard $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_4)/keymap.json)","")
KEYMAP_JSON := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_4)/keymap.json
KEYMAP_PATH := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_4)
else ifneq ("$(wildcard $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_3)/keymap.json)","")
KEYMAP_JSON := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_3)/keymap.json
KEYMAP_PATH := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_3)
else ifneq ("$(wildcard $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_2)/keymap.json)","")
KEYMAP_JSON := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_2)/keymap.json
KEYMAP_PATH := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_2)
else ifneq ("$(wildcard $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_1)/keymap.json)","")
KEYMAP_JSON := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_1)/keymap.json
KEYMAP_PATH := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_1)
endif
endif
96 changes: 68 additions & 28 deletions builddefs/build_keyboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -127,34 +127,60 @@ include $(INFO_RULES_MK)
include $(BUILDDEFS_PATH)/build_json.mk

# Pull in keymap level rules.mk
# Look through the possible keymap folders until we find a matching keymap.c
ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_1)/keymap.c)","")
-include $(MAIN_KEYMAP_PATH_1)/rules.mk
KEYMAP_C := $(MAIN_KEYMAP_PATH_1)/keymap.c
KEYMAP_PATH := $(MAIN_KEYMAP_PATH_1)
else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_2)/keymap.c)","")
-include $(MAIN_KEYMAP_PATH_2)/rules.mk
KEYMAP_C := $(MAIN_KEYMAP_PATH_2)/keymap.c
KEYMAP_PATH := $(MAIN_KEYMAP_PATH_2)
else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_3)/keymap.c)","")
-include $(MAIN_KEYMAP_PATH_3)/rules.mk
KEYMAP_C := $(MAIN_KEYMAP_PATH_3)/keymap.c
KEYMAP_PATH := $(MAIN_KEYMAP_PATH_3)
else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_4)/keymap.c)","")
-include $(MAIN_KEYMAP_PATH_4)/rules.mk
KEYMAP_C := $(MAIN_KEYMAP_PATH_4)/keymap.c
KEYMAP_PATH := $(MAIN_KEYMAP_PATH_4)
else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_5)/keymap.c)","")
-include $(MAIN_KEYMAP_PATH_5)/rules.mk
KEYMAP_C := $(MAIN_KEYMAP_PATH_5)/keymap.c
KEYMAP_PATH := $(MAIN_KEYMAP_PATH_5)
else ifneq ($(LAYOUTS),)
# If we haven't found a keymap yet fall back to community layouts
include $(BUILDDEFS_PATH)/build_layout.mk
# Not finding keymap.c is fine if we found a keymap.json
else ifeq ("$(wildcard $(KEYMAP_JSON_PATH))", "")
$(call CATASTROPHIC_ERROR,Invalid keymap,Could not find keymap)
# this state should never be reached
ifeq ("$(wildcard $(KEYMAP_PATH))", "")
# Look through the possible keymap folders until we find a matching keymap.c
ifneq ($(QMK_USERSPACE),)
ifneq ("$(wildcard $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_1)/keymap.c)","")
-include $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_1)/rules.mk
KEYMAP_C := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_1)/keymap.c
KEYMAP_PATH := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_1)
else ifneq ("$(wildcard $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_2)/keymap.c)","")
-include $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_2)/rules.mk
KEYMAP_C := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_2)/keymap.c
KEYMAP_PATH := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_2)
else ifneq ("$(wildcard $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_3)/keymap.c)","")
-include $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_3)/rules.mk
KEYMAP_C := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_3)/keymap.c
KEYMAP_PATH := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_3)
else ifneq ("$(wildcard $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_4)/keymap.c)","")
-include $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_4)/rules.mk
KEYMAP_C := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_4)/keymap.c
KEYMAP_PATH := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_4)
else ifneq ("$(wildcard $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_5)/keymap.c)","")
-include $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_5)/rules.mk
KEYMAP_C := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_5)/keymap.c
KEYMAP_PATH := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_5)
endif
endif
ifeq ($(KEYMAP_PATH),)
ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_1)/keymap.c)","")
-include $(MAIN_KEYMAP_PATH_1)/rules.mk
KEYMAP_C := $(MAIN_KEYMAP_PATH_1)/keymap.c
KEYMAP_PATH := $(MAIN_KEYMAP_PATH_1)
else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_2)/keymap.c)","")
-include $(MAIN_KEYMAP_PATH_2)/rules.mk
KEYMAP_C := $(MAIN_KEYMAP_PATH_2)/keymap.c
KEYMAP_PATH := $(MAIN_KEYMAP_PATH_2)
else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_3)/keymap.c)","")
-include $(MAIN_KEYMAP_PATH_3)/rules.mk
KEYMAP_C := $(MAIN_KEYMAP_PATH_3)/keymap.c
KEYMAP_PATH := $(MAIN_KEYMAP_PATH_3)
else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_4)/keymap.c)","")
-include $(MAIN_KEYMAP_PATH_4)/rules.mk
KEYMAP_C := $(MAIN_KEYMAP_PATH_4)/keymap.c
KEYMAP_PATH := $(MAIN_KEYMAP_PATH_4)
else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_5)/keymap.c)","")
-include $(MAIN_KEYMAP_PATH_5)/rules.mk
KEYMAP_C := $(MAIN_KEYMAP_PATH_5)/keymap.c
KEYMAP_PATH := $(MAIN_KEYMAP_PATH_5)
else ifneq ($(LAYOUTS),)
# If we haven't found a keymap yet fall back to community layouts
include $(BUILDDEFS_PATH)/build_layout.mk
else ifeq ("$(wildcard $(KEYMAP_JSON_PATH))", "") # Not finding keymap.c is fine if we found a keymap.json
$(call CATASTROPHIC_ERROR,Invalid keymap,Could not find keymap)
# this state should never be reached
endif
endif
endif

# Have we found a keymap.json?
Expand Down Expand Up @@ -364,6 +390,16 @@ ifeq ("$(USER_NAME)","")
endif
USER_PATH := users/$(USER_NAME)

# If we have userspace, then add it to the lookup VPATH
ifneq ($(wildcard $(QMK_USERSPACE)),)
VPATH += $(QMK_USERSPACE)
endif

# If the equivalent users directory exists in userspace, use that in preference to anything currently in the main repo
ifneq ($(wildcard $(QMK_USERSPACE)/$(USER_PATH)),)
USER_PATH := $(QMK_USERSPACE)/$(USER_PATH)
endif

# Pull in user level rules.mk
-include $(USER_PATH)/rules.mk
ifneq ("$(wildcard $(USER_PATH)/config.h)","")
Expand Down Expand Up @@ -404,6 +440,10 @@ ifneq ("$(KEYMAP_H)","")
CONFIG_H += $(KEYMAP_H)
endif

ifeq ($(KEYMAP_C),)
$(call CATASTROPHIC_ERROR,Invalid keymap,Could not find keymap)
endif

OPT_DEFS += -DKEYMAP_C=\"$(KEYMAP_C)\"

# If a keymap or userspace places their keymap array in another file instead, allow for it to be included
Expand Down
4 changes: 4 additions & 0 deletions builddefs/build_layout.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
LAYOUTS_PATH := layouts
LAYOUTS_REPOS := $(patsubst %/,%,$(sort $(dir $(wildcard $(LAYOUTS_PATH)/*/))))

ifneq ($(QMK_USERSPACE),)
LAYOUTS_REPOS += $(patsubst %/,%,$(QMK_USERSPACE)/$(LAYOUTS_PATH))
endif

define SEARCH_LAYOUTS_REPO
LAYOUT_KEYMAP_PATH := $$(LAYOUTS_REPO)/$$(LAYOUT)/$$(KEYMAP)
LAYOUT_KEYMAP_JSON := $$(LAYOUT_KEYMAP_PATH)/keymap.json
Expand Down
11 changes: 10 additions & 1 deletion builddefs/common_rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ DFU_SUFFIX_ARGS ?=
elf: $(BUILD_DIR)/$(TARGET).elf
hex: $(BUILD_DIR)/$(TARGET).hex
uf2: $(BUILD_DIR)/$(TARGET).uf2
cpfirmware: $(FIRMWARE_FORMAT)
cpfirmware_qmk: $(FIRMWARE_FORMAT)
$(SILENT) || printf "Copying $(TARGET).$(FIRMWARE_FORMAT) to qmk_firmware folder" | $(AWK_CMD)
$(COPY) $(BUILD_DIR)/$(TARGET).$(FIRMWARE_FORMAT) $(TARGET).$(FIRMWARE_FORMAT) && $(PRINT_OK)
eep: $(BUILD_DIR)/$(TARGET).eep
Expand All @@ -200,6 +200,15 @@ sym: $(BUILD_DIR)/$(TARGET).sym
LIBNAME=lib$(TARGET).a
lib: $(LIBNAME)

cpfirmware: cpfirmware_qmk

ifneq ($(QMK_USERSPACE),)
cpfirmware: cpfirmware_userspace
cpfirmware_userspace: cpfirmware_qmk
$(SILENT) || printf "Copying $(TARGET).$(FIRMWARE_FORMAT) to userspace folder" | $(AWK_CMD)
$(COPY) $(BUILD_DIR)/$(TARGET).$(FIRMWARE_FORMAT) $(QMK_USERSPACE)/$(TARGET).$(FIRMWARE_FORMAT) && $(PRINT_OK)
endif

# Display size of file, modifying the output so people don't mistakenly grab the hex output
BINARY_SIZE = $(SIZE) --target=$(FORMAT) $(BUILD_DIR)/$(TARGET).hex | $(SED) -e 's/\.build\/.*$$/$(TARGET).$(FIRMWARE_FORMAT)/g'

Expand Down
18 changes: 18 additions & 0 deletions data/schemas/definitions.jsonschema
Original file line number Diff line number Diff line change
Expand Up @@ -177,5 +177,23 @@
"type": "integer",
"minimum": 0,
"maximum": 1
},
"keyboard_keymap_tuple": {
"type": "array",
"prefixItems": [
{ "$ref": "#/keyboard" },
{ "$ref": "#/filename" }
],
"unevaluatedItems": false
},
"json_file_path": {
"type": "string",
"pattern": "^[0-9a-z_/\\-]+\\.json$"
},
"build_target": {
"oneOf": [
{ "$ref": "#/keyboard_keymap_tuple" },
{ "$ref": "#/json_file_path" }
]
}
}
14 changes: 14 additions & 0 deletions data/schemas/user_repo_v0.jsonschema
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema#",
"$id": "qmk.user_repo.v0",
"title": "User Repository Information",
"type": "object",
"required": [
"userspace_version"
],
"properties": {
"userspace_version": {
"type": "string",
},
}
}
22 changes: 22 additions & 0 deletions data/schemas/user_repo_v1.jsonschema
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema#",
"$id": "qmk.user_repo.v1",
"title": "User Repository Information",
"type": "object",
"required": [
"userspace_version",
"build_targets"
],
"properties": {
"userspace_version": {
"type": "string",
"enum": ["1.0"]
},
"build_targets": {
"type": "array",
"items": {
"$ref": "qmk.definitions.v1#/build_target"
}
}
}
}
2 changes: 1 addition & 1 deletion docs/_summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* [Building Your First Firmware](newbs_building_firmware.md)
* [Flashing Firmware](newbs_flashing.md)
* [Getting Help/Support](support.md)
* [Building With GitHub Userspace](newbs_building_firmware_workflow.md)
* [External Userspace](newbs_external_userspace.md)
* [Other Resources](newbs_learn_more_resources.md)
* [Syllabus](syllabus.md)

Expand Down
Loading