summaryrefslogtreecommitdiff
path: root/BUILD.ranch
blob: 6df380862bf004e248ee73f24e9b4aa8cc9dd486 (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
load("@rules_erlang//:app_file.bzl", "app_file")
load("@rules_erlang//:erlang_app_info.bzl", "erlang_app_info")
load("@rules_erlang//:erlang_app.bzl", "DEFAULT_ERLC_OPTS")
load("@rules_erlang//:erlc.bzl", "erlc")

FIRST_SRCS = [
    "src/ranch_transport.erl",
]

erlc(
    name = "first_beam_files",
    hdrs = glob(["include/**/*.hrl", "src/**/*.hrl"]),
    srcs = glob(FIRST_SRCS),
    erlc_opts = DEFAULT_ERLC_OPTS,
    dest = "ebin",
)

erlc(
    name = "beam_files",
    hdrs = glob(["include/**/*.hrl", "src/**/*.hrl"]),
    srcs = glob(["src/**/*.erl"], exclude = FIRST_SRCS),
    beam = [":first_beam_files"],
    erlc_opts = DEFAULT_ERLC_OPTS,
    dest = "ebin",
)

genrule(
    name = "appup",
    srcs = ["src/ranch.appup"],
    outs = ["ebin/ranch.appup"],
    cmd = "cp $< $@",
)

app_file(
    name = "app_file",
    app_name = "ranch",
    app_version = "2.1.0",
    modules = [":first_beam_files", ":beam_files"],
)

erlang_app_info(
    name = "erlang_app",
    app_name = "ranch",
    app = ":app_file",
    hdrs = glob(["include/**/*.hrl"]),
    beam = [":first_beam_files", ":beam_files", ":appup"],
    visibility = ["//visibility:public"],
)