Adding a New Dependency

Now that we have a new Application to act as the web interface, we need to bring the game engine in as a dependency. The interface needs to have access to all the game logic we wrote in the first two parts of the book. In particular, it must be able to see all the public functions in the IslandsEngine.Game module.

This works just like any other dependency in Elixir, and it is about as easy as it can possibly be. Only two steps are involved.

We’ll need to compile IslandsEngine in with the rest of the project as well as start it when we start the IslandsInterface Application.

To make :islands_engine a compile-time dependency, we’ll add it to the deps/0 function in islands_interface/mix.exs:

 defp​ deps ​do
  [
  {​

Get Functional Web Development with Elixir, OTP, and Phoenix now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.