Something went wrong. Try again.
keyboard stuff
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647# Copyright 2023-2024 Nick Brassel (@tzarc)# SPDX-License-Identifier: GPL-2.0-or-laterfrom pathlib import Pathfrom milc import cli
from qmk.constants import QMK_USERSPACE, HAS_QMK_USERSPACEfrom qmk.commands import build_environmentfrom qmk.userspace import UserspaceDefsfrom qmk.build_targets import JsonKeymapBuildTargetfrom qmk.search import search_keymap_targetsfrom qmk.cli.mass_compile import mass_compile_targetsfrom qmk.util import maybe_exit_config
def _extra_arg_setter(target, extra_args): target.extra_args = extra_args
@cli.argument('-t', '--no-temp', arg_only=True, action='store_true', help="Remove temporary files during build.")@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('-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('-e', '--env', arg_only=True, action='append', default=[], help="Set a variable to be passed to make. May be passed multiple times.")@cli.subcommand('Compiles the build targets specified in userspace `qmk.json`.')def userspace_compile(cli): if not HAS_QMK_USERSPACE: cli.log.error('Could not determine QMK userspace location. Please run `qmk doctor` or `qmk userspace-doctor` to diagnose.') return False
maybe_exit_config(should_exit=False, should_reraise=True)
userspace = UserspaceDefs(QMK_USERSPACE / 'qmk.json')
build_targets = [] keyboard_keymap_targets = [] for e in userspace.build_targets: if isinstance(e, Path): build_targets.append(JsonKeymapBuildTarget(e)) elif isinstance(e, dict): f = e['env'] if 'env' in e else None keyboard_keymap_targets.append((e['keyboard'], e['keymap'], f)) if len(keyboard_keymap_targets) > 0: build_targets.extend(search_keymap_targets(keyboard_keymap_targets))
return mass_compile_targets(list(set(build_targets)), cli.args.clean, cli.args.dry_run, cli.config.userspace_compile.no_temp, cli.config.userspace_compile.parallel, cli.args.print_failures, **build_environment(cli.args.env))