From 11fbc2bef747bed4e869908d0e7be4a2f48eadbf Mon Sep 17 00:00:00 2001 From: Ryan Blue Date: Thu, 4 Sep 2025 14:03:48 -0400 Subject: [PATCH] Add supported languages to bundle entry schema --- README.md | 1 + generate_bundles.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/README.md b/README.md index 6fe86ba..8807568 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,7 @@ This manifest is a JSON file and consists at minimum of a list of dicts (one cor * `uuid`: the same as the uuid in the vendor JSON file * `description`: a user-friendly brief description of the library (intended to be displayed to users) * `website`: URL of the vendor's website (e.g. a site with documentation / tutorials / tools installers) +* `languages`: an array of strings indicating the languages supported by the library. Currently used values are "cpp" and "java". Additionally, the following optional keys may be present in a manifest entry: diff --git a/generate_bundles.py b/generate_bundles.py index 5a4ce50..b0e752b 100644 --- a/generate_bundles.py +++ b/generate_bundles.py @@ -3,6 +3,24 @@ import shutil from pathlib import Path +def check_languages(vendordep_data: dict) -> list[str]: + # Check if json explicitly specifies and use that first + if "languages" in vendordep_data: + return vendordep_data["languages"] + + languages = [] + if ( + "javaDependencies" in vendordep_data + and len(vendordep_data["javaDependencies"]) != 0 + ): + languages.append("java") + if ( + "cppDependencies" in vendordep_data + and len(vendordep_data["cppDependencies"]) != 0 + ): + languages.append("cpp") + return languages + def check_metadata_schema(metadata: list[dict]): required_keys = {"uuid", "name", "website", "description"} @@ -38,6 +56,7 @@ def generate_entry( return metadata | { "path": path_prefix + file.name, "version": vendordep_data["version"], + "languages": check_languages(vendordep_data), }