rebar3 LFE compiler plugin ...

36 views
Skip to first unread message

Duncan McGreggor

unread,
Oct 21, 2015, 11:09:27 PM10/21/15
to lisp-flavo...@googlegroups.com
Hey all,

I've just pulled myself up out of the rabbithole of rebar3 wonderland
after several long nights of rewriting the LFE compiler plugin. Lots has
changed in rebar3land since I first wrote it -- all of it for the better.

rebar3 was a pretty cool tool even then -- *very* well architected. The
only problem I had with it was the amount of internal functions I needed
to copy out of the rebar3 Erlang compiler provider into an ad-hoc LFE
compiler plugin. It wasn't too flexible for those who wanted to write
custom compiler plugins.

Or, if it was, I had never been able to uncover the incantations
necessary to do it easily.

In the past 6 or more months, either that has changed or the
documentation has improved (or both!), since this is now very easy to do:
* https://www.rebar3.org/docs/custom-compiler-plugins

I gutted the old rebar3 LFE compiler plugin and redid it using this new
approach. After a ton of debugging, I finally got a beautiful run of the
plugin tonight full of .beamy goodness. Here's the branch:
* https://github.com/lfex/rebar3-lfe-compile/tree/use-new-rebar3-compile

Here's the ticket that kicked off this work:
* https://github.com/lfex/rebar3-lfe-compile/issues/1

Usage is not documented in the branch yet, though it mostly is at the
bottom of that ticket. You'll also see what I haven't tested yet in the
same place (a bullet list).

This email has gotten too long, so I'll send another after this about
the future of LFE projects using rebar3...

d

Feng Hou

unread,
Nov 3, 2015, 2:16:44 PM11/3/15
to Lisp Flavoured Erlang
Hi Duncan,

I was trying rebar3 plugins you put together (thank you!). Not sure if they are ready to use or not. Just want to let you know a few issues I ran into.

- Readline control chars (ie. ^G, up/down history keys) do not seem to work in rebar3 lfe repl. 
- Though rebar3 tree shows all deps, they don't show up in (code:get_path). 
- rebar lfe compile gave Uncaught error in rebar_core. Run with DEBUG=1 to see stacktrace (very long, mostly from _build/default/plugins/lfe/src/lfe_comp.erl)..

here is my rebar.config

{erl_opts, [debug_info,

            warn_unused_import,

            warn_shadow_vars,

            warn_export_vars,

            strong_validation,

            report,

            {src_dirs, ["lfe"]}]}.

{deps, [

  {lfe, ".*", 

    {git, "https://github.com/rvirding/lfe.git", {tag, "v0.10.0"}}},

  {lutil, ".*",

    {git, "git://github.com/lfex/lutil.git", {branch, "master"}}},

  {ltest, ".*",

    {git, "git://github.com/lfex/ltest.git", {branch, "master"}}}

]}.

{plugins, [

  {'lfe-compile', ".*",

    {git, "https://github.com/lfe-rebar3/compile.git", {branch, "master"}}},

  {'lfe-version', ".*",

    {git, "https://github.com/lfe-rebar3/version.git", {branch, "master"}}},

  {'lfe-repl', ".*",

    {git, "https://github.com/lfe-rebar3/repl.git", {branch, "master"}}}

]}.


and output from rebar3 lfe version


(#(erlang "17")

 #(emulator "6.4")

 #(driver-version "3.2")

 #(lfe "0.10.0")

 #(rebar "3.0.0-beta.3+build.307.refe72e46f"))


Regards,

Feng

Eric Bailey

unread,
Nov 3, 2015, 2:22:06 PM11/3/15
to lisp-flavo...@googlegroups.com
FWIW, I've been using "lfe -pa _build/default/lib/*/ebin" for now.

Eric




--
You received this message because you are subscribed to the Google Groups "Lisp Flavoured Erlang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lisp-flavoured-e...@googlegroups.com.
To post to this group, send email to lisp-flavo...@googlegroups.com.
Visit this group at http://groups.google.com/group/lisp-flavoured-erlang.
For more options, visit https://groups.google.com/d/optout.

Duncan McGreggor

unread,
Nov 3, 2015, 2:28:25 PM11/3/15
to lisp-flavo...@googlegroups.com
The latest lfe commit to the develop branch takes that into account (thus lfe 0.11.0 will have it). If you use that code, you just need to run "lfe" with no -pa options.

d

Feng Hou

unread,
Nov 3, 2015, 2:29:21 PM11/3/15
to Lisp Flavoured Erlang
Eric - That works for me as well. Thank you! 

Regards,
Feng
To unsubscribe from this group and stop receiving emails from it, send an email to lisp-flavoured-erlang+unsub...@googlegroups.com.

Duncan McGreggor

unread,
Nov 3, 2015, 2:34:02 PM11/3/15
to lisp-flavo...@googlegroups.com

On 11/03/2015 01:16 PM, Feng Hou wrote:
Hi Duncan,

I was trying rebar3 plugins you put together (thank you!). Not sure if they are ready to use or not.
No, definitely in a state of bleeding edge/continued development.


Just want to let you know a few issues I ran into.

- Readline control chars (ie. ^G, up/down history keys) do not seem to work in rebar3 lfe repl.
That's a known issue; haven't created a ticket for it yet (feel free to, if you're inclined).

- Though rebar3 tree shows all deps, they don't show up in (code:get_path).
Hrm. That should not be happening -- when I run (code:get_path), I see all the stuff in _build/* ...

What does your rebar.config look like? Did you remember to add the rebar3 hooks (that's described in one of the linked tickets below).

Related: another open issue (also no ticket) is to update the compile plugin's README so that people know how to set things up, if they want to play with this stuff while it's under development ...

- rebar lfe compile gave Uncaught error in rebar_core. Run with DEBUG=1 to see stacktrace (very long, mostly from _build/default/plugins/lfe/src/lfe_comp.erl)..

This may be due to your rebar.config missing the hooks.

Ah, yes -- you're missing this bit:

{provider_hooks, 
[
  {pre, [{compile, {lfe, compile}}]}
  ]}.

--
You received this message because you are subscribed to the Google Groups "Lisp Flavoured Erlang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lisp-flavoured-e...@googlegroups.com.

Feng Hou

unread,
Nov 3, 2015, 9:37:41 PM11/3/15
to Lisp Flavoured Erlang
Thanks! I'll try them.

Regards,
Feng
To unsubscribe from this group and stop receiving emails from it, send an email to lisp-flavoured-erlang+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages