ninenines / erlang.mk

A build tool for Erlang that just works.
https://erlang.mk
ISC License
578 stars 241 forks source link

Crash release when `Erlang.mk` project has dependency builded and use `SemVer` VSN #993

Open vkatsuba opened 8 months ago

vkatsuba commented 8 months ago

When Erlang.mk encounters a dependency on a rebar3 project that utilizes Semantic Versioning (SemVer) in its vsn (version) during the release-making process, an issue arises. The problem occurs because when Erlang.mk identifies a SemVer, the tag is not properly inserted into the application list, resulting in a structure like:

{cowboy, "2.10.0"}
{my_semver_deps}
...

This leads to a crash during the make rel operation. The documentation for git and SemVer, as outlined in http://rebar3.org/docs/basic_usage/#adding-dependencies, provides relevant information on handling dependencies with SemVer in rebar3 projects. I didn't check - but I suppose same issue can be when used atom git in vsn. To reproduce this issue the rebar3 project should have in *.spp.src:

{application, my_semver_deps, [
    {vsn, semver},
    ....
]}.

And in rebar.config:

{relx, [
             {release, {my_semver_deps, semver }, [my_semver_deps]},
         ....
]}.
vkatsuba commented 8 months ago

Maybe can be added something like:

# Get the name of the latest tag
tag=$(git describe --tags --abbrev=0)

# Extract SemVer from the tag
semver=$(echo "$tag" | grep -oP 'v?\K\d+\.\d+\.\d+')

# Print the extracted SemVer
echo "SemVer: $semver"

SemVer: 1.0.1

To https://github.com/ninenines/erlang.mk/blob/master/plugins/relx.mk#L59 - https://github.com/ninenines/erlang.mk/blob/master/plugins/relx.mk#L74 or maybe can be find better approach.

essen commented 8 months ago

Should be done during autopatch around here https://github.com/ninenines/erlang.mk/blob/master/core/deps.mk#L450-L457