Skip to content

Commit f92a7ce

Browse files
authored
Add supported languages to bundle entry schema (#155)
Closes #79. This is a per-vendordep-version option. The bundle generator will automatically detect languages from the library artifacts; if the library author wishes to override this automatic detection they can specify the desired supported languages via a root level `languages` key in their vendordep json.
1 parent be82e85 commit f92a7ce

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ This manifest is a JSON file and consists at minimum of a list of dicts (one cor
7979
* `uuid`: the same as the uuid in the vendor JSON file
8080
* `description`: a user-friendly brief description of the library (intended to be displayed to users)
8181
* `website`: URL of the vendor's website (e.g. a site with documentation / tutorials / tools installers)
82+
* `languages`: an array of strings indicating the languages supported by the library. Currently used values are "cpp" and "java".
8283

8384
Additionally, the following optional keys may be present in a manifest entry:
8485

generate_bundles.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,24 @@
33
import shutil
44
from pathlib import Path
55

6+
def check_languages(vendordep_data: dict) -> list[str]:
7+
# Check if json explicitly specifies and use that first
8+
if "languages" in vendordep_data:
9+
return vendordep_data["languages"]
10+
11+
languages = []
12+
if (
13+
"javaDependencies" in vendordep_data
14+
and len(vendordep_data["javaDependencies"]) != 0
15+
):
16+
languages.append("java")
17+
if (
18+
"cppDependencies" in vendordep_data
19+
and len(vendordep_data["cppDependencies"]) != 0
20+
):
21+
languages.append("cpp")
22+
return languages
23+
624

725
def check_metadata_schema(metadata: list[dict]):
826
required_keys = {"uuid", "name", "website", "description"}
@@ -38,6 +56,7 @@ def generate_entry(
3856
return metadata | {
3957
"path": path_prefix + file.name,
4058
"version": vendordep_data["version"],
59+
"languages": check_languages(vendordep_data),
4160
}
4261

4362

0 commit comments

Comments
 (0)