erlef / rebar3_hex

Rebar3 Hex library
Apache License 2.0
101 stars 49 forks source link

Publishes the wrong version when an ebin folder is present #174

Closed eproxus closed 4 years ago

eproxus commented 4 years ago

If an ebin/myapp.app file is present, the plug-in will publish the version from there instead of the one in src/myapp.app.src or _build/default/lib/myapp/ebin/myapp.app. This frequently happens when the current myapp project is symlinked in another projects _checkouts folder. When that is the case, Rebar 3 will compile the project and put an ebin folder inside _checkouts/myapp/ebin which then, because of the symlink, ends up being myapp/ebin. ebin is usually Git ignored in projects because of Rebar's generated default .gitignore file.

This leads to weird scenarios when publishing a new version and all files are up to date except the files in ebin which are old and previously compiled by Rebar 3 in another projects _checkouts.

I think the logic should be to use the app files in the following order:

  1. ./src/myapp.app.src
  2. _build/default/lib/myapp/ebin/myapp.app (rebar3 hex publish must ensure the app is compiled in this case)
  3. ebin/myapp.app (perhaps only if it is checked in or not ignored by VCSes? This could be tricky to support though)
tsloughter commented 4 years ago

That is fixed in the latest rebar3 master and 3.14 rc releases.

Finally realized we could just build checkouts to _build/<profile>/checkouts and that's what we did.

eproxus commented 4 years ago

Wow, nice! 🎉