ErlyORM / boss_db

BossDB: a sharded, caching, pooling, evented ORM for Erlang
Other
277 stars 138 forks source link

Rebar3 support - basis for discussion #257

Closed drobakowski closed 7 years ago

drobakowski commented 8 years ago

We are using this branch for quite some time so far without problems. As I have seen the ongoing work in #256 I wanted to start this PR as a basis for discussion, maybe it can help to make a smoother transition to rebar3.

In order to successfully compile an application based on boss_db and rebar3, existing models which are located under the src folder need to be moved to another non Erlang source folder - see the discussion on the rebar3 support page. This circumstance could be quite a problem for some projects like ChicagoBoss. Furthermore a new model compilation plugin is needed to let rebar3 compile the excluded model files from the src folder - see rebar3_boss_db. You can find a running demo application including dialyzer warnings here - see Dialyzer warning. A failing one, because of the model src folder problematic, can be found here.

What's included:

Open TODOS (help wanted):

danikp commented 7 years ago

Great work! And even greater detailed explanation of an issue. I will add some of thought too regarding all options we have. 1) Moving files out of src is unwanted, but on other hand models are shared between apps in multi-app CB setups and having them outside specific app making sense. 2) renaming extension is a good option, it also may allow to extend models' files even more with non-Erlang features. I could propose extensions like bmf (boss model file) or bmd (boss model definition), both not used much. 3) both options together, at least as configuration options

I merged most of your changes at beta1 branch and going to deploy it to my projects too.

danikp commented 7 years ago

Looking deeper at this and taking in consideration use of parameterized modules all over CB, looks like a better and cleaner option is to compile whole project thru our own compiler. Easiest way seems to be to change of {src_dirs, ["src"]} to something else and make it ignore normal src dir.