inaka / cowboy_swagger

Swagger integration for Cowboy (built on trails)

Home Page:http://inaka.net/blog/2015/08/19/cowboy-swagger/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error in parse transform 'mixer' when running the example

joshrotenberg opened this issue · comments

I get the following error when running rebar3 release with a fresh checkout:

❯ rebar3 release
===> Verifying dependencies...
===> App cowboy_swagger is a checkout dependency and cannot be locked.
===> Analyzing applications...
===> Compiling cowboy_swagger
===> Compiling mixer
===> Analyzing applications...
===> Compiling example
===> Compiling src/example_description_handler.erl failed
src/example_description_handler.erl:none: error in parse transform 'mixer':
exception error: an error occurred when evaluating an arithmetic expression
  in function  mixer:'-insert_stubs/3-fun-0-'/2 (/Users/joshrotenberg/GitHub/cowboy_swagger/example/_build/default/lib/mixer/src/mixer.erl, line 200)
  in call from lists:foldr/3 (lists.erl, line 1280)
  in call from mixer:insert_stubs/3 (/Users/joshrotenberg/GitHub/cowboy_swagger/example/_build/default/lib/mixer/src/mixer.erl, line 207)
  in call from mixer:parse_transform/2 (/Users/joshrotenberg/GitHub/cowboy_swagger/example/_build/default/lib/mixer/src/mixer.erl, line 47)
  in call from compile:foldl_transform/3 (compile.erl, line 1147)
  in call from compile:fold_comp/4 (compile.erl, line 418)
  in call from compile:internal_comp/5 (compile.erl, line 402)
  in call from compile:'-internal_fun/2-anonymous-0-'/2 (compile.erl, line 229)

Erlang/OTP 24 [erts-12.1.2] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [jit] [dtrace]
rebar 3.17.0 on Erlang/OTP 24 Erts 12.1.2

Hi.

cowboy_swagger 2.5.0 uses mixer 1.1.1 in the tests, so it seems unlikely that it's getting pulled by cowboy_swagger on rebar3 release, at first sight.

I'd need more context (like a GitHub repo. I can pull or the instructions to create the release as you're doing, starting from a clean folder) to help.

I tried with rebar3 new release + cowboy_swagger (from _checkouts) + rebar3 release and did not have this issue.

rebar3 release   
===> Verifying dependencies...
===> Fetching cowboy v2.8.0
===> Fetching jsx v2.9.0
===> Fetching ranch v2.0.0
===> Fetching trails v2.3.0
===> Fetching cowlib v2.9.1
===> Skipping ranch v1.7.1 as an app of the same name has already been fetched
===> App cowboy_swagger is a checkout dependency and cannot be locked.
===> Analyzing applications...
===> Compiling ranch
===> Compiling cowlib
===> Compiling cowboy
===> Compiling trails
===> Compiling jsx
===> Compiling cowboy_swagger
===> Analyzing applications...
===> Compiling myapp
===> Assembling release myapp-0.1.0...
===> Release successfully assembled: _build/default/rel/myapp

I then followed up with rebar3 release with mixer in _checkouts and the issue was not present either

rebar3 release
===> Verifying dependencies...
===> App mixer is a checkout dependency and cannot be locked.
===> App cowboy_swagger is a checkout dependency and cannot be locked.
===> Analyzing applications...
===> Compiling cowboy_swagger
===> Compiling mixer
===> Analyzing applications...
===> Compiling myapp
===> Assembling release myapp-0.1.0...
===> Release successfully assembled: _build/default/rel/myapp

Oh, wait. I think you mean running from within the example folder. Sure. In that case, yeah, it needs a mixer update.

I updated mixer on the main rebar.config and in the example folder. Let us know if this solves it for you. Thanks.

Looks good, works as documented now. Thanks!