Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions elixir_app.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def elixir_app(
app_name = app_name,
extra_apps = ["elixir"] + extra_apps,
modules = [":beam_files"],
deps = deps,
**kwargs
)

Expand Down
16 changes: 16 additions & 0 deletions test/app_deps/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
load("@rules_elixir//:elixir_app.bzl", "elixir_app")
load("@rules_shell//shell:sh_test.bzl", "sh_test")

elixir_app(
app_name = "main_app",
deps = ["//app_deps/dep:erlang_app"],
)

# The .app file must list dep_app in applications, so OTP starts it first.
sh_test(
name = "app_file_lists_deps_test",
size = "small",
srcs = ["app_file_lists_deps_test.sh"],
args = ["$(rootpath :app_file)"],
data = [":app_file"],
)
13 changes: 13 additions & 0 deletions test/app_deps/app_file_lists_deps_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -euo pipefail

app_file="$1"
cat "$app_file"
applications=$(tr -d '\n' < "$app_file" | grep -o '{applications, *\[[^]]*\]}')
echo "$applications"
for app in kernel stdlib elixir dep_app; do
if ! grep -Eq "[[ ,]$app[],]" <<< "$applications"; then
echo "FAIL: $app is not in the applications list" >&2
exit 1
fi
done
7 changes: 7 additions & 0 deletions test/app_deps/dep/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
load("@rules_elixir//:elixir_app.bzl", "elixir_app")

package(default_visibility = ["//app_deps:__pkg__"])

elixir_app(
app_name = "dep_app",
)
3 changes: 3 additions & 0 deletions test/app_deps/dep/lib/dep_app.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
defmodule DepApp do
def hello, do: :world
end
3 changes: 3 additions & 0 deletions test/app_deps/lib/main_app.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
defmodule MainApp do
def hello, do: DepApp.hello()
end