Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ verify_and_build:
- python3 -m pip install -r requirements.txt
script:
- ./verify_schema.sh
- ./extension_support_report.py
- make
artifacts:
paths:
- public/extension_support.html
expose_as: "Extension Support Report"
- public/runtime_extension_support.html
- public/client_extension_support.html
expose_as: "Extension Support Reports"
15 changes: 12 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
#
# SPDX-License-Identifier: Apache-2.0

HTML_REPORT_FILES := public/extension_support.html
HTML_REPORT_FILES := public/runtime_extension_support.html public/client_extension_support.html public/extension_support.html
SHARED_DEPS := $(wildcard openxr_inventory/*.py) \
$(wildcard runtimes/*.json) \
openxr_inventory/templates/base.jinja2.html
$(wildcard clients/*.json) \
openxr_inventory/templates/base.jinja2.html \
openxr_inventory/templates/runtime_extension_support.jinja2.html \
openxr_inventory/templates/client_extension_support.jinja2.html


all: $(HTML_REPORT_FILES)
Expand All @@ -15,5 +18,11 @@ all: $(HTML_REPORT_FILES)
public:
mkdir -p $@

$(HTML_REPORT_FILES): public/%.html : %_report.py openxr_inventory/templates/%.jinja2.html public $(SHARED_DEPS)
public/runtime_extension_support.html: extension_support_report.py public $(SHARED_DEPS)
python3 $<

public/client_extension_support.html: extension_support_report.py public $(SHARED_DEPS)
python3 $<

public/extension_support.html: openxr_inventory/templates/extension_support.html public
cp $< $@
5 changes: 3 additions & 2 deletions extension_support_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
#
# SPDX-License-Identifier: Apache-2.0

from openxr_inventory.extensions import generate_report
from openxr_inventory.extensions import generate_runtime_report, generate_client_report
from openxr_inventory.runtime_inventory import load_all_runtimes
from openxr_inventory.client_inventory import load_all_clients

if __name__ == "__main__":
runtimes = load_all_runtimes()
clients = load_all_clients()
generate_report(runtimes, clients)
generate_runtime_report(runtimes, clients)
generate_client_report(runtimes, clients)
47 changes: 40 additions & 7 deletions openxr_inventory/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,18 +209,50 @@ def compute_extension_support(
return extension_support


_FILENAME_STEM = "extension_support"
def generate_runtime_report(
runtimes: List[RuntimeData],
clients: List[ClientData],
template_filename: str = "runtime_extension_support.jinja2.html",
out_filename: str = "public/runtime_extension_support.html",
):
"""
Write an HTML file containing information about runtime extension support.
"""
from .inventory_jinja import make_jinja_environment

env = make_jinja_environment()
env.globals["cat"] = ExtensionCategory
env.globals["cat_captions"] = _category_captions
env.globals["categorize_ext"] = categorize_ext_name
template = env.get_template(template_filename)
spec_url = "https://www.khronos.org/registry/OpenXR/specs/1.1/html/xrspec.html"
contents = template.render(
extensions=compute_known_extensions(runtimes, clients),
extension_support=compute_extension_support(runtimes, clients),
runtime_support=compute_runtime_support(runtimes),
client_support=compute_client_support(clients),
known_form_factors=compute_known_form_factors(runtimes, clients),
form_factor_support=compute_form_factor_support(runtimes, clients),
runtimes=runtimes,
clients=clients,
spec_url=spec_url,
)

if contents:
out_file = Path(__file__).parent.parent / out_filename
print("Writing {}".format(out_file))
with open(out_file, "w", encoding="utf-8") as fp:
fp.write(contents)


def generate_report(
def generate_client_report(
runtimes: List[RuntimeData],
clients: List[ClientData],
template_filename: str = _FILENAME_STEM + ".jinja2.html",
out_filename: str = "public/" + _FILENAME_STEM + ".html",
template_filename: str = "client_extension_support.jinja2.html",
out_filename: str = "public/client_extension_support.html",
):
"""
Write an HTML file in the parent directory containing information about the available extensions
and the runtimes that support them.
Write an HTML file containing information about client extension support.
"""
from .inventory_jinja import make_jinja_environment

Expand Down Expand Up @@ -255,4 +287,5 @@ def generate_report(

runtimes = load_all_runtimes()
clients = load_all_clients()
generate_report(runtimes, clients)
generate_runtime_report(runtimes, clients)
generate_client_report(runtimes, clients)
Loading