-
Notifications
You must be signed in to change notification settings - Fork 16
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
support for recent rebar3 version #84
Comments
The problem is definitely with the current compile order in rebar3. Now the pre_hooks are called before the dependencies of the project are compiled which is wrong. Fred Herbert mentioned me this neotoma plugin: https://github.com/tsloughter/rebar3_neotoma_plugin I've tried and it actually works, the only problem is that it does not support an src_dir parameter. This is a problem because katt_blueprint.peg is stored in the priv folder, and the plugin wants to compile .peg files stored only in the src directory. Either katt_blueprint.peg should be moved into ./src or the plugin should be slightly modified. Can you see any other options? |
So I have just tried it on our projects with a simple modification in katt's code. I've moved prv/katt_blueprint.peg => src/katt_blueprint.peg and added
to rebar.config and commented out
Actually now there is no need for priv/compile-parser anymore. Should I create a pull request? |
@tothlac I tried your https://github.com/tothlac/try_katt with a branch of katt using the {katt,
{git,
"git@github.com:brucify/katt.git",
{branch,"use-rebar3-neotoma-plugin"}}} With katt rebar.config: {plugins, [rebar3_neotoma_plugin]}.
{provider_hooks, [{pre, [{compile, {neotoma, compile}}]}]}. It seems that
However if I go into Did you get it to work? Edit:
This is probably because SourceDir = filename:join(rebar_app_info:dir(AppInfo), "src"),
CompileFun = fun(Source, Target, _Config) ->
OutDir = filename:dirname(Target),
neotoma:file(Source, [{output, OutDir}])
end,
rebar_base_compiler:run(Opts, [], SourceDir, ".peg", SourceDir, ".erl", CompileFun, [{check_last_mod, true}]) |
Sorry for a late response. I have a commit here that does what I mentioned above:
I can create a PR for this. |
I was using a very old rebar3 version (3.13.0).
During the recent days I wanted to try out 3.18.0.
On this repository when I run
rebar3 eunit
katt_blueprint.erl is generated, but it can't generate katt_blueprint.beam. The reason is simple as I see. Earlier you had this commit which changed pre_hooks to post_hooks in rebar.config:2bc3255
The problem is that with the current version of rebar3
priv/compile-parser
is executed after katt is compiled, so it generates katt_blueprint.erl but compile won't run twice, so rebar3 won't generate katt_blueprint.beam into the ebin directory.I made some modifications on katt for this repository, and now it is called twice (from pre_hooks and from post_hooks).
I see the problem why it can't work with pre_hooks is that neotoma is compiled after the pre_hooks of katt is called so
neotoma:file("priv/katt_blueprint.peg", [{output, "src/"}])
will fail since neotoma.beam had not been generated.The first
is printed when compile-parser is called from the pre_hooks and as you can see neotoma:file/2 is undef, the second
Compile katt_blueprint
is successful but compile has been already called, so katt_blueprint.beam won't be generated.I've pushed the code here: https://github.com/tothlac/try_katt
The text was updated successfully, but these errors were encountered: