|
@@ -16,7 +16,7 @@ from qmk.build_targets import BuildTarget, JsonKeymapBuildTarget
|
|
|
from qmk.util import maybe_exit_config
|
|
from qmk.util import maybe_exit_config
|
|
|
|
|
|
|
|
|
|
|
|
|
-def mass_compile_targets(targets: List[BuildTarget], clean: bool, dry_run: bool, no_temp: bool, parallel: int, **env):
|
|
|
|
|
|
|
+def mass_compile_targets(targets: List[BuildTarget], clean: bool, dry_run: bool, no_temp: bool, parallel: int, print_failures: bool, **env):
|
|
|
if len(targets) == 0:
|
|
if len(targets) == 0:
|
|
|
return
|
|
return
|
|
|
|
|
|
|
@@ -37,6 +37,30 @@ def mass_compile_targets(targets: List[BuildTarget], clean: bool, dry_run: bool,
|
|
|
|
|
|
|
|
builddir.mkdir(parents=True, exist_ok=True)
|
|
builddir.mkdir(parents=True, exist_ok=True)
|
|
|
with open(makefile, "w") as f:
|
|
with open(makefile, "w") as f:
|
|
|
|
|
+ # yapf: disable
|
|
|
|
|
+ f.write(
|
|
|
|
|
+ f"""\
|
|
|
|
|
+# This file is auto-generated by qmk mass-compile
|
|
|
|
|
+# Do not edit this file directly.
|
|
|
|
|
+all: print_failures
|
|
|
|
|
+.PHONY: all_targets print_failures
|
|
|
|
|
+print_failures: all_targets
|
|
|
|
|
+"""# noqa
|
|
|
|
|
+ )
|
|
|
|
|
+ if print_failures:
|
|
|
|
|
+ f.write(
|
|
|
|
|
+ f"""\
|
|
|
|
|
+ @for f in $$(ls .build/failed.log.{os.getpid()}.* 2>/dev/null | sort); do \\
|
|
|
|
|
+ echo; \\
|
|
|
|
|
+ echo "======================================================================================"; \\
|
|
|
|
|
+ echo "Failed build log: $$f"; \\
|
|
|
|
|
+ echo "------------------------------------------------------"; \\
|
|
|
|
|
+ cat $$f; \\
|
|
|
|
|
+ echo "------------------------------------------------------"; \\
|
|
|
|
|
+ done
|
|
|
|
|
+"""# noqa
|
|
|
|
|
+ )
|
|
|
|
|
+ # yapf: enable
|
|
|
for target in sorted(targets, key=lambda t: (t.keyboard, t.keymap)):
|
|
for target in sorted(targets, key=lambda t: (t.keyboard, t.keymap)):
|
|
|
keyboard_name = target.keyboard
|
|
keyboard_name = target.keyboard
|
|
|
keymap_name = target.keymap
|
|
keymap_name = target.keymap
|
|
@@ -58,7 +82,7 @@ def mass_compile_targets(targets: List[BuildTarget], clean: bool, dry_run: bool,
|
|
|
f.write(
|
|
f.write(
|
|
|
f"""\
|
|
f"""\
|
|
|
.PHONY: {target_filename}{target_suffix}_binary
|
|
.PHONY: {target_filename}{target_suffix}_binary
|
|
|
-all: {target_filename}{target_suffix}_binary
|
|
|
|
|
|
|
+all_targets: {target_filename}{target_suffix}_binary
|
|
|
{target_filename}{target_suffix}_binary:
|
|
{target_filename}{target_suffix}_binary:
|
|
|
@rm -f "{build_log}" || true
|
|
@rm -f "{build_log}" || true
|
|
|
@echo "Compiling QMK Firmware for target: '{keyboard_name}:{keymap_name}'..." >>"{build_log}"
|
|
@echo "Compiling QMK Firmware for target: '{keyboard_name}:{keymap_name}'..." >>"{build_log}"
|
|
@@ -98,6 +122,7 @@ all: {target_filename}{target_suffix}_binary
|
|
|
@cli.argument('-j', '--parallel', type=int, default=1, help="Set the number of parallel make jobs; 0 means unlimited.")
|
|
@cli.argument('-j', '--parallel', type=int, default=1, help="Set the number of parallel make jobs; 0 means unlimited.")
|
|
|
@cli.argument('-c', '--clean', arg_only=True, action='store_true', help="Remove object files before compiling.")
|
|
@cli.argument('-c', '--clean', arg_only=True, action='store_true', help="Remove object files before compiling.")
|
|
|
@cli.argument('-n', '--dry-run', arg_only=True, action='store_true', help="Don't actually build, just show the commands to be run.")
|
|
@cli.argument('-n', '--dry-run', arg_only=True, action='store_true', help="Don't actually build, just show the commands to be run.")
|
|
|
|
|
+@cli.argument('-p', '--print-failures', arg_only=True, action='store_true', help="Print failed builds.")
|
|
|
@cli.argument(
|
|
@cli.argument(
|
|
|
'-f',
|
|
'-f',
|
|
|
'--filter',
|
|
'--filter',
|
|
@@ -123,4 +148,4 @@ def mass_compile(cli):
|
|
|
else:
|
|
else:
|
|
|
targets = search_keymap_targets([('all', cli.config.mass_compile.keymap)], cli.args.filter)
|
|
targets = search_keymap_targets([('all', cli.config.mass_compile.keymap)], cli.args.filter)
|
|
|
|
|
|
|
|
- return mass_compile_targets(targets, cli.args.clean, cli.args.dry_run, cli.args.no_temp, cli.config.mass_compile.parallel, **build_environment(cli.args.env))
|
|
|
|
|
|
|
+ return mass_compile_targets(targets, cli.args.clean, cli.args.dry_run, cli.args.no_temp, cli.config.mass_compile.parallel, cli.args.print_failures, **build_environment(cli.args.env))
|