-
Notifications
You must be signed in to change notification settings - Fork 168
/
generate_xml_using_config.py
40 lines (31 loc) · 1.14 KB
/
generate_xml_using_config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"""
Generate ARXML from template classes using local config file.
"""
import os
from demo_system import platform, component
import autosar.xml.workspace as ar_workspace
def apply_platform_types(workspace: ar_workspace.Workspace):
"""
Applies platform templates
"""
workspace.apply(platform.ImplementationTypes.boolean)
workspace.apply(platform.ImplementationTypes.uint8)
workspace.apply(platform.ImplementationTypes.uint16)
workspace.apply(platform.ImplementationTypes.uint32)
workspace.apply(platform.ImplementationTypes.uint64)
def apply_component_types(workspace: ar_workspace.Workspace):
"""
Applies component type templates
"""
workspace.apply(component.CompositionComponent)
def main():
"""Main"""
config_file_path = os.path.join(os.path.dirname(__file__), "config.toml")
document_root = os.path.join(os.path.dirname(__file__), "generated")
workspace = ar_workspace.Workspace(config_file_path, document_root=document_root)
apply_platform_types(workspace)
apply_component_types(workspace)
workspace.write_documents()
print("Done")
if __name__ == "__main__":
main()