Skip to content

Commit c14a9eb

Browse files
HoloRinmergify[bot]
authored andcommitted
Account for Elixir containing several core applications
- eex - elixir - ex_unit - iex - logger - mix So that apps (like rabbitmq_cli) can dialyze against the extra components (cherry picked from commit ea895a0)
1 parent 5e45f52 commit c14a9eb

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

bazel/elixir/BUILD.bazel

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,15 @@ elixir_as_app(
1212
name = "erlang_app",
1313
visibility = ["//visibility:public"],
1414
)
15+
16+
elixir_as_app(
17+
name = "logger",
18+
app = "logger",
19+
visibility = ["//visibility:public"],
20+
)
21+
22+
elixir_as_app(
23+
name = "iex",
24+
app = "iex",
25+
visibility = ["//visibility:public"],
26+
)

bazel/elixir/elixir_as_app.bzl

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ load(
22
"@rules_erlang//:erlang_app_info.bzl",
33
"ErlangAppInfo",
44
)
5+
load(
6+
"@rules_erlang//:util.bzl",
7+
"path_join",
8+
)
59
load(
610
":elixir_toolchain.bzl",
711
"elixir_dirs",
812
)
913

1014
def _impl(ctx):
11-
ebin = ctx.actions.declare_directory("ebin")
15+
ebin = ctx.actions.declare_directory(path_join(ctx.label.name, "ebin"))
1216

1317
(elixir_home, elixir_runfiles) = elixir_dirs(ctx)
1418

@@ -17,17 +21,18 @@ def _impl(ctx):
1721
outputs = [ebin],
1822
command = """set -euo pipefail
1923
20-
cp -r "{elixir_home}"/lib/elixir/ebin/* {ebin}
24+
cp -r "{elixir_home}"/lib/{app}/ebin/* {ebin}
2125
""".format(
2226
elixir_home = elixir_home,
27+
app = ctx.attr.app,
2328
ebin = ebin.path,
2429
),
2530
)
2631

2732
return [
2833
DefaultInfo(files = depset([ebin])),
2934
ErlangAppInfo(
30-
app_name = "elixir",
35+
app_name = ctx.attr.app,
3136
include = [],
3237
beam = [ebin],
3338
priv = [],
@@ -39,6 +44,9 @@ cp -r "{elixir_home}"/lib/elixir/ebin/* {ebin}
3944

4045
elixir_as_app = rule(
4146
implementation = _impl,
47+
attrs = {
48+
"app": attr.string(default = "elixir"),
49+
},
4250
toolchains = [":toolchain_type"],
4351
provides = [ErlangAppInfo],
4452
)

deps/rabbitmq_cli/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ plt(
116116
libs = [":elixir"],
117117
deps = [
118118
":elixir",
119+
"//bazel/elixir:logger",
119120
"//deps/rabbit:erlang_app",
120121
"//deps/rabbit_common:erlang_app",
121122
],

0 commit comments

Comments
 (0)