rebar3
rebar3 copied to clipboard
Add support for `dialyzer --incremental` when available
When the environment's OTP version supports dialyzer --incremental
(see the PR introducing it), enable an --incremental
/-i
option to rebar3 dialyzer
in order to make it accessible.
In erlang/OTP#5997, we added an --incremental
option to Dialyzer, however, in order to make good use of it from a rebar3 project, you'd probably want to have a corresponding option in rebar3 dialyzer
, which is what I've added here.
This PR introduces quite a bare-bones option, since you could do more in terms of reading incrementality-specific metrics from Dialyzer and reporting them, but it at least allows some early experimentation when it detects an appropriate bleeding-edge OTP version with the necessary features. For older OTP versions, users won't see this option, so nothing should change from their perspective.
As a point of comparison, when running on the rebar3 project itself, running Dialyzer the usual way without incrementality, the first run takes 2.25 mins, and a second run takes 25 secs. When using --incremental
, it takes 1.5 mins, going down to 6 seconds on a re-run. Of course, your milage will very definitely vary depending on machine's performance/load, the changes you make between Dialyzer analyses, and the structure of the project you run it on.
N.B. I also clarified the
Resolving files...
log line, since before it sort of implied the same work was being done twice, which isn't a good look for an "incremental" mode 😉
Looks like a good idea. A test may be tricky to put in place but worth it (maybe behind a version/dynamic switch). It seems like Dialyzer is failing on OTP-25. Not sure why, I'm assuming the typing is blowing up because of unsupported options? may be worth ignoring warnings if that's the actual reason.
I'm assuming the typing is blowing up because of unsupported options
Yes, this is the case. I've got a PR I am about to submit to OTP to resolve that part. (EDIT: see erlang/otp#6207)
A test may be tricky to put in place but worth it
I agree, I'll see what I can do.
Okay, I've suppressed that Dialyzer warning for now, and commented next to it with a link to the PR to fix it. I've also added unit tests around incremental mode which are skipped if the current OTP version does not support incrementality.
@ferd, what are your thoughts on the state of this PR now?