erlef / rebar3_hex

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

Always store an .app.src file in the package #128

Closed dumbbell closed 5 years ago

dumbbell commented 5 years ago

In pull request #116, the behavior changed a bit: the generated .app.src file was included in the package (the tar archive) only if one was already listed in the included files. Before this changed, the generated .app.src file was already prepended to that list.

Therefore, if the initial .app.src was missing from that list, no .app.src was added to the package.

This commit restores the previous behavior: the generated .app.src replaces the initial file or it is added (appended) to the list.

This solves an issue where Erlang.mk-based packages (which may not have an .app.src file on disk), published using this plugin to Hex.pm, were published successfully but were considered invalid when fetched as a dependency later:

===> Dependency failure: source for (...) does not contain a recognizable project and can not be built
tsloughter commented 5 years ago

@dumbbell oh, does rebar3_hex generate a .app.src file for erlang.mk files from the .app file? I guess this is fine, I'm just surprised it works :)

dumbbell commented 5 years ago

Yes. In fact, Erlang.mk does not provide a way to publish to Hex.pm out-of-the-box. So we developped a small tool (https://github.com/rabbitmq/hexpm-cli) to be able to use the rebar3_hex plugin outside of a full-blown Rebar 3 project. That escript embeds Rebar with a couple functions patched. This includes the path to the .app.src file which points to the generated .app file.

dumbbell commented 5 years ago

Thank you for merging this patch!

Could you please publish a new release of the plugin?

tsloughter commented 5 years ago

Can't you just use erlang.mk's support for generating a .app file in ebin?

I know it is more work than rabbit wants to take on when they spent the time moving to erlang.mk, and I'm sure you already thought of this and decided it was less work than supporting rebar3, but have to mention anyway that this will likely break at times. It looks small so probably less effort to keep it working than to support rebar3, just felt I should mention it :)

dumbbell commented 5 years ago

We use Erlang.mk's ability to generate the .app file. Btu when I tested, it was not enough to use Rebar out-of-the-box. Unfortunately, I don't remember what was missing or not working, leading to that tool embedding Rebar.

dumbbell commented 5 years ago

@tsloughter: Would it be possible to release a new version of the plugin with this fix? Is there anything I can do to help with this?

I'm asking because we can't publish new versions of the RabbitMQ Erlang client to Hex.pm currently.

Thank you very much!

tsloughter commented 5 years ago

@dumbbell yes, I want to test and merge #129 first. I will do that this morning and then cut a release.

dumbbell commented 5 years ago

Awesome! Thank you very much :-)

tsloughter commented 5 years ago

Published 6.8.0.