Parse transform and dependencies
watson.timothy at gmail.com
Sat Mar 10 18:36:39 EST 2012
On 10 Mar 2012, at 19:32, Tuncer Ayaz wrote:
> On Sat, Mar 10, 2012 at 7:53 PM, Tim Watson wrote:
>> I'll spend some time working with this. Personally I don't see this
>> as 'inheritance is wrong' but more a case of 'dependencies should be
>> handled differently to sub_dirs' because inheritance in sub_dirs is
>> very useful, but inheritance in deps is almost always wrong because
>> you're not the author of the code that is being built
> Right, inheriting options to dependency dirs is seldom the right
Exactly. Apart from the corner case where you're deliberately trying to override something in the dependency.
>> Having said that, I don't really use sub_dirs much so I don't have a
>> problem with it being removed. I'm guessing that the approach to
> To be precise, I have forgotten to mention that removal is only one of
> the options we're considering.
> Removal is one, inventing rebar settings to select which options or to
> which dirs they are inherited is another. Special casing deps is
> also an option.
> First we need to get feedback if and how it's used.
> Ulf's file:script proposal is an approach I'd prefer over adding knobs
> or deps-dir special casing, as it's generally useful and more powerful
> while keeping rebar generic and simple.
Yes I really like that too. It basically allows you to do very precise 'overriding' and even covers the classic edge case (mentioned above) where you want lib_a-1.0 which depends on lib_b-1.2, but you need to work with lib_b-1.1 or 1.3 or something. Overriding the discovered rebar.config dynamically is an ideal solution IMO.
>> getting consistent options set in sub_dirs once you've removed
>> inheritance would be to duplicate those options in multiple
>> rebar.config files one for each sub_dir?
> Right. Don't forget that if you want to have different erl_opts for
> say apps/app1 and apps/app2, you have to make sure there's no erl_opts
> inherited from above. In that case you're trying to avoid
Yes, indeed. The nice things about Ulf's patch is that it can solve both quite easily, depending on what rebar does by default either stopping the inheritance or adding it if required.
More information about the rebar