Automated check for circular compile time dependencies

Hi @jmurphyweb. I also have an issue where a large number of files are recompiled when I make even trial changes to many files (like adding or removing a comment). I don’t think that phrasing this as a “circular compile time dependency” though is helping, because if it were actually that then you’d have gridlock at compile time and get an actual error.

For example, these modules have a true compile time dependency on each other:

# a.ex
defmodule A do
  B.run()
end

# b.ex
defmodule B do
  A.run()
end

If I try to compile these, I get:

== Compilation error in file lib/sensetra/integration/b.ex ==
** (CompileError)  deadlocked waiting on module A
    lib/sensetra/integration/b.ex:2: (module)
    (stdlib) erl_eval.erl:680: :erl_eval.do_apply/6

== Compilation error in file lib/sensetra/integration/a.ex ==
** (CompileError)  deadlocked waiting on module B
    lib/sensetra/integration/a.ex:2: (module)
    (stdlib) erl_eval.erl:680: :erl_eval.do_apply/6

Compilation failed because of a deadlock between files.
The following files depended on the following modules:

  lib/sensetra/integration/b.ex => A
  lib/sensetra/integration/a.ex => B

Ensure there are no compile-time dependencies between those files and that the modules they reference exist and are correctly named
1 Like