diff options
| author | QMK Bot <hello@qmk.fm> | 2021-06-09 07:25:59 +0000 |
|---|---|---|
| committer | QMK Bot <hello@qmk.fm> | 2021-06-09 07:25:59 +0000 |
| commit | 9177e22d2c531868564a444c447873603ab26337 (patch) | |
| tree | efc0a639d74ad0583841a622f6013fa901bd0089 /lib | |
| parent | b829a1d2648abd0751e9d3505554547faf643425 (diff) | |
| parent | 21aa7890cbff6368cf75c84a083f022141e0e4ca (diff) | |
| download | qmk_firmware-9177e22d2c531868564a444c447873603ab26337.tar.gz qmk_firmware-9177e22d2c531868564a444c447873603ab26337.zip | |
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'lib')
| -rwxr-xr-x | lib/python/qmk/cli/multibuild.py | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/lib/python/qmk/cli/multibuild.py b/lib/python/qmk/cli/multibuild.py index 2848a3b82..bdb0b493c 100755 --- a/lib/python/qmk/cli/multibuild.py +++ b/lib/python/qmk/cli/multibuild.py | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | This will compile everything in parallel, for testing purposes. | 3 | This will compile everything in parallel, for testing purposes. |
| 4 | """ | 4 | """ |
| 5 | import os | ||
| 5 | import re | 6 | import re |
| 6 | from pathlib import Path | 7 | from pathlib import Path |
| 7 | from subprocess import DEVNULL | 8 | from subprocess import DEVNULL |
| @@ -11,6 +12,7 @@ from milc import cli | |||
| 11 | from qmk.constants import QMK_FIRMWARE | 12 | from qmk.constants import QMK_FIRMWARE |
| 12 | from qmk.commands import _find_make | 13 | from qmk.commands import _find_make |
| 13 | import qmk.keyboard | 14 | import qmk.keyboard |
| 15 | import qmk.keymap | ||
| 14 | 16 | ||
| 15 | 17 | ||
| 16 | def _make_rules_mk_filter(key, value): | 18 | def _make_rules_mk_filter(key, value): |
| @@ -29,6 +31,7 @@ def _is_split(keyboard_name): | |||
| 29 | @cli.argument('-j', '--parallel', type=int, default=1, help="Set the number of parallel make jobs to run.") | 31 | @cli.argument('-j', '--parallel', type=int, default=1, help="Set the number of parallel make jobs to run.") |
| 30 | @cli.argument('-c', '--clean', arg_only=True, action='store_true', help="Remove object files before compiling.") | 32 | @cli.argument('-c', '--clean', arg_only=True, action='store_true', help="Remove object files before compiling.") |
| 31 | @cli.argument('-f', '--filter', arg_only=True, action='append', default=[], help="Filter the list of keyboards based on the supplied value in rules.mk. Supported format is 'SPLIT_KEYBOARD=yes'. May be passed multiple times.") | 33 | @cli.argument('-f', '--filter', arg_only=True, action='append', default=[], help="Filter the list of keyboards based on the supplied value in rules.mk. Supported format is 'SPLIT_KEYBOARD=yes'. May be passed multiple times.") |
| 34 | @cli.argument('-km', '--keymap', type=str, default='default', help="The keymap name to build. Default is 'default'.") | ||
| 32 | @cli.subcommand('Compile QMK Firmware for all keyboards.', hidden=False if cli.config.user.developer else True) | 35 | @cli.subcommand('Compile QMK Firmware for all keyboards.', hidden=False if cli.config.user.developer else True) |
| 33 | def multibuild(cli): | 36 | def multibuild(cli): |
| 34 | """Compile QMK Firmware against all keyboards. | 37 | """Compile QMK Firmware against all keyboards. |
| @@ -57,23 +60,29 @@ def multibuild(cli): | |||
| 57 | builddir.mkdir(parents=True, exist_ok=True) | 60 | builddir.mkdir(parents=True, exist_ok=True) |
| 58 | with open(makefile, "w") as f: | 61 | with open(makefile, "w") as f: |
| 59 | for keyboard_name in keyboard_list: | 62 | for keyboard_name in keyboard_list: |
| 60 | keyboard_safe = keyboard_name.replace('/', '_') | 63 | if qmk.keymap.locate_keymap(keyboard_name, cli.args.keymap) is not None: |
| 61 | # yapf: disable | 64 | keyboard_safe = keyboard_name.replace('/', '_') |
| 62 | f.write( | 65 | # yapf: disable |
| 63 | f"""\ | 66 | f.write( |
| 67 | f"""\ | ||
| 64 | all: {keyboard_safe}_binary | 68 | all: {keyboard_safe}_binary |
| 65 | {keyboard_safe}_binary: | 69 | {keyboard_safe}_binary: |
| 66 | @rm -f "{QMK_FIRMWARE}/.build/failed.log.{keyboard_safe}" || true | 70 | @rm -f "{QMK_FIRMWARE}/.build/failed.log.{keyboard_safe}" || true |
| 67 | +@$(MAKE) -C "{QMK_FIRMWARE}" -f "{QMK_FIRMWARE}/build_keyboard.mk" KEYBOARD="{keyboard_name}" KEYMAP="default" REQUIRE_PLATFORM_KEY= COLOR=true SILENT=false \\ | 71 | +@$(MAKE) -C "{QMK_FIRMWARE}" -f "{QMK_FIRMWARE}/build_keyboard.mk" KEYBOARD="{keyboard_name}" KEYMAP="{cli.args.keymap}" REQUIRE_PLATFORM_KEY= COLOR=true SILENT=false \\ |
| 68 | >>"{QMK_FIRMWARE}/.build/build.log.{keyboard_safe}" 2>&1 \\ | 72 | >>"{QMK_FIRMWARE}/.build/build.log.{os.getpid()}.{keyboard_safe}" 2>&1 \\ |
| 69 | || cp "{QMK_FIRMWARE}/.build/build.log.{keyboard_safe}" "{QMK_FIRMWARE}/.build/failed.log.{keyboard_safe}" | 73 | || cp "{QMK_FIRMWARE}/.build/build.log.{os.getpid()}.{keyboard_safe}" "{QMK_FIRMWARE}/.build/failed.log.{os.getpid()}.{keyboard_safe}" |
| 70 | @{{ grep '\[ERRORS\]' "{QMK_FIRMWARE}/.build/build.log.{keyboard_safe}" >/dev/null 2>&1 && printf "Build %-64s \e[1;31m[ERRORS]\e[0m\\n" "{keyboard_name}:default" ; }} \\ | 74 | @{{ grep '\[ERRORS\]' "{QMK_FIRMWARE}/.build/build.log.{os.getpid()}.{keyboard_safe}" >/dev/null 2>&1 && printf "Build %-64s \e[1;31m[ERRORS]\e[0m\\n" "{keyboard_name}:{cli.args.keymap}" ; }} \\ |
| 71 | || {{ grep '\[WARNINGS\]' "{QMK_FIRMWARE}/.build/build.log.{keyboard_safe}" >/dev/null 2>&1 && printf "Build %-64s \e[1;33m[WARNINGS]\e[0m\\n" "{keyboard_name}:default" ; }} \\ | 75 | || {{ grep '\[WARNINGS\]' "{QMK_FIRMWARE}/.build/build.log.{os.getpid()}.{keyboard_safe}" >/dev/null 2>&1 && printf "Build %-64s \e[1;33m[WARNINGS]\e[0m\\n" "{keyboard_name}:{cli.args.keymap}" ; }} \\ |
| 72 | || printf "Build %-64s \e[1;32m[OK]\e[0m\\n" "{keyboard_name}:default" | 76 | || printf "Build %-64s \e[1;32m[OK]\e[0m\\n" "{keyboard_name}:{cli.args.keymap}" |
| 73 | @rm -f "{QMK_FIRMWARE}/.build/build.log.{keyboard_safe}" || true | 77 | @rm -f "{QMK_FIRMWARE}/.build/build.log.{os.getpid()}.{keyboard_safe}" || true |
| 74 | 78 | ||
| 75 | """# noqa | 79 | """# noqa |
| 76 | ) | 80 | ) |
| 77 | # yapf: enable | 81 | # yapf: enable |
| 78 | 82 | ||
| 79 | cli.run([make_cmd, '-j', str(cli.args.parallel), '-f', makefile.as_posix(), 'all'], capture_output=False, stdin=DEVNULL) | 83 | cli.run([make_cmd, '-j', str(cli.args.parallel), '-f', makefile.as_posix(), 'all'], capture_output=False, stdin=DEVNULL) |
| 84 | |||
| 85 | # Check for failures | ||
| 86 | failures = [f for f in builddir.glob(f'failed.log.{os.getpid()}.*')] | ||
| 87 | if len(failures) > 0: | ||
| 88 | return False | ||
