aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/build_defs/jsonnet/jsonnet.BUILD
blob: 4b7dca6ea6bf38a8f50afb6bc264b10e311f1809 (plain)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package(default_visibility = ["//visibility:public"])

filegroup(
    name = "std",
    srcs = ["std.jsonnet"],
)

genrule(
    name = "gen-std-jsonnet-h",
    srcs = ["std.jsonnet"],
    outs = ["std.jsonnet.h"],
    cmd = "((od -v -Anone -t u1 $< | tr \" \" \"\n\" | grep -v \"^$$\" " +
          "| tr \"\n\" \",\" ) && echo \"0\") > $@; " +
          "echo >> $@",
)

cc_library(
    name = "jsonnet-common",
    srcs = [
        "lexer.cpp",
        "parser.cpp",
        "static_analysis.cpp",
        "vm.cpp",
        "std.jsonnet.h",
    ],
    hdrs = [
        "lexer.h",
        "parser.h",
        "static_analysis.h",
        "static_error.h",
        "vm.h",
    ],
    linkopts = ["-lm"],
    includes = ["."],
)

cc_library(
    name = "libjsonnet",
    srcs = ["libjsonnet.cpp"],
    hdrs = ["libjsonnet.h"],
    deps = [":jsonnet-common"],
    includes = ["."],
)

cc_binary(
    name = "jsonnet",
    srcs = ["jsonnet.cpp"],
    deps = [":libjsonnet"],
    includes = ["."],
)

cc_binary(
    name = "libjsonnet_test_snippet",
    srcs = ["libjsonnet_test_snippet.c"],
    deps = [":libjsonnet"],
    includes = ["."],
)

cc_binary(
    name = "libjsonnet_test_file",
    srcs = ["libjsonnet_test_file.c"],
    deps = [":libjsonnet"],
    includes = ["."],
)

filegroup(
    name = "object_jsonnet",
    srcs = ["test_suite/object.jsonnet"],
)

sh_test(
    name = "libjsonnet_test",
    srcs = ["libjsonnet_test.sh"],
    data = [
        ":jsonnet",
        ":libjsonnet_test_snippet",
        ":libjsonnet_test_file",
        ":object_jsonnet",
    ],
)