Closed NicklasXYZ closed 3 years ago
If it is any help, this is the rebar.config
file I was using:
{erl_opts, [debug_info]}.
{src_dirs, ["src", "gen/src"]}.
{profiles, [
{test, [{src_dirs, ["src", "test", "gen/src", "gen/test"]}]}
]}.
{project_plugins, [rebar_gleam, rebar3_hex]}.
{deps, [
%% git dependencies
{gleam_stdlib, "", {git, "git://github.com/gleam-lang/stdlib.git", {branch, "main"}}}
]}.
@NicklasXYZ Thank you and that helps. As soon I get a few I will try to reproduce this. FWIW hex does allow there to be git deps, so I'm not sure if this problem is related to a git dep, but not sure it isn't completely unrelated either. What I am certain of and in agreement on, this is not helpful or friendly.
Can you tell me what version of rebar3_hex you are using? It may the problem you're encountering was fixed in a subsequent release...
Test example with no git dependency. Here I am at least prompted for a password and something gets published to hex: https://hex.pm/packages/test_package_nogit
In this example the rebar.config
file contains:
{erl_opts, [debug_info]}.
{src_dirs, ["src", "gen/src"]}.
{profiles, [
{test, [{src_dirs, ["src", "test", "gen/src", "gen/test"]}]}
]}.
{project_plugins, [rebar_gleam, rebar3_hex]}.
{deps, [
{gleam_stdlib, "0.14.0"}
]}.
This is the output when I try to publish:
(base) [nicklasxyz@nicklasxyz test_rebar3_hex]$ rebar3 version
rebar 3.14.4 on Erlang/OTP 23 Erts 11.1.8
(base) [nicklasxyz@nicklasxyz test_rebar3_hex]$ gleam new test_package_nogit && cd test_package_nogit
* creating test_package_nogit/.gitignore
* creating test_package_nogit/.github/workflows/test.yml
* creating test_package_nogit/README.md
* creating test_package_nogit/gleam.toml
* creating test_package_nogit/rebar.config
* creating test_package_nogit/src/test_package_nogit.app.src
* creating test_package_nogit/src/test_package_nogit.gleam
* creating test_package_nogit/test/test_package_nogit_test.gleam
Your Gleam project "test_package_nogit" has been successfully created.
The rebar3 program can be used to compile and test it.
cd test_package_nogit
rebar3 eunit
(base) [nicklasxyz@nicklasxyz test_package_nogit]$ rebar3 hex publish
===> Fetching rebar_gleam v0.1.0
===> Analyzing applications...
===> Compiling rebar_gleam
===> Fetching rebar3_hex v6.11.2
===> Fetching hex_core v0.7.1
===> Fetching verl v1.0.2
===> Analyzing applications...
===> Compiling verl
===> Compiling hex_core
===> Compiling rebar3_hex
===> Verifying dependencies...
===> Fetching gleam_stdlib v0.14.0
Publishing test_package_nogit 1.0.0 to hexpm
Description: A Gleam project
Dependencies:
gleam_stdlib 0.14.0
Included files:
README.md
gleam.toml
rebar.config
rebar.lock
src/test_package_nogit.app.src
src/test_package_nogit.gleam
Licenses: Apache 2.0
Links:
Build tools: rebar3
Be aware, you are publishing to the public Hexpm repository.
Before publishing, please read Hex CoC: https://hex.pm/policies/codeofconduct
Proceed? ("Y")> y
Local Password:
===> Published test_package_nogit 1.0.0
===> No valid hex docs configuration found. Docs will will not be generated
===> Docs were not published since they couldn't be found in '/home/nicklasxyz/Desktop/test_rebar3_hex/test_package_nogit/doc'. Please build the docs and then run `rebar3 hex docs` to publish them.
(base) [nicklasxyz@nicklasxyz test_package_nogit]$
In this example the error message occurs and I have added the following to the rebar.config
file:
{erl_opts, [debug_info]}.
{src_dirs, ["src", "gen/src"]}.
{profiles, [
{test, [{src_dirs, ["src", "test", "gen/src", "gen/test"]}]}
]}.
{project_plugins, [rebar_gleam, rebar3_hex]}.
{deps, [
%% git dependencies
{gleam_stdlib, "", {git, "git://github.com/gleam-lang/stdlib.git", {branch, "main"}}}
]}.
This is the output when I try to publish:
(base) [nicklasxyz@nicklasxyz test_rebar3_hex]$ rebar3 version
rebar 3.14.4 on Erlang/OTP 23 Erts 11.1.8
(base) [nicklasxyz@nicklasxyz test_rebar3_hex]$ gleam new test_package_withgit && cd test_package_withgit
* creating test_package_withgit/.gitignore
* creating test_package_withgit/.github/workflows/test.yml
* creating test_package_withgit/README.md
* creating test_package_withgit/gleam.toml
* creating test_package_withgit/rebar.config
* creating test_package_withgit/src/test_package_withgit.app.src
* creating test_package_withgit/src/test_package_withgit.gleam
* creating test_package_withgit/test/test_package_withgit_test.gleam
Your Gleam project "test_package_withgit" has been successfully created.
The rebar3 program can be used to compile and test it.
cd test_package_withgit
rebar3 eunit
(base) [nicklasxyz@nicklasxyz test_package_withgit]$ rebar3 hex publish
===> Fetching rebar3_hex v6.11.2
===> Fetching hex_core v0.7.1
===> Fetching verl v1.0.2
===> Analyzing applications...
===> Compiling verl
===> Compiling hex_core
===> Compiling rebar3_hex
===> Verifying dependencies...
===> Fetching gleam_stdlib (from {git,"git://github.com/gleam-lang/stdlib.git",
{branch,"main"}})
===> Uncaught error in rebar_core. Run with DIAGNOSTIC=1 to see stacktrace or consult rebar3.crashdump
===> When submitting a bug report, please include the output of `rebar3 report "your command"`
(base) [nicklasxyz@nicklasxyz test_package_withgit]$
The two projects directories can be found here: test_packages.zip
These are the plugins (rebar3_hex included):
--- Local plugins ---
rebar_gleam (0.1.0)
rebar3_hex (6.11.2)
I see the issue. A fix is on the way @NicklasXYZ .
Awesome :+1:
The good news is you'll get a friendly error message, the bad news is no, we don't allow publishing when the thing in question depends on a git dep, which now that my head is in the space again, makes perfect sense.
Yeah, I figured that out in the end by reading through the docs a bit more closely, which yeah, makes sense. I kinda jumped head first into this whole ecosystem and I can imagine some one else might do the same. At least they will not have to wonder what they are doing wrong in this case now :+1:
@NicklasXYZ I vastly you appreciate you opening this. UX is very important and it's something we're trying to get better at, one bug ticket at a time 😁
You're welcome :)!
That was fast! Nice one @starbelly
Hello, I hope someone can help :)
Specifying a git dependency in the
rebar.config
results in an error message that is not very understandable/user-friendly.Environment
rebar3 report
to your message:Current behaviour
Describe the current behaviour. In case of a failure, crash, or exception, please include the result of running the command with debug information:
It seems like rebar3 just crashes without much useful information.
Expected behaviour
Error that git dependency can not be used with Hex.