-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathBUILD.bazel
137 lines (122 loc) · 2.7 KB
/
BUILD.bazel
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
load("@rules_erlang//:compile_many.bzl", "compile_many")
load("@rules_erlang//:dialyze.bzl", "DEFAULT_PLT_APPS", "dialyze", "plt")
load("@rules_erlang//:erlang_app_sources.bzl", "erlang_app_sources")
load("@rules_erlang//:erlang_bytecode2.bzl", "erlang_bytecode")
load("@rules_erlang//:erlc_opts_file.bzl", "erlc_opts_file")
load("@rules_erlang//:eunit2.bzl", "eunit")
load("@rules_erlang//:shell.bzl", "shell")
load("@rules_erlang//:xref.bzl", "xref")
load("@rules_erlang//:extract_app.bzl", "extract_app")
APP_NAME = "basic"
erlc_opts_file(
name = "erlc_opts",
out = "erlc_opts_file",
values = [
"+debug_info",
"+recv_opt_info",
"+warn_export_vars",
"+warn_shadow_vars",
"+warn_obsolete_guard",
] + select({
"@rules_erlang//:debug_build": [],
"//conditions:default": [
"+deterministic",
],
}),
)
erlc_opts_file(
name = "test_erlc_opts",
out = "test_erlc_opts_file",
values = [
"+debug_info",
"-DTEST=1",
] + select({
"@rules_erlang//:debug_build": [],
"//conditions:default": [
"+deterministic",
],
}),
)
erlang_app_sources(
name = "%s_srcs" % APP_NAME,
app_name = APP_NAME,
erlc_opts_file = ":erlc_opts_file",
visibility = ["//visibility:public"],
)
erlang_app_sources(
name = "test_%s_srcs" % APP_NAME,
app_name = APP_NAME,
erlc_opts_file = ":test_erlc_opts_file",
visibility = ["//visibility:public"],
)
compile_many(
name = "apps",
apps = [
":%s_srcs" % APP_NAME,
],
)
compile_many(
name = "test_apps",
testonly = True,
apps = [
":test_%s_srcs" % APP_NAME,
],
)
extract_app(
name = "erlang_app",
app_name = APP_NAME,
erl_libs = ":apps",
visibility = ["//visibility:public"],
)
extract_app(
name = "test_erlang_app",
testonly = True,
app_name = APP_NAME,
beam_dest = "test",
erl_libs = ":test_apps",
)
xref(
name = "xref",
)
plt(
name = "deps_plt",
apps = DEFAULT_PLT_APPS,
for_target = ":erlang_app",
)
dialyze(
name = "dialyze",
plt = ":deps_plt",
)
erlang_bytecode(
name = "test_helpers",
testonly = True,
srcs = glob(
[
"test/**/*.erl",
],
exclude = ["test/**/*_SUITE.erl"],
),
dest = "test",
erlc_opts = ":test_erlc_opts",
)
eunit(
name = "eunit",
compiled_suites = [":test_helpers"],
target = ":test_erlang_app",
)
shell(
name = "repl",
testonly = True,
data = glob([
"src/**/*.erl",
"test/**/*.erl",
]) + [
":test_helpers",
],
extra_erl_args = [
"-pa test",
],
deps = [
":erlang_app",
],
)