简体   繁体   English

命令“钢筋文档”不一致

[英]Command 'rebar doc' is inconsistent

First of all, 'rebar doc' works sometimes and sometimes not. 首先,“钢筋文档”有时有效,有时无效。 It is strange. 它很奇怪。 Rebar version which I'm using is 2.5.1 我正在使用的钢筋版本为2.5.1

My folder structure is: 我的文件夹结构是:

  1. Header_Directory Header_Directory
    1.1 apps 1.1应用
    1.1.1 sub_dir_1 1.1.1 sub_dir_1
    1.1.2 sub_dir_2 / include 1.1.2 sub_dir_2 /包含
    1.1.3 sub_dir_3 1.1.3 sub_dir_3
    1.2 deps 1.2副
    1.3 confs 1.3 confs
    rebar.config rebar.config

Modules in sub_dir_3 also use some include files from sub_dir_2/include folder. sub_dir_3中的模块还使用sub_dir_2 / include文件夹中的一些包含文件。

The error I get when I use the command rebar doc is: 使用命令钢筋文档时出现的错误是:
.sub_dir_3/src/my_log_worker.erl, in module header: at line 9: file not found: some.hrl edoc: skipping source file 'sub_dir_3/src/my_log_worker.erl': {'EXIT',error}. .sub_dir_3 / src / my_log_worker.erl,在模块标题中:在第9行:找不到文件:some.hrl edoc:跳过源文件'sub_dir_3 / src / my_log_worker.erl':{'EXIT',error}。 edoc: error in doclet 'edoc_doclet': {'EXIT',error}. edoc:doclet'edoc_doclet'中的错误:{'EXIT',error}。 ERROR: doc failed while processing /home/learn/header_directory/apps/sub_dir_3: {'EXIT',error} 错误:处理/ home / learn / header_directory / apps / sub_dir_3时文档失败:{'EXIT',error}

I do 'rebar clean' and then 'rebar compile' prior to 'rebar doc' 我先进行“清理干净”操作,然后再进行“编译”操作,然后再执行“ doc doc”操作

Also,when I do it in erl shell, I get error. 另外,当我在erl shell中执行此操作时,会出现错误。

edoc:file("some_log_worker.erl", []). edoc:file(“ some_log_worker.erl”,[])。
edoc: error reading file 'some_log_worker.erl'. edoc:读取文件'some_log_worker.erl'时出错。
** exception exit: {error,enoent} **异常退出:{error,enoent}
in function edoc:read_source/2 (edoc.erl, line 664) in call from edoc_extract:source/3 (edoc_extract.erl, line 52) 在函数edoc:read_source / 2(edoc.erl,第664行)中,来自edoc_extract:source / 3(edoc_extract.erl,第52行)的调用
in call from edoc:read/2 (edoc.erl, line 537) 在edoc:read / 2的通话中(edoc.erl,第537行)
in call from edoc:file/2 (edoc.erl, line 116) 在edoc:file / 2的调用中(edoc.erl,第116行)

Is there any way by which I can include my hrl file either in rebar.config or edoc options? 有什么方法可以将我的hrl文件包含在rebar.config或edoc选项中?

I have '{edoc_opts, [{ i, "apps/sub_dir_3/include" }]}.' 我有'{edoc_opts,[{i,“ apps / sub_dir_3 / include”}]}}。 in rebar.config, still of no help. 在rebar.config中,仍然没有帮助。

It looks like you didn't follow the rebar/OTP conventions: 您似乎没有遵循钢筋/ OTP约定:

OTP Conventions OTP约定

Rebar expects projects to follow the OTP conventions as described in the OTP Design Principles document: Applications 钢筋希望项目遵循OTP设计原则文档:应用程序中所述的OTP约定。

An application should consists of the following set of directories: 应用程序应包含以下目录集:

 src ebin priv include 

and have an application resource file: ebin/example_project.app or src/example_project.app.src. 并具有一个应用程序资源文件:ebin / example_project.app或src / example_project.app.src。 In the later case, the ebin/example_project.app file is generated from the src/example_project.app.src one automatically during the compilation phase. 在后一种情况下,ebin / example_project.app文件是在编译阶段从src / example_project.app.src自动生成的。

Rebar & OTP convetions 钢筋和OTP的鼓励

I recommend you to move to that file organisation, it will be really much simpler to benefit from standard tools like rebar. 我建议您转到该文件组织,使用诸如钢筋之类的标准工具确实要简单得多。

Yes, it is always in the best interest to follow the OTP principles. 是的,遵循OTP原则始终是最大的利益。 However, it worked for my app structure. 但是,它适用于我的应用程序结构。

The only problem was because of @headerfile annotation in the erlang modules. 唯一的问题是由于erlang模块中的@headerfile批注。 Somehow, I don't know how to correctly use the @headerfile annotation. 不知何故,我不知道如何正确使用@headerfile批注。

Thanks for all the help. 感谢您的所有帮助。 :) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM