Current section
Files
Jump to
Current section
Files
rebar.config
%% erli18n — the runtime library app of the umbrella.
%%
%% This is the app that is published to Hex as the `erli18n` package, built and
%% published from THIS directory (`cd apps/erli18n && rebar3 hex publish
%% package`). Its runtime dependency set, compile options, doc config, and its
%% own publishing `{project_plugins, ...}` live here so the published package is
%% self-contained and does NOT inherit the umbrella's dev/test-only deps
%% (PropEr, etc.). Umbrella-wide dev settings (the quality-gate plugins, the
%% `test` profile, dialyzer/xref/hank policy, and the erlfmt scope) live in the
%% root `rebar.config`.
{erl_opts, [
debug_info,
warnings_as_errors,
warn_unused_vars,
warn_shadow_vars,
warn_obsolete_guard
]}.
%% `telemetry` is declared as a runtime-optional dep:
%% * It is fetched and compiled by `rebar3 deps` so handlers in the
%% consumer can attach.
%% * The lib itself never assumes `telemetry` is loaded — see
%% `erli18n_telemetry.erl` for the `code:ensure_loaded/1` guard
%% pattern that turns every emit into a no-op when the module is
%% missing. See the `erli18n_telemetry` module docs for the rationale.
%%
%% Naming/version policy: telemetry 1.x is the stable line maintained by
%% the BEAM Telemetry WG (https://github.com/beam-telemetry/telemetry).
%% Version constraint is intentionally loose to interoperate with the
%% consumer's existing dep tree (Phoenix, Ecto, Oban, etc. all pull 1.x).
{deps, [
{telemetry, "~> 1.3"}
]}.
%% Per-app Hex/doc publishing plugins, scoped to THIS app. The `erli18n` package
%% is published from inside this directory (`cd apps/erli18n && rebar3 hex
%% publish ...` — see `.github/workflows/release.yml`), so the `hex`/`ex_doc`
%% providers must be on THIS app's plugin path; a per-app `rebar3 hex` run with
%% no per-app plugins aborts with `Command hex not found`. Publishing each app
%% from its own directory (rather than `--app NAME` from the umbrella root) is
%% the uniform, self-contained model both packages use — and is REQUIRED for the
%% plugin so its sibling `erli18n` dep lands in the published `requirements` (see
%% the rationale in `apps/rebar3_erli18n/rebar.config`). erli18n's only dep
%% (`telemetry`) is a published Hex package, so its per-app build resolves a
%% level-0 `{pkg, telemetry, ...}` lock and publishes `requirements =
%% {telemetry, "~> 1.3"}` correctly either way; we keep the per-app path here for
%% symmetry with the plugin and to match the exemplar's self-contained app model
%% (open-telemetry/opentelemetry-erlang publishes each app from its own dir).
{project_plugins, [
{rebar3_hex, "~> 7.0"},
{rebar3_ex_doc, "~> 0.2"}
]}.
{shell, [{apps, [erli18n]}]}.
%% ExDoc config (extras + main page + source URL) for the erli18n package.
%% This block is the single source of truth for the package's doc options;
%% `scripts/gen_docs.sh` reads it (via scripts/ex_doc_config.escript) and
%% renders the HTML site straight from the native `-doc`/`-moduledoc` BEAM
%% chunks (EEP-48) using the ex_doc escript. It lives in the app (not the
%% umbrella root) so the published `erli18n` package owns its own doc config.
%%
%% The `{extras, ...}` list references ONLY this app's own files (README,
%% CHANGELOG, LICENSE) — all three now ship inside the package tarball
%% (they are matched by ?DEFAULT_FILES relative to the app dir; see
%% rebar3_hex_build.erl:118-133 and rebar3_hex_file.erl:11-13 in
%% rebar3_hex v7.1.0). The repo-root community docs (CONTRIBUTING,
%% CODE_OF_CONDUCT, SECURITY) are intentionally omitted: they are
%% umbrella-level dev docs, not part of the erli18n package.
%%
%% NOTE: `rebar3 ex_doc` is currently unusable for this project. The plugin
%% always runs EDoc to generate chunks first, and EDoc's legacy wiki parser
%% throws on a Markdown backtick in an ordinary `%%` comment — an upstream
%% bug. `scripts/gen_docs.sh` skips that vestigial EDoc step (ex_doc reads
%% the docs from the BEAM, not from EDoc's chunks). `rebar3 hex publish docs`
%% is affected by the same upstream bug.
{ex_doc, [
{extras, [
"README.md",
"CHANGELOG.md",
"LICENSE"
]},
{main, "readme"},
{source_url, "https://github.com/eagle-head/erli18n"},
{prefix_ref_vsn_with_v, false}
]}.
%% Hex packaging. Wire the doc provider to ExDoc so that
%% `rebar3 hex publish docs` renders the site via `rebar3_ex_doc`.
{hex, [{doc, #{provider => ex_doc}}]}.