rebar3 icon indicating copy to clipboard operation
rebar3 copied to clipboard

Rebar3 tries to compile Mix-only optional transitive dependencies

Open maennchen opened this issue 4 months ago • 2 comments

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_data listed as optional
  • Expected: Rebar3 ignores it
  • Actual: Rebar3 tries to compile stream_data and 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.

maennchen avatar Oct 27 '25 11:10 maennchen

It is listed in the package https://hex.pm/packages/purl

I don't think we support optional deps yet.

tsloughter avatar Oct 27 '25 13:10 tsloughter

@tsloughter Yes, it’s listed as optional. This issue is about making sure that optional deps are not fetched / compiled if not needed.

maennchen avatar Oct 27 '25 14:10 maennchen