Hello, I was wondering if there’s a way to do something at the end of application’s compilation? For example, there are the @before_compile and @after_compile hooks, which are scoped to the calling module. However, since Elixir’s compiler is concurrent, there doesn’t seem to be a deterministic way to know what will be the last compiled module in case you want to do something at the end of all compilations.
I reckon there must be some way to know the compilation has finished (e.g., Elixir emits a Generated <app_name> app at the end of each app’s compilation process which by looking at the source code seems to be emitted once the target app file is written)? Probably the API for this won’t be public for the general user.
Not sure if this is entirely what you meant but I think you can extend the compile mix task by adding your own “compiler” to the project and (to run it after everything else is compiled) just set it to last in the :compilers list. The docs has some info on this:
@michalmuskala and @hazardfn thank you for your answers. I did think about adding my own compiler to the mix.exs, but I wasn’t sure if that would be a solution. Your replies helped shed some light on this