rebar3_appup_plugin icon indicating copy to clipboard operation
rebar3_appup_plugin copied to clipboard

Follow behaviour parents when generating appup files

Open tothlac opened this issue 5 years ago • 0 comments

My problem is the following:

As far as I know rebar3 appup generate currently generates {upgrade, Mod, ...} instructions into the .appup file only if the module has been changed and it implements an OTP behaviour.

I've implemented a behaviour, let's call it my_behaviour and the module using this behaviour my_behaviour_impl.erl.

The module my_behaviour implements gen_server, and MyBehaviourState being part of the gen_server's state is passed from my_behaviour.erl to the modules implementing this behaviour.

It would be a good feature if appup generate could automatically figure out that the behavioural parent of my_behaviour_impl.erl is my_behaviour.erl and because it implements an otp behaviour, it should automatically add {update, my_behaviour, ...} instructions to the generated .appup file. So the following instructions in upgrade/downgrade sections of the .appup file:

[
  {load_module, my_behaviour_impl, ...}
]

should be converted into:

[
  {upgrade, my_behaviour, ...}
  {load_module, my_behaviour_impl, ...}
]

Do you think that adding such a feature would be doable in rebar3_appup_generate.erl and also would it be a nice place for inserting these additional instructions into the .appup file?

tothlac avatar Jan 09 '20 16:01 tothlac