Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document rebar_compiler behaviour #1947

Closed
lpil opened this issue Nov 17, 2018 · 4 comments
Closed

Document rebar_compiler behaviour #1947

lpil opened this issue Nov 17, 2018 · 4 comments

Comments

@lpil
Copy link

lpil commented Nov 17, 2018

The new rebar_compiler behaviour is the recommended way to teach rebar to compile new file types, but use of the behaviour is non-obvious.

It would be great to get some documentation (such as comments on the behaviour callbacks

-callback context(rebar_app_info:t()) -> #{src_dirs => [file:dirname()],
include_dirs => [file:dirname()],
src_ext => extension(),
out_mappings => out_mappings()}.
-callback needed_files(digraph:graph(), [file:filename()], rebar_app_info:t()) -> [file:filename()].
-callback dependencies(file:filename(), file:dirname(), [file:dirname()]) -> [file:filename()].
-callback compile(file:filename(), out_mappings(), rebar_dict(), list()) ->
ok | {ok, [string()]} | {ok, [string()], [string()]}.
) so that it's clearer how to make use of it :)

@ferd
Copy link
Collaborator

ferd commented Nov 18, 2018

Right. There might be a small change to the needed_files/3 callback (becomes needed_files/4) so it should be documented soon, when we cut 3.7.0 final; we've been using the release candidates to find a few bugs in the API and avoid committing to backwards compat on what could be unstable code, so we avoided documenting it so far.

@ferd
Copy link
Collaborator

ferd commented Nov 18, 2018

See #1938 for the pending PR changing the callback

@lpil
Copy link
Author

lpil commented Nov 18, 2018

Thank you!

@ferd
Copy link
Collaborator

ferd commented Nov 23, 2018

I've added initial documentation at https://www.rebar3.org/v3/docs/custom-compiler-modules

@ferd ferd closed this as completed Nov 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants