Allow custom data sync for community modules (#25955)

* Allow custom data sync for community modules

* Stub out community_config.h codegen

* Fix SPLIT_TRANSACTION_RPC logic
This commit is contained in:
Joel Challis
2026-02-19 11:03:26 +00:00
committed by GitHub
parent a0166fef43
commit 5591a68b65
10 changed files with 154 additions and 13 deletions
@@ -194,6 +194,38 @@ def generate_community_modules_rules_mk(cli):
cli.log.info('Wrote rules.mk to %s.', cli.args.output)
@cli.argument('-o', '--output', arg_only=True, type=qmk.path.normpath, help='File to write to')
@cli.argument('-q', '--quiet', arg_only=True, action='store_true', help="Quiet mode, only output error messages")
@cli.argument('-kb', '--keyboard', arg_only=True, type=keyboard_folder, completer=keyboard_completer, help='Keyboard to generate community_config.h for.')
@cli.argument('filename', nargs='?', type=qmk.path.FileType('r'), arg_only=True, completer=FilesCompleter('.json'), help='Configurator JSON file')
@cli.subcommand('Creates a community_config.h from a keymap.json file.')
def generate_community_config_h(cli):
"""Creates a community_config.h from a keymap.json file
"""
if cli.args.output and cli.args.output.name == '-':
cli.args.output = None
lines = [
GPL2_HEADER_C_LIKE,
GENERATED_HEADER_C_LIKE,
'#pragma once',
'',
]
modules = get_modules(cli.args.keyboard, cli.args.filename)
if len(modules) > 0:
lines.append('// Split transactions')
for module in modules:
lines.extend([
f'#ifdef SPLIT_TRANSACTION_IDS_MODULE_{Path(module).name.upper()}',
'# define SPLIT_TRANSACTION_RPC',
'#endif',
])
lines.append('')
dump_lines(cli.args.output, lines, cli.args.quiet, remove_repeated_newlines=True)
@cli.argument('-o', '--output', arg_only=True, type=qmk.path.normpath, help='File to write to')
@cli.argument('-q', '--quiet', arg_only=True, action='store_true', help="Quiet mode, only output error messages")
@cli.argument('-kb', '--keyboard', arg_only=True, type=keyboard_folder, completer=keyboard_completer, help='Keyboard to generate community_modules.h for.')
@@ -339,3 +371,26 @@ def generate_rgb_matrix_community_modules_inc(cli):
"""Creates an rgb_matrix_community_modules.inc from a keymap.json file
"""
_generate_include_per_module(cli, 'rgb_matrix_module.inc')
@cli.argument('-o', '--output', arg_only=True, type=qmk.path.normpath, help='File to write to')
@cli.argument('-q', '--quiet', arg_only=True, action='store_true', help="Quiet mode, only output error messages")
@cli.argument('-kb', '--keyboard', arg_only=True, type=keyboard_folder, completer=keyboard_completer, help='Keyboard to generate split_transaction_id_community_modules.inc for.')
@cli.argument('filename', nargs='?', type=qmk.path.FileType('r'), arg_only=True, completer=FilesCompleter('.json'), help='Configurator JSON file')
@cli.subcommand('Creates an split_transaction_id_community_modules.inc from a keymap.json file.')
def generate_split_transaction_id_community_modules_inc(cli):
"""Creates an split_transaction_id_community_modules.inc from a keymap.json file
"""
if cli.args.output and cli.args.output.name == '-':
cli.args.output = None
lines = [GPL2_HEADER_C_LIKE, GENERATED_HEADER_C_LIKE]
for module in get_modules(cli.args.keyboard, cli.args.filename):
lines.extend([
f'#ifdef SPLIT_TRANSACTION_IDS_MODULE_{Path(module).name.upper()}',
f' SPLIT_TRANSACTION_IDS_MODULE_{Path(module).name.upper()},',
'#endif',
])
dump_lines(cli.args.output, lines, cli.args.quiet, remove_repeated_newlines=True)