Why is there an app.src file in OTP libraries?

I noticed that when I run rebar3 new lib project_name that it includes an app.src file. I found this odd since the library won’t have any processes.

Could someone shed some light on this? Thanks!

3 Likes

Simply, library is an application without starting point. It also has name, version, registered names and similar things mentioned in the .app.src file.

4 Likes

Build systems like rebar3 will use that file to generate the .app file inside ebin/ (check Erlang -- app). Alongside what was mentioned by @mmin, you’ll also be able to include metadata for Hex.pm publishing (Rebar3 publish package | Hex), default configurations options and start phases (not sure a lib. has these, though). If your lib. requires applications like crypto to be started, for example, this can also be included there, under key applications.

4 Likes

One can think of *.app.src file as “manifests” in other programming languages.

5 Likes