From 608f6a85ad68a7bbd9140fcd0258161689612df0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 24 Sep 2015 17:46:32 +0200 Subject: Add tests for IGNORE_DEPS Fix IGNORE_DEPS not being propagated downward. Fix IGNORE_DEPS handling with autopatched Rebar projects, where the user defined value was overriden with the one from autopatching. --- core/deps.mk | 3 ++- test/core_deps.mk | 36 +++++++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/core/deps.mk b/core/deps.mk index 91c42f9..814e7db 100644 --- a/core/deps.mk +++ b/core/deps.mk @@ -6,6 +6,7 @@ # Configuration. IGNORE_DEPS ?= +export IGNORE_DEPS DEPS_DIR ?= $(CURDIR)/deps export DEPS_DIR @@ -160,7 +161,7 @@ define dep_autopatch_rebar.erl Escape = fun (Text) -> re:replace(Text, "\\\\$$$$", "\$$$$$$$$", [global, {return, list}]) end, - Write("IGNORE_DEPS = edown eper eunit_formatters meck node_package " + Write("IGNORE_DEPS += edown eper eunit_formatters meck node_package " "rebar_lock_deps_plugin rebar_vsn_plugin reltool_util\n"), Write("C_SRC_DIR = /path/do/not/exist\n"), Write("DRV_CFLAGS = -fPIC\nexport DRV_CFLAGS\n"), diff --git a/test/core_deps.mk b/test/core_deps.mk index bac2cf7..da801f4 100644 --- a/test/core_deps.mk +++ b/test/core_deps.mk @@ -1,6 +1,6 @@ # Core: Packages and dependencies. -CORE_DEPS_CASES = build-c-8cc build-c-imagejs build-erl build-js dep-commit doc fetch-cp fetch-custom fetch-fail-bad fetch-fail-unknown fetch-git fetch-hex fetch-hg fetch-legacy fetch-svn order-first order-top otp pkg rel search shell test +CORE_DEPS_CASES = build-c-8cc build-c-imagejs build-erl build-js dep-commit doc fetch-cp fetch-custom fetch-fail-bad fetch-fail-unknown fetch-git fetch-hex fetch-hg fetch-legacy fetch-svn ignore order-first order-top otp pkg rel search shell test CORE_DEPS_TARGETS = $(addprefix core-deps-,$(CORE_DEPS_CASES)) CORE_DEPS_CLEAN_TARGETS = $(addprefix clean-,$(CORE_DEPS_TARGETS)) @@ -457,6 +457,40 @@ endif {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \ halt()" +core-deps-ignore: build clean-core-deps-ignore + + $i "Bootstrap a new OTP library named $(APP)" + $t mkdir $(APP)/ + $t cp ../erlang.mk $(APP)/ + $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v + + $i "Add Cowboy to dependencies, Ranch to the ignore list and to test dependencies" + $t sed -i.bak '2i\ +DEPS = cowboy\ +IGNORE_DEPS = ranch\ +TEST_DEPS = ranch\ +' $(APP)/Makefile + +ifdef LEGACY + $i "Add Cowboy to the applications key in the .app.src file" + $t sed -i.bak '8i\ + cowboy,' $(APP)/src/$(APP).app.src +endif + + $i "Build the application" + $t $(MAKE) -C $(APP) $v + + $i "Check that the correct dependencies were fetched" + $t test -d $(APP)/deps/cowboy + $t test -d $(APP)/deps/cowlib + $t test ! -e $(APP)/deps/ranch + + $i "Build the test dependencies" + $t $(MAKE) -C $(APP) test-deps $v + + $i "Check that the correct dependencies were fetched" + $t test -d $(APP)/deps/ranch + # A lower-level dependency of the first dependency always # wins over a lower-level dependency of the second dependency. core-deps-order-first: build clean-core-deps-order-first -- cgit v1.2.3