Erlang edoc 多级目录出错
使用rebar doc来生成项目文档。
但是当erl源文件目录src下建立子目录,并新建erlang文件后,就无法生成文档。
例如,新建 src/tttt/, 并添加 dd_util.erl 文件。
D:\six>d:/tools/rebar/rebar.cmd doc
==> six (doc)
ERROR: doc failed while processing D:/six: {'EXIT',{function_clause,[{edoc,expan
d_sources,
[[{tttt,"dd_util.erl","./src/tttt"},
{'',"gateway_http.erl","./src"},
{'',"six.erl","./src"},
{'',"six_app.erl","./src"},
{'',"six_sup.erl","./src"}],
".erl",
{set,0,16,16,8,80,48,
{[],[],[],[],[],[],[],[],[],[],[],[],[],
[],[],[]},
{{[],[],[],[],[],[],[],[],[],[],[],[],
[],[],[],[]}}},
[],[]],
[{file,"edoc.erl"},{line,459}]},
{edoc,run,3,[{file,"edoc.erl"},{line,378}]},
{rebar_edoc,doc,2,
[{file,"src/rebar_edoc.erl"},{line,63}]},
{rebar_core,run_modules,4,
[{file,"src/rebar_core.erl"},
{line,491}]},
{rebar_core,execute,6,
[{file,"src/rebar_core.erl"},
{line,416}]},
{rebar_core,maybe_execute,8,
[{file,"src/rebar_core.erl"},
{line,300}]},
{rebar_core,process_dir1,7,
[{file,"src/rebar_core.erl"},
{line,259}]},
{rebar_core,process_commands,2,
[{file,"src/rebar_core.erl"},
{line,91}]}]}}
D:\six>
在rebar.config中添加参数{packages, false}解决了。
{deps, [{mysql, ".*", {git, "https://github.com/dizzyd/erlang-mysql-driver.git"}},
{lager, ".*", {git, "https://github.com/basho/lager.git"}},
{mochiweb, ".*", {git, "https://github.com/mochi/mochiweb.git"}}]}.
{erl_opts, [{parse_transform, lager_transform}]}.
{edoc_opts, [{packages, false}]}.
大概是Erlang多层目录会建立“subpackages”,应该就是模块名字空间:
If the source code is organized in a hierarchy of subdirectories although it does not use packages, use no_packages
但是没有找到相关的文档,不知道如何建立子包。
参考:
http://www.erlang.org/documentation/doc-5.8.4/lib/edoc-0.7.8/doc/html/edoc.html#run-3
http://www.erlang.org/documentation/doc-5.8.4/lib/edoc-0.7.8/doc/html/chapter.html#Running_EDoc