0
votes

I have three apps in umbrella project setup

  1. Datalayer
  2. ApiLayer
  3. OtherLayer Some Other layer(but mandatory)

Now I have dependencies defined like this in mix file App ApiLayer has

{:OtherLayer, in_umbrella: true},
{:Datalayer, in_umbrella: true}

App Datalayer has no dependency of the umbrella apps App OtherLayer has

{:Datalayer, in_umbrella: true}

But test cases which are being called from app ApiLayer needs to call context defined in Datalayer and context of Datalayer in turn needs to access some functionalities to OtherLayer but can't. because if I add its dependency in Datalayer. This will be cyclic dependency case. I need to pass my test cases. is there some way to load some chunk of the code without creating cyclic dependency? Any help will be appreciated. Thanks

1
I have tried some solutions like dynamically requiring that module but didn't work and tried ensure_all_started option in test_helper but got {:error, {:m, {:invalid_restart_type, :data_layer}}}Radio Active
If they really are so integrated, they should probably not be separate applications. One solution would probably be to handle that kind of communication by passing the module to the function. For example if you have a method in your ApiLayer that calls DataLayer, but DataLayer also needs values from OtherLayer, you could design the function in DataLayer to accept the module as an argument and pass it in ApiLayer. def my_func(x), do: DataLayer.Module.func(x, OtherLayer.DependencyModule)Julia Will

1 Answers

0
votes

If OtherLayer is always included with an application that already has Datalayer as a dependancy, then you can remove the Datalayer dependancy from OtherLayer, as the application will be included in your release anyway. If you need to build OtherLayer as a stand-alone application then create an OtherLayerWrapper application that has Datalayer and OtherLayer as dependancies.