Rework how user-specified doclet
and layout
modules are managed
#25
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.
The previous approach had several major issues that couldn't be easily fixed:
I understood how
edoc_{doclet,layout}_chunks
worked incorrectly. I thought that they would generate both the HTML documentation and the EEP-48 doc chunks. That's not the case and they only generate doc chunks. So to get both, we need to run EDoc withedoc_doclet
andedoc_layout
in addition to the configured modules.Calling
edoc_*_chunks
and ignoring the return values (because we want to calledoc_*
too) broke doc chunks. So it's not possible to chain EDoc backend modules from the backend modules themselves.The way we overrode EDoc options in the Rebar state was ineffective.
Rebar supports project- and app-level configurations. The app-level configuration defaults to the project-level one. The
edoc
Rebar command merges them to create the final list of options.Because of this, we ended up with duplicated options for those we override in this plugin. For instance, we got two
doclet
modules in the options list: one from the project-level configuration (set by this plugin), one from the app-level configuration (inherited from the project-level configuration before we modify it). And the app-level configuration took precedence, meaning that our backend modules were not used.This patch brings a new design.
First, the loop over project apps now overrides settings in the app-level configuration. The same settings are removed from the project-level configuration. This ensures that the
edoc
command will get the options we override from the app-level configuration only.Second, instead of calling the user-configured backend modules from our own modules, we simply call the
edoc
Rebar command twice: once for each set of modules. If the user is using default backends, we simply calledoc
once for this plugin.