mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Improve caching related tests to make them faster and test the situation closer to what actually happens during explicit module build. Most noticable changes are: * Avoid swift stdlib dependency during the tests to save time * Use dependency scanner output to construct test cases * Update old test cases that try to simulate caching from file system inputs to using only CAS inputs.
37 lines
1.0 KiB
Python
Executable File
37 lines
1.0 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
#
|
|
# Usage: GenerateExplicitModuleMap.py file.json
|
|
|
|
import json
|
|
import sys
|
|
|
|
input_json = sys.argv[1]
|
|
|
|
modules = []
|
|
|
|
with open(input_json, 'r') as file:
|
|
deps = json.load(file)
|
|
main_module_name = deps['mainModuleName']
|
|
module_names = deps['modules'][::2]
|
|
module_details = deps['modules'][1::2]
|
|
# add all modules other than the main module into the module map.
|
|
for name, detail in zip(module_names, module_details):
|
|
kind, name = list(name.items())[0]
|
|
if name == main_module_name:
|
|
continue
|
|
|
|
module = {}
|
|
module["moduleName"] = name
|
|
module["isFramework"] = False
|
|
if kind == "clang":
|
|
module["clangModulePath"] = name + ".pcm"
|
|
module["clangModuleCacheKey"] = detail['details'][kind]["moduleCacheKey"]
|
|
else:
|
|
module["modulePath"] = name + ".swiftmdoule"
|
|
module["moduleCacheKey"] = detail['details'][kind]["moduleCacheKey"]
|
|
|
|
modules.append(module)
|
|
|
|
|
|
json.dump(modules, sys.stdout, indent=2)
|