bitwalker / distillery

Simplify deployments in Elixir with OTP releases!
MIT License
2.96k stars 396 forks source link

[Windows] incorrect path to consolidated protocols #652

Closed thorsten-de closed 5 years ago

thorsten-de commented 5 years ago

Steps to reproduce

Build a windows release, start a console and check if protocols are consolidated.

iex(node@127.0.0.1)3> Protocol.consolidated?(String.Chars)
false

Description of issue

Solution

The generated powershell script sets CONSOLIDATED_DIR incorrectly: $Env:CONSOLIDATED_DIR = (join-path $release_root_dir (join-path ("{0}-{1}" -f $rel_name,$rel_vsn) "consolidated")

That results in a path like: _build\prod\rel\tc\tc-1.0.0\consolidated\, where the "lib" subdir is missing.

So, it should be joined to release_lib_dir, not to release_root. See https://hexdocs.pm/mix/Mix.Tasks.Compile.Protocols.html for more information.

Btw, the corresponding bash script sets it properly: CONSOLIDATED_DIR="${RELEASE_ROOT_DIR}/lib/${REL_NAME}-${REL_VSN}/consolidated"

I'll try to patch that during this weekend.

thorsten-de commented 5 years ago

After using the proper path for CONSOLIDATED_DIR, I logged Protocol.consolidated?(String.Chars) inside my app. The results are confusing:

bitwalker commented 5 years ago

This should be fixed in master/2.0.x branches: