Need:
I've bumped into this several times where I'd like to have a separate section of library/code available in a dep, which is only in-scope for :test builds, not :prod.
But deps are always compiled in :prod scope, so it doesn't matter what else you do.
The general consensus from what I've found and observed in other libs is to just put test modules into the production code tree. This is ... not great.
The typical other response is "don't make your factories use ex_machina, build them yourself" which is a myopic response, and dismisses the actual problem, covering it up with a band-aid.
As I've hunted this out I tried playing around with elixirc_paths from the parent project (the outer project including the dep), but it doesn't want relative directories, and doesn't like things within the deps folder? (In an umbrella I have to do ../../deps/..., which then errors out — I saw this ticket: https://github.com/elixir-lang/elixir/issues/10016).
I wonder, however, why deps aren't recompiled for test using
:test elixirc_paths? I presume there's a really good reason for
not doing it — probably everything would break because few deps
include the test folders in the package.
Thus, separately, is there a way for me to spec a dep's folder in-scope for the parent application?
Specific scenario:
dep-application:
lib/std-prod-code.ex
test/lib/factory-code.ex
umbrella-application
apps/child-application/mix.exs
In `elixirc_paths(:test)` of the umbrella-application, is there a syntax/pathing/something that will allow me to bring dep-application/test/lib into scope for test compiles?
Because its an umbrella application "deps/dep-application/test/lib" doesn't bring anything in scope. If I do a relative path "../../deps/dep-application/test/lib" then I get the error:
** (Mix) Could not find source for "/home/git/umbrella-app/src/deps/rivet_ident/test/lib/ident_factory.ex". Make sure the :elixirc_paths configuration is a list of relative paths to the current project or absolute paths to external directories
What makes this curious is it gave a legitimate path to the file. If I vi that path, I edit the file. So I'm not sure why it effectively said "this thing I'm holding doesn't exist."
Is there a way to make this work without a bunch of hackery?
My fallback is to just manually copy the deps in, or add a symlink to the deps from the parent project, which is also kindof hacky.
-Brandon
--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/55c8853f-8917-f464-756a-1fbde892d346%40cold.org.
--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/0e3006c8-aa9e-c360-ad37-16374554ab7a%40cold.org.