-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mix.Task.Compiler.after_compiler callback not executed when build fails #12159
Comments
Fixes #717 Workaround for elixir-lang/elixir#12159
This is... complicated. Should we run the Another option is for /cc @sasa1977 |
And yet another option is to introduce |
It would be best if we could distinguish after self and after all downstream. Are you aware of possible use cases? |
Right. We could add such feature but I think, for now, hooking after the Elixir compiler would be enough for boundary, especially if |
In the case of boundary, the after_compiler is installed only if the compiler runs. Does that simplify the problem?
I'm not sure I follow. Boundary relies on the compilation tracer, and so it needs to install its tracer before the Elixir compiler. After that would be too late, right? |
What I mean is to set |
Oh, I see. I'm afraid that this would be too early for boundary (at least in its current implementation), because it expects the app to be compiled in the after compiler (e.g. it loads the app modules). |
Actually this might work. The original issue in elixir-lsp/elixir-ls#717 was caused because boundary doesn't clear its tracer. This is something I could do in the after the Elixir compiler, while the rest would remain as it is today, i.e. execute after app, only on success or noop. |
Ok. I have updated the docs, so I will close this for now but I will be glad to reopen if necessary. |
Elixir and Erlang/OTP versions
Erlang/OTP 24 [erts-12.3.2.4] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]
Elixir 1.14.0 (compiled with Erlang/OTP 24)
Operating system
macos
Current behavior
The documentation for
Mix.Task.Compiler.after_compiler/2
suggests that the callback will be executed regardless of compilation result. It receivesstatus
type as argument. See https://hexdocs.pm/mix/1.14.0/Mix.Task.Compiler.html#after_compiler/2This simple example demonstrates that the callback is not executed
Repro:
mix compile
mix compile
Expected behavior
The callback should execute. If that is not possible then it needs to be explicitly documented. IMO there should ba a way of reliably executing cleanup code even if compilation fails.
The text was updated successfully, but these errors were encountered: