From 8d49f08a11da8314cd999f9a03af62ef018595c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 22 Oct 2015 12:21:29 +0200 Subject: Use relative path to erlang.mk file in autopatched deps --- core/deps.mk | 5 +++-- test/core_deps.mk | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 56 insertions(+), 4 deletions(-) diff --git a/core/deps.mk b/core/deps.mk index 7d991b0..b9ddfab 100644 --- a/core/deps.mk +++ b/core/deps.mk @@ -122,7 +122,8 @@ endef # Overwrite erlang.mk with the current file by default. ifeq ($(NO_AUTOPATCH_ERLANG_MK),) define dep_autopatch_erlang_mk - echo "include $(ERLANG_MK_FILENAME)" > $(DEPS_DIR)/$(1)/erlang.mk + echo "include $(call core_relpath,$(dir $(ERLANG_MK_FILENAME)),$(DEPS_DIR)/app)/erlang.mk" \ + > $(DEPS_DIR)/$1/erlang.mk endef else define dep_autopatch_erlang_mk @@ -414,7 +415,7 @@ define dep_autopatch_rebar.erl end, [PortSpec(S) || S <- PortSpecs] end, - Write("\ninclude $(ERLANG_MK_FILENAME)"), + Write("\ninclude $(call core_relpath,$(dir $(ERLANG_MK_FILENAME)),$(DEPS_DIR)/app)/erlang.mk"), RunPlugin = fun(Plugin, Step) -> case erlang:function_exported(Plugin, Step, 2) of false -> ok; diff --git a/test/core_deps.mk b/test/core_deps.mk index e2e5be7..dfeb328 100644 --- a/test/core_deps.mk +++ b/test/core_deps.mk @@ -1,16 +1,22 @@ # Core: Packages and dependencies. -CORE_DEPS_CASES = apps apps-conflict apps-deep-conflict apps-dir apps-new-app apps-new-lib apps-new-tpl apps-only build-c-8cc build-c-imagejs build-erl build-js dep-commit dir doc fetch-cp fetch-custom fetch-fail-bad fetch-fail-unknown fetch-git fetch-hex fetch-hg fetch-legacy fetch-svn ignore no-autopatch no-autopatch-erlang-mk no-autopatch-rebar order-first order-top otp pkg rel search shell skip test +CORE_DEPS_CASES = apps apps-conflict apps-deep-conflict apps-dir apps-new-app apps-new-lib apps-new-tpl apps-only build-c-8cc build-c-imagejs build-erl build-js dep-commit dir doc fetch-cp fetch-custom fetch-fail-bad fetch-fail-unknown fetch-git fetch-hex fetch-hg fetch-legacy fetch-svn ignore mv mv-rebar no-autopatch no-autopatch-erlang-mk no-autopatch-rebar order-first order-top otp pkg rel search shell skip test CORE_DEPS_TARGETS = $(addprefix core-deps-,$(CORE_DEPS_CASES)) CORE_DEPS_CLEAN_TARGETS = $(addprefix clean-,$(CORE_DEPS_TARGETS)) .PHONY: core-deps $(CORE_DEPS_TARGETS) clean-core-deps $(CORE_DEPS_CLEAN_TARGETS) -clean-core-deps: $(CORE_DEPS_CLEAN_TARGETS) +clean-core-deps: $(CORE_DEPS_CLEAN_TARGETS) clean-core-deps-mv-moved clean-core-deps-mv-rebar-moved $(CORE_DEPS_CLEAN_TARGETS): $t rm -rf $(APP_TO_CLEAN)/ +clean-core-deps-mv-moved: + $t rm -rf core_deps_mv-moved/ + +clean-core-deps-mv-rebar-moved: + $t rm -rf core_deps_mv_rebar-moved/ + core-deps: $(CORE_DEPS_TARGETS) core-deps-apps: build clean-core-deps-apps @@ -839,6 +845,51 @@ endif $i "Check that the correct dependencies were fetched" $t test -d $(APP)/deps/ranch +core-deps-mv: build clean-core-deps-mv clean-core-deps-mv-moved + + $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 Cowlib to the list of dependencies" + $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/Makefile + + $i "Build the application" + $t $(MAKE) -C $(APP) $v + + $i "Check that all dependencies were fetched" + $t test -d $(APP)/deps/cowlib + + $i "Move the application elsewhere" + $t mv $(APP) $(APP)-moved + + $i "Build the application" + $t $(MAKE) -C $(APP)-moved $v + +core-deps-mv-rebar: build clean-core-deps-mv-rebar clean-core-deps-mv-rebar-moved + + $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 Lager to the list of dependencies" + $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = lager\n"}' $(APP)/Makefile + + $i "Build the application" + $t $(MAKE) -C $(APP) $v + + $i "Check that all dependencies were fetched" + $t test -d $(APP)/deps/goldrush + $t test -d $(APP)/deps/lager + + $i "Move the application elsewhere" + $t mv $(APP) $(APP)-moved + + $i "Build the application" + $t $(MAKE) -C $(APP)-moved $v + # 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