bitwalker / exrm

Automatically generate a release for your Elixir project!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Changed behaviour with elixir 1.3.1 and umbrella apps

ulfurinn opened this issue · comments

Setup: umbrella app requiring exrm and two sub-apps with just bare mix new skeletons

  1. running mix release from umbrella dies with:
** (UndefinedFunctionError) function :rlx_cmd_args.args2state/2 is undefined (module :rlx_cmd_args is not available)
    :rlx_cmd_args.args2state([log_level: 3, root_dir: '/Users/valeris/proj/test-project/apps/app1', config: '/Users/valeris/proj/test-project/apps/app1/rel/.files/relx.config', relname: 'app1', relvsn: '0.1.0', output_dir: '/Users/valeris/proj/test-project/apps/app1/rel', dev_mode: false], ['release', 'tar'])
    /Users/valeris/proj/test-project/deps/relx/src/relx.erl:176: :relx.do/2
    lib/exrm/utils/utils.ex:105: ReleaseManager.Utils.relx/5
    lib/mix/tasks/release.ex:339: anonymous fn/4 in Mix.Tasks.Release.do_release/1
    lib/ex_unit/capture_io.ex:146: ExUnit.CaptureIO.do_capture_io/2
    lib/ex_unit/capture_io.ex:119: ExUnit.CaptureIO.do_capture_io/3
    lib/mix/tasks/release.ex:338: Mix.Tasks.Release.do_release/1
    lib/mix/tasks/release.ex:78: Mix.Tasks.Release.do_run/1
  1. running mix release from a sub-app dies with "The task "release" could not be found", and the task is not displayed in mix help

The workaround is to require exrm in all sub-apps as well. This is not necessary with elixir 1.2. Looks like the ebin lookup behaviour changed.

Not sure if this is a bug in exrm or in mix itself. If this is not a bug at all, it is worth documenting.

Did not have the exact same trace output:

** (UndefinedFunctionError) function :relx.do/2 is undefined (module :relx is not available)
    :relx.do([log_level: 3, root_dir: '/opt/hal/hal/apps/config', config: '/opt/hal/hal/apps/config/rel/.files/relx.config', relname: 'config', relvsn: '0.0.1', output_dir: '/opt/hal/hal/apps/config/rel', dev_mode
: false], ['release', 'tar'])
    lib/exrm/utils/utils.ex:105: ReleaseManager.Utils.relx/5
    lib/mix/tasks/release.ex:339: anonymous fn/4 in Mix.Tasks.Release.do_release/1
    lib/ex_unit/capture_io.ex:146: ExUnit.CaptureIO.do_capture_io/2
    lib/ex_unit/capture_io.ex:119: ExUnit.CaptureIO.do_capture_io/3
    lib/mix/tasks/release.ex:338: Mix.Tasks.Release.do_release/1
    lib/mix/tasks/release.ex:78: Mix.Tasks.Release.do_run/1
    (mix) lib/mix/project.ex:211: Mix.Project.in_project/4

but suggestion to add exrm to each sub-app's dependencies worked.

To be fair, it is documented somewhere, although it is hidden. The trail is: readme -> full doc examples -> umbrella's example master app.

I don't see the other two apps to have exrm dependencies except the master app in the example.
Also if the master is a phoenix app, the config must have the "server: true" set.