Bulk model generator: switch from json to yml configuration files

This commit is contained in:
Paolo Tranquilli
2025-06-04 12:16:08 +02:00
parent 76c6d7104d
commit 31d1604337
5 changed files with 64 additions and 88 deletions

View File

@@ -1,9 +0,0 @@
{
"strategy": "dca",
"language": "cpp",
"targets": [
{ "name": "openssl", "with-sources": false, "with-sinks": false },
{ "name": "sqlite", "with-sources": false, "with-sinks": false }
],
"destination": "cpp/ql/lib/ext/generated"
}

View File

@@ -0,0 +1,10 @@
language: cpp
strategy: dca
destination: cpp/ql/lib/ext/generated
targets:
- name: openssl
with-sinks: false
with-sources: false
- name: sqlite
with-sinks: false
with-sources: false

View File

@@ -15,7 +15,12 @@ import json
import requests
import zipfile
import tarfile
from functools import cmp_to_key
try:
import yaml
except ImportError:
print("ERROR: PyYAML is not installed. Please install it with 'pip install pyyaml'.")
sys.exit(1)
import generate_mad as mad
@@ -492,9 +497,9 @@ if __name__ == "__main__":
sys.exit(1)
try:
with open(args.config, "r") as f:
config = json.load(f)
except json.JSONDecodeError as e:
print(f"ERROR: Failed to parse JSON file {args.config}: {e}")
config = yaml.safe_load(f)
except yaml.YAMLError as e:
print(f"ERROR: Failed to parse YAML file {args.config}: {e}")
sys.exit(1)
main(config, args)

View File

@@ -1,75 +0,0 @@
{
"strategy": "repo",
"language": "rust",
"targets": [
{
"name": "libc",
"git_repo": "https://github.com/rust-lang/libc",
"git_tag": "0.2.172"
},
{
"name": "log",
"git_repo": "https://github.com/rust-lang/log",
"git_tag": "0.4.27"
},
{
"name": "memchr",
"git_repo": "https://github.com/BurntSushi/memchr",
"git_tag": "2.7.4"
},
{
"name": "once_cell",
"git_repo": "https://github.com/matklad/once_cell",
"git_tag": "v1.21.3"
},
{
"name": "rand",
"git_repo": "https://github.com/rust-random/rand",
"git_tag": "0.9.1"
},
{
"name": "smallvec",
"git_repo": "https://github.com/servo/rust-smallvec",
"git_tag": "v1.15.0"
},
{
"name": "serde",
"git_repo": "https://github.com/serde-rs/serde",
"git_tag": "v1.0.219"
},
{
"name": "tokio",
"git_repo": "https://github.com/tokio-rs/tokio",
"git_tag": "tokio-1.45.0"
},
{
"name": "reqwest",
"git_repo": "https://github.com/seanmonstar/reqwest",
"git_tag": "v0.12.15"
},
{
"name": "rocket",
"git_repo": "https://github.com/SergioBenitez/Rocket",
"git_tag": "v0.5.1"
},
{
"name": "actix-web",
"git_repo": "https://github.com/actix/actix-web",
"git_tag": "web-v4.11.0"
},
{
"name": "hyper",
"git_repo": "https://github.com/hyperium/hyper",
"git_tag": "v1.6.0"
},
{
"name": "clap",
"git_repo": "https://github.com/clap-rs/clap",
"git_tag": "v4.5.38"
}
],
"destination": "rust/ql/lib/ext/generated",
"extractor_options": [
"cargo_features='*'"
]
}

View File

@@ -0,0 +1,45 @@
strategy: repo
language: rust
destination: rust/ql/lib/ext/generated
extractor_options:
- cargo_features='*'
targets:
- git_repo: https://github.com/rust-lang/libc
git_tag: 0.2.172
name: libc
- git_repo: https://github.com/rust-lang/log
git_tag: 0.4.27
name: log
- git_repo: https://github.com/BurntSushi/memchr
git_tag: 2.7.4
name: memchr
- git_repo: https://github.com/matklad/once_cell
git_tag: v1.21.3
name: once_cell
- git_repo: https://github.com/rust-random/rand
git_tag: 0.9.1
name: rand
- git_repo: https://github.com/servo/rust-smallvec
git_tag: v1.15.0
name: smallvec
- git_repo: https://github.com/serde-rs/serde
git_tag: v1.0.219
name: serde
- git_repo: https://github.com/tokio-rs/tokio
git_tag: tokio-1.45.0
name: tokio
- git_repo: https://github.com/seanmonstar/reqwest
git_tag: v0.12.15
name: reqwest
- git_repo: https://github.com/SergioBenitez/Rocket
git_tag: v0.5.1
name: rocket
- git_repo: https://github.com/actix/actix-web
git_tag: web-v4.11.0
name: actix-web
- git_repo: https://github.com/hyperium/hyper
git_tag: v1.6.0
name: hyper
- git_repo: https://github.com/clap-rs/clap
git_tag: v4.5.38
name: clap