Rebar and generated .erl files

Tim Watson watson.timothy at gmail.com
Mon Feb 6 13:26:15 EST 2012


On 6 February 2012 17:37, Ransom Richardson <ransomr at cocomo.com> wrote:

>  Thanks.
>
>  I tried setting up generated as another src_dir, and it looks like that
> will only work if I make a separate app for the generate files. Is that
> correct? Are there downsides to having these function to encode and decode
> messages in a separate app?
>
>
No that isn't correct - it should work just fine. I do this exact thing
(i.e., use a "generated" directory) to keep my generated (neotoma/peg)
grammer modules separate from my source files and it works absolutely fine:
https://github.com/nebularis/ogql/blob/master/build.config. My peg grammar
still lives in "src" but the neotoma compiler does support keeping the
grammar itself elsewhere too. The build compiles fine and generated .app
file contains the generated modules too (see the shell output below). Is
your project open source? If so ping me the location of your scm repo and
I'll see if I can get it to play nice. Otherwise if you could at least mail
your rebar.config then I'll see if I can replicate what you're doing.

t4 at zeph:tmp $ git clone https://github.com/nebularis/ogql.git
Cloning into ogql...
remote: Counting objects: 237, done.
remote: Compressing objects: 100% (165/165), done.
remote: Total 237 (delta 141), reused 166 (delta 70)
Receiving objects: 100% (237/237), 251.08 KiB | 398 KiB/s, done.
Resolving deltas: 100% (141/141), done.
t4 at zeph:tmp $ cd ogql/
t4 at zeph:ogql $ git co -b alt-syntax origin/alt-syntax
Branch alt-syntax set up to track remote branch alt-syntax from origin.
Switched to a new branch 'alt-syntax'
t4 at zeph:ogql $ ls -la src/
total 48
drwxr-xr-x   6 t4  wheel   204  6 Feb 18:21 .
drwxr-xr-x  16 t4  wheel   544  6 Feb 18:21 ..
-rw-r--r--   1 t4  wheel   157  6 Feb 18:20 ogql.app.src
-rw-r--r--   1 t4  wheel  4699  6 Feb 18:21 ogql.erl
-rw-r--r--   1 t4  wheel  3187  6 Feb 18:21 ogql.peg
-rw-r--r--   1 t4  wheel  7325  6 Feb 18:21 ogql_ast_xform.erl
t4 at zeph:ogql $ rebar -C init.config get-deps && rebar -C build.config
get-deps compile
==> ogql (get-deps)
Pulling build_config from {git,"
https://github.com/nebularis/build_config.git"}
Cloning into build_config...
==> build_config (get-deps)
==> build_config (get-deps)
==> ogql (get-deps)
Pulling rebar_phase_plugin from {git,"git://
github.com/hyperthunk/rebar_phase_plugin.git"}
Cloning into rebar_phase_plugin...
Pulling rebar_skip_deps from {git,"git://
github.com/hyperthunk/rebar_skip_deps.git"}
Cloning into rebar_skip_deps...
Pulling dh_date from {git,"https://github.com/nebularis/dh_date.git"}
Cloning into dh_date...
Pulling neotoma from {git,"https://github.com/seancribbs/neotoma.git"}
Cloning into neotoma...
Pulling semver from {git,"https://github.com/nebularis/semver.git"}
Cloning into semver...
Pulling annotations from {git,"https://github.com/hyperthunk/annotations.git
"}
Cloning into annotations...
Pulling delegate from {git,"https://github.com/hyperthunk/delegate.git"}
Cloning into delegate...
==> rebar_phase_plugin (get-deps)
Pulling rebar_plugin_manager from {git,
                                      "git://
github.com/hyperthunk/rebar_plugin_manager.git"}
Cloning into rebar_plugin_manager...
==> rebar_plugin_manager (get-deps)
==> rebar_skip_deps (get-deps)
==> dh_date (get-deps)
==> neotoma (get-deps)
==> semver (get-deps)
==> annotations (get-deps)
Pulling parse_trans from {git,"https://github.com/esl/parse_trans.git"}
Cloning into parse_trans...
==> parse_trans (get-deps)
Pulling edown from {git,"git://github.com/esl/edown.git","HEAD"}
Cloning into edown...
==> edown (get-deps)
==> delegate (get-deps)
==> rebar_plugin_manager (pre_compile)
==> rebar_plugin_manager (compile)
Compiled src/rebar_plugin_manager.erl
==> rebar_phase_plugin (pre_compile)
==> rebar_phase_plugin (compile)
Compiled src/rebar_phase_plugin.erl
==> rebar_skip_deps (pre_compile)
==> rebar_skip_deps (compile)
Compiled src/rebar_skip_deps.erl
==> build_config (pre_compile)
==> build_config (compile)
==> dh_date (pre_compile)
==> dh_date (compile)
Compiled src/dh_date.erl
==> neotoma (pre_compile)
==> neotoma (compile)
Compiled src/neotoma_peg.erl
Compiled src/neotoma.erl
Compiled src/neotoma_parse.erl
==> semver (pre_compile)
==> semver (compile)
Compiled src/semver.erl
==> edown (pre_compile)
==> edown (compile)
Compiled src/edown_make.erl
Compiled src/edown_lib.erl
Compiled src/edown_xmerl.erl
Compiled src/edown_doclet.erl
Compiled src/edown_layout.erl
==> parse_trans (pre_compile)
==> parse_trans (compile)
Compiled src/parse_trans.erl
Compiled src/parse_trans_pp.erl
Compiled src/parse_trans_codegen.erl
Compiled src/exprecs.erl
Compiled src/ct_expand.erl
Compiled src/parse_trans_mod.erl
==> annotations (pre_compile)
==> annotations (compile)
Compiled src/annotations_pt.erl
Compiled src/annotations.erl
Compiled src/annotation.erl
Compiled src/rebar_annotations_plugin.erl
==> delegate (pre_compile)
Writing config to /private/tmp/ogql/deps/delegate/annotations.config
==> delegate (compile)
Compiled src/delegate.erl
Compiled src/delegate.erl
==> delegate (post_compile)
==> ogql (pre_compile)
==> ogql (compile)
Compiled src/ogql.peg
Compiled src/ogql_ast_xform.erl
Compiled generated/ogql_grammar.erl
Compiled src/ogql.erl
Compiled src/ogql.erl
t4 at zeph:ogql $ ls -la src/
total 48
drwxr-xr-x   6 t4  wheel   204  6 Feb 18:21 .
drwxr-xr-x  19 t4  wheel   646  6 Feb 18:21 ..
-rw-r--r--   1 t4  wheel   157  6 Feb 18:20 ogql.app.src
-rw-r--r--   1 t4  wheel  4699  6 Feb 18:21 ogql.erl
-rw-r--r--   1 t4  wheel  3187  6 Feb 18:21 ogql.peg
-rw-r--r--   1 t4  wheel  7325  6 Feb 18:21 ogql_ast_xform.erl
t4 at zeph:ogql $ ls -la generated/
total 40
drwxr-xr-x   4 t4  wheel    136  6 Feb 18:21 .
drwxr-xr-x  19 t4  wheel    646  6 Feb 18:21 ..
-rw-r--r--   1 t4  wheel    212  6 Feb 18:21 ogql_ast_xform.erl
-rw-r--r--   1 t4  wheel  16377  6 Feb 18:21 ogql_grammar.erl
t4 at zeph:ogql $ cat ebin/ogql.app
{application,ogql,
             [{description,"Object Graph Qualification Language"},
              {vsn,"0.0.1"},
              {registered,[]},
              {applications,[kernel,stdlib]},
              {modules,[ogql,ogql_ast_xform,ogql_grammar]}]}.
t4 at zeph:ogql $



>  I did see the built-in protocol buffer compiler, but the caveat scared
> me off (https://github.com/basho/erlang_protobuffs):
>
> ## CAVEATS
>
> Support for parsing proto files and creating code from it is volatile and
> should be considered alpha software at best. Please do not use this in production.
>
>
>
Fair enough. I am under the impression this is being used in the riak
Erlang client which is in production all over the place, but I could be
mistaken!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/rebar_lists.basho.com/attachments/20120206/dca868e7/attachment-0001.html>


More information about the rebar mailing list