rebar3_otter__config (rebar3_otter v0.3.0)

Validation and normalization of the otter_crates rebar3 config key.

otter_crates is read per application: declare it in each app's own rebar.config, and path is interpreted relative to that app's directory. The compiled artifact is installed into the declaring app's priv/native/, so umbrella projects place each NIF where code:priv_dir/1 for that app will find it.

Both the compile and clean providers go through validate/1 (passing the app's raw otter_crates value) so they agree on the schema. Errors are tagged tuples that format_error/1 renders into human-readable strings.

Schema:

{otter_crates, [
    #{
        name     := string() | binary(),  % required
        path     := string() | binary(),  % required, app-relative
        mode     => release | debug,      % default release
        features => [string() | binary()],% default []
        target   => string() | binary()   % default undefined
    }
]}.

String-typed values accept a string or binary, normalized to a string. Unknown map keys are rejected.

Summary

Types

crate()

-type crate() ::
          #{name := string(),
            path := string(),
            mode := release | debug,
            features := [string()],
            target := string() | undefined}.

Functions

format_error/1

-spec format_error(term()) -> string() | iolist().

validate(Raw)

-spec validate(term()) -> {ok, [crate()]} | {error, term()}.