forked from bmw-software-engineering/trlc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
trlc.bzl
40 lines (33 loc) · 1.16 KB
/
trlc.bzl
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
def _trlc_specification_impl(ctx):
return DefaultInfo(files = depset(ctx.files.srcs))
_trlc_specification = rule(
implementation = _trlc_specification_impl,
attrs = {
"srcs": attr.label_list(allow_files = [".rsl"]),
},
)
def trlc_specification(**kwargs):
_trlc_specification(**kwargs)
def _trlc_requirement_impl(ctx):
depending_files = []
for spec in ctx.attr.spec:
depending_files.append(spec[DefaultInfo].files)
return DefaultInfo(files = depset(ctx.files.srcs, transitive = depending_files))
_trlc_requirement = rule(
implementation = _trlc_requirement_impl,
attrs = {
"srcs": attr.label_list(allow_files = [".trlc"]),
"spec": attr.label_list(allow_empty = False, providers = [DefaultInfo]),
},
)
def trlc_requirements(**kwargs):
_trlc_requirement(**kwargs)
def trlc_requirements_test(name, reqs, srcs = ["@trlc//:trlc.py"], main = "trlc.py", **kwargs):
native.py_test(
name = name,
srcs = srcs,
args = ["--use-cvc5-binary $(location @trlc//:cvc5)", "--verify"],
main = main,
deps = ["@trlc//trlc:trlc"],
data = ["@trlc//:cvc5"] + reqs,
)