summaryrefslogtreecommitdiff
path: root/tools/erlang_ls.bzl
blob: 073a83787aa296a281cc41158875461f713aab5a (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
load("@bazel-erlang//:erlang_home.bzl", "ErlangHomeProvider")

def _impl(ctx):
    out = ctx.actions.declare_file(ctx.label.name)

    erlang_home = ctx.attr._erlang_home[ErlangHomeProvider].path

    ctx.actions.write(
        output = out,
        content = """otp_path: {erlang_home}
apps_dirs:
  - deps/*
  - deps/rabbit/apps/*
deps_dirs:
  - bazel-bin/external/*
include_dirs:
  - deps
  - deps/*
  - deps/*/include
  - deps/*/src
  - bazel-bin/external
  - bazel-bin/external/*/include
plt_path: bazel-bin/deps/rabbit/.base_plt.plt
""".format(
            erlang_home = erlang_home,
        ),
    )

    return [
        DefaultInfo(files = depset([out])),
    ]

erlang_ls_config = rule(
    implementation = _impl,
    attrs = {
        "_erlang_home": attr.label(default = "@bazel-erlang//:erlang_home"),
    },
)