Load files in the dev environment only

Hello,

I’m adding an Ecto adapter to a library and I’m trying to find the best way to organize the local dev setup in the project.

When used in a host application, my library will require an Ecto repo to be passed as an argument (or configured via Mix). Working locally, however, and to run the tests, I need to start and work with a dev repo.

I already know that I can customize the elixirc_paths project option, in the Mixfile. I understand it’s a common way to load some test files only in MIX_ENV=test.
I can see that it also works for the dev environment, so that I can configure it to load all dev-only files from a special directory:

  defp elixirc_paths(:test), do: ["lib", "test/support"]
  defp elixirc_paths(:dev),  do: ["lib", "dev_support"]
  defp elixirc_paths(_),     do: ["lib"]

My question is if there is a more idiomatic or correct way to accomplish this.

This sounds like a good way to accomplish this to me.

It was considered a good solution two years ago and is still being used today in Phoenix.