Browse Source

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.
Loïc Hoguin 9 years ago
parent
commit
608f6a85ad
2 changed files with 37 additions and 2 deletions
  1. 2 1
      core/deps.mk
  2. 35 1
      test/core_deps.mk

+ 2 - 1
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"),

+ 35 - 1
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