recompile only if new option effects code generation #1584
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This was technically an issue before OTP20 but the changes here https://github.com/erlang/otp/pull/1367/files#diff-7a0a8b020276e896d2ae816ccfcfe62eL1481 resulted it modules being recompiled on every run with no changes by the user.
The issue is Erlang does not store all options in the beam chunks, before this was not noticed because the ones it leaves out are not commonly used. With the above changes this was always the case because rebar3 adds an
{outdir, ...}
option. So when comparing the past compilation options to the new it would find they have changed and recompile every module.This patch instead checks that any of the new options are those considered to effect compilation by Erlang and only then is the module recompiled.
In my opinion
warnings_as_errors
should be removed from the list and the function should be exported bycompile
but that is an issue to be taken up with a PR to OTP.