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

Provider hook for pre not working in rebar when started from Mix #7733

Closed
edescourtis opened this issue Jun 6, 2018 · 3 comments
Closed

Comments

@edescourtis
Copy link

edescourtis commented Jun 6, 2018

Environment

  • Elixir & Erlang/OTP versions (elixir --version):
    Erlang/OTP 20 [erts-9.3] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:10] [hipe] [kernel-poll:false]
    Elixir 1.6.4 (compiled with OTP 19)

  • Operating system:
    LSB Version: core-9.20160110ubuntu0.2-amd64:core-9.20160110ubuntu0.2-noarch:security-9.20160110ubuntu0.2-amd64:security-9.20160110ubuntu0.2-noarch
    Distributor ID: Ubuntu
    Description: Ubuntu 16.04.4 LTS
    Release: 16.04
    Codename: xenial

Current behaviour

Fails to compile rebar3 dependency. I made a minimal example here .

eric@eric-desktop:~/dev/rebar3_mix_provider_hook_bug_minimal$ mix compile
warning: path "apps/erlang_app_example" is a directory but it has no mix.exs. Mix won't consider this directory as part of your umbrella application. Please add a "mix.exs" or set the ":apps" key in your umbrella configuration with all relevant apps names as atoms
===> Package rebar_erl_vsn-0.2.0 not found. Fetching registry updates and trying again...
===> Updating package registry...
===> Writing registry to /home/eric/.cache/rebar3/hex/default/registry
...
===> Fetching rebar_erl_vsn ({pkg,<<"rebar_erl_vsn">>,<<"0.2.0">>})
===> Downloaded package, caching at /home/eric/.cache/rebar3/hex/default/packages/rebar_erl_vsn-0.2.0.tar
===> Compiling rebar_erl_vsn
===> Compiling erlang_app_example
===> Unable to run pre hooks for 'compile', command 'erl_vsn' not found.
** (Mix) Could not compile dependency :erlang_app_example, "/home/eric/.asdf/installs/elixir/1.6.4/.mix/rebar3 bare compile --paths "/home/eric/dev/rebar3_mix_provider_hook_bug_minimal/_build/dev/lib/*/ebin"" command failed. You can recompile this dependency with "mix deps.compile erlang_app_example", update it with "mix deps.update erlang_app_example" or clean it with "mix deps.clean erlang_app_example"

Compiling the dependency directly seems to work just fine:

eric@eric-desktop:~/dev/rebar3_mix_provider_hook_bug_minimal/apps/erlang_app_example$ rebar3 compile
===> Verifying dependencies...
===> Compiling erlang_app_example

I looked at the rebar_erl_vsn provider hook but I don't see anything wrong or abnormal. Also it seems to work fine in a pure rebar3 project.

Expected behaviour

Compiles correctly.

pmenhart added a commit to pmenhart/no_slides that referenced this issue Jun 6, 2018
* Test with several slave nodes in a cluster (configured in config/test.exs).
  To prevent running RiakCore on the master node (harmless, but clutters the logs),
  invoke with `mix test --no-start`
* Fixed a few warnings
* Updated riak_core.schema

Notes:
* Running this project on Elixir 1.6.5 with Erlang 20.3.6.
  I had to comment out "warnings_as_errors"
  in `deps/riak_ensemble/rebar.config` and in `deps/riak_core/rebar.config`
* This project uses riak_core_ng v3.0.9.
  Later riak_core_ng commits introduced gen_fsm_compat, which fails
  with newer Elixir+rebar3 because of "missing erl_vsn" issue:
  rebar_erl_vsn is a pre-compile hook in rebar.config of gen_fsm_compat
  and few other projects.
  Error seems to be caused by Mix not handling rebar3 hooks properly.
  See elixir-lang/elixir#7733
  and Kyorai/riak_core#23

  This issue is not specific to erl_vsn:
  for example, the forked https://github.com/gpad/cuttlefish (see mix.exs)
  differs from the official version only by rebar.config commenting out:
     % {provider_hooks, [{post, [{compile, {default, escriptize}}]}]}.
@ericmj
Copy link
Member

ericmj commented Jun 7, 2018

I can reproduce this when running the rebar3 bare compiler directly in the dependency directory, it seems that plugins are not loaded correctly in the bare compiler. Please open an issue with rebar3.

@ericmj
Copy link
Member

ericmj commented Jun 7, 2018

I reproduced by running rebar3 bare compile --paths "" in the erlang_app_example directory.

@ericmj
Copy link
Member

ericmj commented Jun 7, 2018

Closing, this issue is being tracked here: erlang/rebar3#1804

@ericmj ericmj closed this as completed Jun 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants