From c1131f4f7420d009c8a05e5de9dd0888127aa0aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Fri, 25 Sep 2015 15:02:18 +0200 Subject: Fix error messages appearing when using parse transforms The errors were happening in the rebar.config generation code. In addition to the fix, three tests were added: a project that uses a pt from its own code with -compile directives, a project that uses a pt from a dep with the pt set as ERLC_OPTS, and the inclusion of parse transform options in the generated rebar.config when compatibility is desired. --- core/compat.mk | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'core/compat.mk') diff --git a/core/compat.mk b/core/compat.mk index bdf9a90..f936768 100644 --- a/core/compat.mk +++ b/core/compat.mk @@ -6,7 +6,9 @@ # We strip out -Werror because we don't want to fail due to # warnings when used as a dependency. -define compat_convert_erlc_opt +compat_prepare_erlc_opts = $(shell echo "$1" | sed 's/, */,/') + +define compat_convert_erlc_opts $(if $(filter-out -Werror,$1),\ $(if $(findstring +,$1),\ $(shell echo $1 | cut -b 2-))) @@ -15,7 +17,8 @@ endef define compat_rebar_config {deps, [$(call comma_list,$(foreach d,$(DEPS),\ {$(call dep_name,$d),".*",{git,"$(call dep_repo,$d)","$(call dep_commit,$d)"}}))]}. -{erl_opts, [$(call comma_list,$(foreach o,$(ERLC_OPTS),$(call compat_convert_erlc_opt,$o)))]}. +{erl_opts, [$(call comma_list,$(foreach o,$(call compat_prepare_erlc_opts,$(ERLC_OPTS)),\ + $(call compat_convert_erlc_opts,$o)))]}. endef $(eval _compat_rebar_config = $$(compat_rebar_config)) -- cgit v1.2.3