redfrontedr
redfrontedr

Reputation: 331

What is the difference between .app and .app.src files in Erlang?

I found these description in the Erlang doc and learnyousomeerlang.com, but not sure which one is the "Application Resource File". When should I use .app and .app.src?

7.3 Application Resource File http://www.erlang.org/doc/design_principles/applications.html

The Application Resource File http://learnyousomeerlang.com/building-otp-applications

Upvotes: 9

Views: 2861

Answers (2)

I GIVE TERRIBLE ADVICE
I GIVE TERRIBLE ADVICE

Reputation: 9648

The .app file (in ebin/) is the file necessary by the Erlang VM to load OTP applications. It must contain fields such as the dependencies of the application, the modules it contains, the version, and so on.

Particularly, the list of modules for the application is tedious to maintain, but there's other stuff that can be dynamically added. People write .app.src files (in src/) with the static content filled in so that their build tool of choice (rebar, rebar3, erlang.mk, and so on) can fill in the dynamic parts with what they want, such as the modules found on disk.

This allows for a more streamlined dev process with a lot less stuff to juggle and maintain by hand.

Upvotes: 19

jpw
jpw

Reputation: 44871

My understanding is that the OTP application should have the application.app file in the ebin directory together with the compiled beam-files.

Keeping an application.app.src file (which would be identical to the one in the ebin directory) in the src directory is optional but can be useful to have the build process generate the application.app file.

Upvotes: 3

Related Questions