0
votes

First of all, 'rebar doc' works sometimes and sometimes not. It is strange. Rebar version which I'm using is 2.5.1

My folder structure is:

  1. Header_Directory
    1.1 apps
    1.1.1 sub_dir_1
    1.1.2 sub_dir_2 / include
    1.1.3 sub_dir_3
    1.2 deps
    1.3 confs
    rebar.config

Modules in sub_dir_3 also use some include files from sub_dir_2/include folder.

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}. edoc: error in doclet 'edoc_doclet': {'EXIT',error}. ERROR: doc failed while processing /home/learn/header_directory/apps/sub_dir_3: {'EXIT',error}

I do 'rebar clean' and then 'rebar compile' prior to 'rebar doc'

Also,when I do it in erl shell, I get error.

edoc:file("some_log_worker.erl", []).
edoc: error reading file 'some_log_worker.erl'.
** exception exit: {error,enoent}
in function edoc:read_source/2 (edoc.erl, line 664) in call from edoc_extract:source/3 (edoc_extract.erl, line 52)
in call from edoc:read/2 (edoc.erl, line 537)
in call from edoc:file/2 (edoc.erl, line 116)

Is there any way by which I can include my hrl file either in rebar.config or edoc options?

I have '{edoc_opts, [{ i, "apps/sub_dir_3/include" }]}.' in rebar.config, still of no help.

2
you probably want to look into formatting your code.Huey

2 Answers

1
votes

It looks like you didn't follow the rebar/OTP conventions:

OTP Conventions

Rebar expects projects to follow the OTP conventions as described in the OTP Design Principles document: Applications

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. 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.

Rebar & OTP convetions

I recommend you to move to that file organisation, it will be really much simpler to benefit from standard tools like rebar.

0
votes

Yes, it is always in the best interest to follow the OTP principles. However, it worked for my app structure.

The only problem was because of @headerfile annotation in the erlang modules. Somehow, I don't know how to correctly use the @headerfile annotation.

Thanks for all the help. :)