erlef / rebar3_hex

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

Running `rebar3 hex publish` outside a project creates empty rebar.lock #234

Closed eproxus closed 2 years ago

eproxus commented 3 years ago

If you run rebar3 hex publish in a directory that is not a Rebar/Erlang application, it will create an empty rebar.lock file:

$ cd /tmp
$rebar3 hex publish
===> Verifying dependencies...
Select application(s):
------------
A) All
[1-0] or (A)ll  ("A")> ^C
BREAK: (a)bort (A)bort with dump (c)ontinue (p)roc info (i)nfo
       (l)oaded (v)ersion (k)ill (D)b-tables (d)istribution
^C⏎
$ cat rebar.lock
[].

The initial prompt is probably also wrong since there are no applications to select from in the first place.

tsloughter commented 3 years ago

The lock will be unrelated. It'll need a fix in rebar3.

The hex plugin simply depends on certain rebar3 steps (providers) and they are called without any part of the hex plugin running before them.

But the publish should definitely abort if no apps are found. I'm guessing it is just checking if [App] is the match and forgetting about [].

eproxus commented 3 years ago

@tsloughter Do you want me to open an issues on Rebar 3?

tsloughter commented 3 years ago

Yea. There might already been one, this is something I've wanted to fix for a while.

ferd commented 3 years ago

I think rebar3 always locks dependencies, even when there are none found.. running it outside of a project just makes teh whole deps scan return "no deps found or declared" (since there's no rebar.config file) and a lockfile is still created.

starbelly commented 2 years ago

https://github.com/erlang/rebar3/pull/2662