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

Could not compile phoenix based application #9

Closed
oltarasenko opened this issue Jun 11, 2019 · 3 comments
Closed

Could not compile phoenix based application #9

oltarasenko opened this issue Jun 11, 2019 · 3 comments

Comments

@oltarasenko
Copy link

@tsloughter Could you please advise on the following. I am having a phoenix application: https://github.com/oltarasenko/live_view_counter and I want to package it inside my current erlang project (basic release application generated with rebar).

I have the following in my rebar.config:

{erl_opts, [debug_info]}.
{deps,[
       {poison, {git, "git://github.com/devinus/poison.git", {tag, "4.0.1"}}},
       {live_view_counter, {git, "git@github.com:oltarasenko/live_view_counter.git", {branch, "master"}}}
      ]}.


{relx, [{release, {myapp, "0.1.0"},
         [kernel,
          stdlib,
          sasl]},

        {deps,[
               {git, "git@github.com:devinus/poison.git"}
              ]},

        {sys_config, "./config/sys.config"},
        {vm_args, "./config/vm.args"},

        {dev_mode, true},
        {include_erts, true},

        {extended_start_script, true}]
}.

{profiles, [{dev, [{relx, [
                           {dev_mode, false},
                           {include_erts, true},
                           {deps,[
                                  {git, "git@github.com:devinus/poison.git"}
                                 ]}
                          ]
                   }]
            }]
}.

{overlay, [{copy, "{{base_dir}}/consolidated", "releases/{{release_version}}/consolidated"}]}.


{plugins, [rebar_mix]}.
{provider_hooks, [{post, [{compile, {mix, consolidate_protocols}}]}]}.

I am getting the following error on rebar3 release

rebar3 release
===> Verifying dependencies...
===> Compiling live_view_counter
** (Mix) The task "compile.phoenix" could not be found. Did you mean "compile.elixir"?
===> Failed to compile application live_view_counter with mix```

On a high level, it looks like we can't find phoenix specific tasks?
@tsloughter
Copy link
Collaborator

First, you can't have deps defined in the relx section.

But sadly what you are trying to do isn't possible at this time. rebar_mix is only able to install mix hex packages, not from git repos.

The issue is rebar3 needs to be able to know all of the transitive dependencies. In the case of a hex package it is able to because it is no different from a rebar3 hex package, the dependencies are in the metadata. When the dep is a git repo this isn't available and rebar3 can not evaluate the mix.exs script, so it has no way of telling what the dependencies of the mix dep are.

My only idea so far is to have a mix command that can output the deps as an Erlang term file which we can then read.

Hm, I suppose there is the possibility of adding a custom parser of the mix.lock file.. But then would require the lock file, and a good bit of work most likely to create a parser for Elixir maps.

@tsloughter
Copy link
Collaborator

You might want to look at https://github.com/Supersonido/rebar3_elixir as an alternative for now.

I see this one uses reading the lock file to make transitive deps possible https://github.com/Supersonido/rebar3_elixir/blob/master/src/rebar3_elixir_utils.erl#L174

Hopefully we can consolidate this into a single plugin.

@Supersonido
Copy link
Owner

It's already consolidated!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants