aboutsummaryrefslogtreecommitdiff
path: root/scripts/generate_source.py
diff options
context:
space:
mode:
authorJuan Ramos <juan@lunarg.com>2023-10-06 16:13:24 -0600
committerJuan Ramos <114601453+juan-lunarg@users.noreply.github.com>2023-10-06 16:51:44 -0600
commit96bad23002d40ad7e7eba3743ff22af1cd24d8f4 (patch)
tree3838674883b800e4ab4651477770d2f67470fbe4 /scripts/generate_source.py
parenta4a8db5a8a9c55f1cd668ecb1bad8b4f66a68d46 (diff)
downloadusermoji-96bad23002d40ad7e7eba3743ff22af1cd24d8f4.tar.xz
mock: Ensure VkICD_mock_icd.json uses up to date API version
closes #617
Diffstat (limited to 'scripts/generate_source.py')
-rwxr-xr-xscripts/generate_source.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/scripts/generate_source.py b/scripts/generate_source.py
index abd8a754..6c63f0c9 100755
--- a/scripts/generate_source.py
+++ b/scripts/generate_source.py
@@ -22,6 +22,7 @@
import argparse
import filecmp
import os
+import json
import shutil
import subprocess
import sys
@@ -38,6 +39,7 @@ def main(argv):
default='vulkan',
choices=['vulkan', 'vulkansc'],
help='Specify API name to generate')
+ parser.add_argument('--generated-version', help='sets the header version used to generate the repo')
parser.add_argument('registry', metavar='REGISTRY_PATH', help='path to the Vulkan-Headers registry directory')
group = parser.add_mutually_exclusive_group()
group.add_argument('-i', '--incremental', action='store_true', help='only update repo files that change')
@@ -53,6 +55,19 @@ def main(argv):
#base directory for the source repository
repo_dir = common_codegen.repo_relative('')
+ # Update the api_version in the respective json files
+ if args.generated_version:
+ json_files = []
+ json_files.append(common_codegen.repo_relative('icd/VkICD_mock_icd.json.in'))
+ for json_file in json_files:
+ with open(json_file) as f:
+ data = json.load(f)
+
+ data["ICD"]["api_version"] = args.generated_version
+
+ with open(json_file, mode='w', encoding='utf-8', newline='\n') as f:
+ f.write(json.dumps(data, indent=4))
+
# get directory where generators will run if needed
if args.verify or args.incremental:
# generate in temp directory so we can compare or copy later