-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdodo.py
51 lines (42 loc) · 1.71 KB
/
dodo.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
41
42
43
44
45
46
47
48
49
50
51
"""
doit task/build automation
"""
import os
from doit.tools import create_folder
from lattice import Lattice
data_model = Lattice(build_validation=False)
def task_generate_meta_schemas():
"""Generate JSON meta schemas"""
return {
"file_dep": [schema.file_path for schema in data_model.schemas],
"targets": [schema.meta_schema_path for schema in data_model.schemas],
"actions": [(data_model.generate_meta_schemas, [])],
"clean": True,
}
def task_validate_schemas():
"""Validate the example schemas against the JSON meta schema"""
return {
"task_dep": [f"generate_meta_schemas"],
"file_dep": [schema.file_path for schema in data_model.schemas]
+ [schema.meta_schema_path for schema in data_model.schemas],
"actions": [(data_model.validate_schemas, [])],
}
def task_validate_example_files():
"""Validates the example files against the JSON schema (and other validation steps)"""
return {
"task_dep": [f"validate_schemas"],
"file_dep": data_model.examples
+ [schema.file_path for schema in data_model.schemas],
"actions": [(data_model.validate_example_files, [])],
}
def task_generate_cpp_code():
"""Generate CPP headers and source for example schema."""
return {
"task_dep": [f"validate_schemas"],
"file_dep": [schema.file_path for schema in data_model.cpp_schemas]
+ [schema.meta_schema_path for schema in data_model.schemas],
"targets": [schema.cpp_header_file_path for schema in data_model.cpp_schemas]
+ [schema.cpp_source_file_path for schema in data_model.cpp_schemas],
"actions": [(data_model.generate_cpp_project, [])],
"clean": True,
}