Skip to content

Commit

Permalink
version 4.0.0-beta.1
Browse files Browse the repository at this point in the history
  • Loading branch information
pjk25 committed Apr 25, 2024
1 parent c76e212 commit 6e267a6
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 16 deletions.
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module(
name = "rules_erlang",
version = "4.0.0",
version = "4.0.0-beta.1",
compatibility_level = 4,
)

Expand Down
117 changes: 102 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "bazel_skylib",
sha256 = "af87959afe497dc8dfd4c6cb66e1279cb98ccc84284619ebfec27d9c09a903de",
sha256 = "66ffd9315665bfaafc96b52278f57c7e2dd09f5ede279ea6d39b2be471e7e3aa",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.2.0/bazel-skylib-1.2.0.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.2.0/bazel-skylib-1.2.0.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.4.2/bazel-skylib-1.4.2.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.4.2/bazel-skylib-1.4.2.tar.gz",
],
)

Expand All @@ -24,8 +24,8 @@ bazel_skylib_workspace()

http_archive(
name = "rules_erlang",
strip_prefix = "rules_erlang-3.15.2",
urls = ["https://github.com/rabbitmq/rules_erlang/archive/refs/tags/3.15.2.zip"],
strip_prefix = "rules_erlang-4.0.0-beta.1",
urls = ["https://github.com/rabbitmq/rules_erlang/archive/refs/tags/4.0.0-beta.1.zip"],
)

load(
Expand All @@ -47,27 +47,114 @@ register_defaults()
### `BUILD` file

```starlark
load("@rules_erlang//:erlang_app.bzl", "erlang_app", "test_erlang_app")
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//:erlc_opts_file.bzl", "erlc_opts_file")
load("@rules_erlang//:eunit2.bzl", "eunit")
load("@rules_erlang//:xref.bzl", "xref")
load("@rules_erlang//:dialyze.bzl", "dialyze", "plt")
load("@rules_erlang//:ct.bzl", "ct_suite", "assert_suites2")
load("@rules_erlang//private:extract_app.bzl", "extract_app")

APP_NAME = "my_cool_app"
APP_VERSION = "0.1.0"

erlang_app(
erlc_opts_file(
name = "erlc_opts_file",
values = select({
"@rules_erlang//:debug_build": [
"+debug_info",
"+recv_opt_info",
"+warn_export_vars",
"+warn_shadow_vars",
"+warn_obsolete_guard",
],
"//conditions:default": [
"+debug_info",
"+recv_opt_info",
"+warn_export_vars",
"+warn_shadow_vars",
"+warn_obsolete_guard",
"+deterministic",
],
}),
out = "erlc_opts_file",
)

erlc_opts_file(
name = "test_erlc_opts_file",
values = select({
"@rules_erlang//:debug_build": [
"+debug_info",
"-DTEST=1",
],
"//conditions:default": [
"+debug_info",
"-DTEST=1",
"+deterministic",
],
}),
out = "test_erlc_opts_file",
)

erlang_app_sources(
name = "%s_srcs" % APP_NAME,
app_name = APP_NAME,
app_src = ":app_src",
erlc_opts_file = ":erlc_opts_file",
visibility = ["//visibility:public"],
)

erlang_app_sources(
name = "test_%s_srcs" % APP_NAME,
app_name = APP_NAME,
app_src = ":app_src",
erlc_opts_file = ":test_erlc_opts_file",
visibility = ["//visibility:public"],
)

compile_many(
name = "apps",
apps = [
":%s_srcs" % APP_NAME,
],
)

compile_many(
name = "test_apps",
apps = [
":test_%s_srcs" % APP_NAME,
],
testonly = True,
)

extract_app(
name = "erlang_app",
erl_libs = ":apps",
app_name = APP_NAME,
app_version = APP_VERSION,
visibility = ["//visibility:public"],
)

test_erlang_app(
extract_app(
name = "test_erlang_app",
erl_libs = ":test_apps",
app_name = APP_NAME,
app_version = APP_VERSION,
beam_dest = "test",
testonly = True,
)

xref()
xref(name = "xref")

plt(
name = "deps_plt",
apps = DEFAULT_PLT_APPS,
for_target = ":erlang_app",
)

dialyze(
name = "dialyze",
plt = ":deps_plt",
)

dialyze()
eunit(name = "xref")

ct_suite(
name = "unit_SUITE",
Expand Down

0 comments on commit 6e267a6

Please sign in to comment.