about summary refs log tree commit diff
path: root/third_party/bazel/rules_haskell/tests/library-with-sysincludes/BUILD.bazel
blob: ddd5de65198c743fce0c5e4a58f2054ba8bac124 (plain) (blame)
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
81
82
83
84
85
86
load(
    "@io_tweag_rules_haskell//haskell:haskell.bzl",
    "haskell_library",
)

package(default_testonly = 1)

genrule(
    name = "genrule-header",
    outs = [
        "include/foo.h",
    ],
    cmd = "touch $(location include/foo.h)",
)

# A locally-defined replica of @zlib.dev//:zlib.
# Since that shared library lives in another package, we must
# use an absolute path for strip_include_prefix.
cc_library(
    name = "zlib",
    hdrs = ["@zlib.dev//:include"],
    strip_include_prefix = "/external/zlib.dev/include",
    tags = ["requires_zlib"],
    deps = ["@zlib"],
)

cc_library(
    name = "zlib-with-genrule-header",
    hdrs = [":genrule-header"],
    strip_include_prefix = "include",
    tags = ["requires_zlib"],
)

haskell_library(
    name = "intermediate-library",
    srcs = ["IntLib.hsc"],
    tags = ["requires_zlib"],
    deps = [
        ":zlib",
        ":zlib-with-genrule-header",
        "//tests/hackage:base",
    ],
)

haskell_library(
    name = "library-with-sysincludes",
    srcs = [
        "Lib.hs",
        "TH.hs",
    ],
    tags = ["requires_zlib"],
    visibility = ["//visibility:public"],
    deps = [
        ":intermediate-library",
        "//tests/hackage:base",
        "//tests/hackage:template-haskell",
    ],
)

# Replicate the above example, but use the externally-defined
# cc_library rule.
haskell_library(
    name = "intermediate-library-other",
    srcs = ["IntLib.hsc"],
    tags = ["requires_zlib"],
    deps = [
        ":zlib-with-genrule-header",
        "//tests/hackage:base",
        "@zlib.dev//:zlib",
    ],
)

haskell_library(
    name = "library-with-sysincludes-other",
    srcs = [
        "Lib.hs",
        "TH.hs",
    ],
    tags = ["requires_zlib"],
    visibility = ["//visibility:public"],
    deps = [
        ":intermediate-library-other",
        "//tests/hackage:base",
        "//tests/hackage:template-haskell",
    ],
)