Compilation cleanup hook to generate a file

I’d like to generate a file just before the projects compilation finishes which contains collected information from multiple modules.

For example if ModuleA calls in one function MacroModule.collector("a") and ModuleB calls in different functions MacroModule.collector("a") and MacroModule.collector("b") I want to generate a file that contains:


The deduplication can be solved with ETS, but I’m missing a hook where I know “now I need to write the ETS contents to a file”.

Is there a way to achieve this?

Write custom Mix.Task.Compiler and then it can generate whatever file you want after compilation.


I’d have to put that compiler into the compilers list in mix.exs:project/0 correct?