Browse Source

Add skeleton compatibility for semver versions

For now, ~> is expanded to a full version only.
Loïc Hoguin 6 years ago
parent
commit
aaa94f3d42
1 changed files with 10 additions and 1 deletions
  1. 10 1
      core/deps.mk

+ 10 - 1
core/deps.mk

@@ -325,13 +325,22 @@ define dep_autopatch_rebar.erl
 				false
 		end
 	end,
+	SemVsn = fun
+		("~> " ++ S) ->
+			case length([ok || $$. <- S]) of
+				0 -> S ++ ".0.0";
+				1 -> S ++ ".0";
+				_ -> S
+			end;
+		(S) -> S
+	end,
 	fun() ->
 		File = case lists:keyfind(deps, 1, Conf) of
 			false -> [];
 			{_, Deps} ->
 				[begin case case Dep of
 							N when is_atom(N) -> GetHexVsn(N);
-							{N, S} when is_atom(N), is_list(S) -> {N, {hex, S}};
+							{N, S} when is_atom(N), is_list(S) -> {N, {hex, SemVsn(S)}};
 							{_, S, {pkg, N}} -> {N, {hex, S}};
 							{N, S} when is_tuple(S) -> {N, S};
 							{N, _, S} -> {N, S};