Add a bazel rule for generating erlang_ls.config
If you are using bazel, you can switch to this with: 1. `bazelisk build //tools:erlang_ls.config` 2. `cp bazel-bin/tools/erlang_ls.config erlang_ls.config`
This commit is contained in:
parent
83126f1285
commit
67ad541515
|
|
@ -0,0 +1,5 @@
|
|||
load(":erlang_ls.bzl", "erlang_ls_config")
|
||||
|
||||
erlang_ls_config(
|
||||
name = "erlang_ls.config",
|
||||
)
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
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_dirs:
|
||||
- bazel-bin/external/*
|
||||
include_dirs:
|
||||
- deps
|
||||
- deps/*/include
|
||||
- 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"),
|
||||
},
|
||||
)
|
||||
Loading…
Reference in New Issue