Browse Source

Ensure EDoc opts in umbrella apps are respected

This adds an additional loading and merging of options for EDoc using
the values from the top-level along with those specified in the
rebar.config of an umbrella application.

The app-specific config values are prepended to the global ones; this
can likely cause some problems with manual path handling, but is
unlikely to happen in practice and the rest seems to work fine based on
order

Fixes the issue in #2114
pull/2116/head
Fred Hebert 6 years ago
parent
commit
44ab2dfd1a
4 changed files with 15 additions and 2 deletions
  1. +4
    -1
      src/rebar_prv_edoc.erl
  2. +9
    -1
      test/rebar_edoc_SUITE.erl
  3. +1
    -0
      test/rebar_edoc_SUITE_data/foo/apps/foo/rebar.config
  4. +1
    -0
      test/rebar_edoc_SUITE_data/foo/rebar.config

+ 4
- 1
src/rebar_prv_edoc.erl View File

@ -45,7 +45,10 @@ do(State) ->
AppName = rebar_utils:to_list(rebar_app_info:name(AppInfo)), AppName = rebar_utils:to_list(rebar_app_info:name(AppInfo)),
?INFO("Running edoc for ~ts", [AppName]), ?INFO("Running edoc for ~ts", [AppName]),
AppDir = rebar_app_info:dir(AppInfo), AppDir = rebar_app_info:dir(AppInfo),
AppRes = (catch edoc:application(list_to_atom(AppName), AppDir, EdocOptsAcc)),
AppOpts = rebar_app_info:opts(AppInfo),
%% order of the merge is important to allow app opts overrides
AppEdocOpts = rebar_opts:get(AppOpts, edoc_opts, []) ++ EdocOptsAcc,
AppRes = (catch edoc:application(list_to_atom(AppName), AppDir, AppEdocOpts)),
rebar_hooks:run_all_hooks(Cwd, post, ?PROVIDER, Providers, AppInfo, State), rebar_hooks:run_all_hooks(Cwd, post, ?PROVIDER, Providers, AppInfo, State),
case {AppRes, ShouldAccPaths} of case {AppRes, ShouldAccPaths} of
{ok, true} -> {ok, true} ->

+ 9
- 1
test/rebar_edoc_SUITE.erl View File

@ -52,7 +52,15 @@ multiapp(Config) ->
"barer1")), "barer1")),
?assert(file_content_matches( ?assert(file_content_matches(
filename:join([AppsDir, "apps", "foo", "doc", "foo.html"]), filename:join([AppsDir, "apps", "foo", "doc", "foo.html"]),
"apps/bar1/doc/bar1.html")).
"apps/bar1/doc/bar1.html")),
%% Options such from rebar.config in the app themselves are
%% respected
?assert(file_content_matches(
filename:join([AppsDir, "apps", "foo", "doc", "overview-summary.html"]),
"foo_custom_title"
)),
ok.
error_survival(Config) -> error_survival(Config) ->
RebarConfig = [], RebarConfig = [],

+ 1
- 0
test/rebar_edoc_SUITE_data/foo/apps/foo/rebar.config View File

@ -0,0 +1 @@
{edoc_opts, [{title, "foo_custom_title"}]}.

+ 1
- 0
test/rebar_edoc_SUITE_data/foo/rebar.config View File

@ -0,0 +1 @@
{edoc_opts, [{title, "forced wrong title to be overridden"}]}.

Loading…
Cancel
Save