Rebar3 tries to compile Mix-only optional transitive dependencies
Description
This is a follow-up to https://github.com/erlang/rebar3/pull/2498#issuecomment-3389598258.
Rebar3 currently attempts to fetch and compile optional transitive dependencies, even when:
- they are only declared as optional in
mix.exs, - they are not listed in
rebar.config, - and they are Mix-only packages.
This causes build failures because Rebar3 does not understand Mix deps out of the box and should be ignoring them entirely.
Example
Repo: https://github.com/erlef/purl
-
rebar.config: no deps -
mix.exs:stream_datalisted as optional - Expected: Rebar3 ignores it
- Actual: Rebar3 tries to compile
stream_dataand fails
Expected behavior
Optional dependencies not present in rebar.config should be ignored by Rebar3, even if they appear in mix.exs. This is needed for cross-tool compatibility when a library supports both build tools.
It is listed in the package https://hex.pm/packages/purl
I don't think we support optional deps yet.
@tsloughter Yes, it’s listed as optional. This issue is about making sure that optional deps are not fetched / compiled if not needed.