Add a qt module json file schema validator utility

Change-Id: I4f85cee9957c0c8cf001417a61b61a57d7041dba
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Cristian Le 2025-04-09 18:05:25 +02:00
parent 1fc00a2a14
commit df1126dd0d
2 changed files with 50 additions and 0 deletions

View File

@ -451,4 +451,6 @@ if(QT_INSTALL_CI_FILES)
DESTINATION "${__qt_libexec_install_dir}") DESTINATION "${__qt_libexec_install_dir}")
qt_copy_or_install(PROGRAMS "util/testrunner/sanitizer-testrunner.py" qt_copy_or_install(PROGRAMS "util/testrunner/sanitizer-testrunner.py"
DESTINATION "${__qt_libexec_install_dir}") DESTINATION "${__qt_libexec_install_dir}")
qt_copy_or_install(PROGRAMS "util/json_schema/check_qt_module_json_schemas.py"
DESTINATION "${__qt_libexec_install_dir}")
endif() endif()

View File

@ -0,0 +1,48 @@
#!/usr/bin/env python3
# Copyright (C) 2025 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
# /// script
# dependencies = ["check-jsonschema", "click"]
# ///
from __future__ import annotations
from pathlib import Path
import click
@click.command(
context_settings=dict(
ignore_unknown_options=True,
)
)
@click.option(
"--install-prefix",
type=click.Path(
exists=True,
file_okay=False,
dir_okay=True,
path_type=Path,
),
required=True,
metavar="PATH",
help="Path to the Qt install prefix.",
)
@click.argument(
"check_jsonschema_args",
nargs=-1,
type=click.UNPROCESSED,
)
def run(install_prefix: Path, check_jsonschema_args: list[str]):
"""
Validate the module json files after installation.
Unknown options are passed directly to check-jsonschema.
"""
# TODO: Do the actual validation
if __name__ == "__main__":
run()