aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2024-11-13 12:42:45 +0100
committerLoïc Hoguin <[email protected]>2024-11-13 12:42:45 +0100
commit5ee44b11987671506ed2187622c2a70f4a2c6d70 (patch)
tree1f54e492673d39f72616a383ae87c3c1894987e3 /core
parentd3485e7eb64e16a1b482208bd1d7be24bfa58c43 (diff)
downloaderlang.mk-improve-rebar-config.tar.gz
erlang.mk-improve-rebar-config.tar.bz2
erlang.mk-improve-rebar-config.zip
Improve rebar.config generationimprove-rebar-config
We now provide the version as a tagged tuple indicating whether this is a branch, tag or ref. This should help rebar automatically upgrade dependencies, and remove an annoying warning when rebar is used. In order to detect the type of version the dependencies must be available, therefore the rebar.config target now depends on the deps target. To test this the Cowboy package version had to be changed from 1.0.4 to master. This is a breaking change, but I do not expect too many people to still use 1.0.4.
Diffstat (limited to 'core')
-rw-r--r--core/compat.mk6
1 files changed, 4 insertions, 2 deletions
diff --git a/core/compat.mk b/core/compat.mk
index 906faac..afba4f1 100644
--- a/core/compat.mk
+++ b/core/compat.mk
@@ -3,6 +3,8 @@
.PHONY: rebar.config
+compat_ref = {$(shell (git -C $(DEPS_DIR)/$1 show-ref -q --verify "refs/heads/$2" && echo branch) || (git -C $(DEPS_DIR)/$1 show-ref -q --verify "refs/tags/$2" && echo tag) || echo ref),"$2"}
+
# We strip out -Werror because we don't want to fail due to
# warnings when used as a dependency.
@@ -23,10 +25,10 @@ define compat_rebar_config
$(call comma_list,$(foreach d,$(DEPS),\
$(if $(filter hex,$(call dep_fetch,$d)),\
{$(call dep_name,$d)$(comma)"$(call dep_repo,$d)"},\
- {$(call dep_name,$d)$(comma)".*"$(comma){git,"$(call dep_repo,$d)"$(comma)"$(call dep_commit,$d)"}})))
+ {$(call dep_name,$d)$(comma)".*"$(comma){git,"$(call dep_repo,$d)"$(comma)$(call compat_ref,$(call dep_name,$d),$(call dep_commit,$d))}})))
]}.
{erl_opts, $(call compat_erlc_opts_to_list,$(ERLC_OPTS))}.
endef
-rebar.config:
+rebar.config: deps
$(gen_verbose) $(call core_render,compat_rebar_config,rebar.config)