From 9f89dd73fc478cbd688245b785c627a18af0f20f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Date: Mon, 17 Jun 2019 15:35:10 +0200 Subject: Include applications `$(APPS_DIR)` in the `list-deps` targets In the case of a multi-applications repository, if one application depends on another one (using `$(LOCAL_DEPS)`), it will now be listed in the `list-deps` targets. Add `ssl` to the `$(LOCAL_DEPS)` in the testcase to ensure that applications not in `$(APPS_DIR)` are not affected by this change. Add a changelog entry. --- CHANGELOG.asciidoc | 3 +++ core/deps-tools.mk | 10 ++++----- test/core_deps.mk | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 27e48cd..d8933ef 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -10,3 +10,6 @@ 2018/12/06: Change the default COVER_DATA_DIR to be the same as COVER_REPORT_DIR. + +2019/06/20: `list-deps` now includes local applications + found in the `APPS_DIR` directory. diff --git a/core/deps-tools.mk b/core/deps-tools.mk index 174e09b..2b6877a 100644 --- a/core/deps-tools.mk +++ b/core/deps-tools.mk @@ -32,11 +32,11 @@ else # # $(ALL_DEPS_DIRS) includes $(BUILD_DEPS). -$(ERLANG_MK_RECURSIVE_DEPS_LIST): $(ALL_DEPS_DIRS) -$(ERLANG_MK_RECURSIVE_DOC_DEPS_LIST): $(ALL_DEPS_DIRS) $(ALL_DOC_DEPS_DIRS) -$(ERLANG_MK_RECURSIVE_REL_DEPS_LIST): $(ALL_DEPS_DIRS) $(ALL_REL_DEPS_DIRS) -$(ERLANG_MK_RECURSIVE_TEST_DEPS_LIST): $(ALL_DEPS_DIRS) $(ALL_TEST_DEPS_DIRS) -$(ERLANG_MK_RECURSIVE_SHELL_DEPS_LIST): $(ALL_DEPS_DIRS) $(ALL_SHELL_DEPS_DIRS) +$(ERLANG_MK_RECURSIVE_DEPS_LIST): $(LOCAL_DEPS_DIRS) $(ALL_DEPS_DIRS) +$(ERLANG_MK_RECURSIVE_DOC_DEPS_LIST): $(LOCAL_DEPS_DIRS) $(ALL_DEPS_DIRS) $(ALL_DOC_DEPS_DIRS) +$(ERLANG_MK_RECURSIVE_REL_DEPS_LIST): $(LOCAL_DEPS_DIRS) $(ALL_DEPS_DIRS) $(ALL_REL_DEPS_DIRS) +$(ERLANG_MK_RECURSIVE_TEST_DEPS_LIST): $(LOCAL_DEPS_DIRS) $(ALL_DEPS_DIRS) $(ALL_TEST_DEPS_DIRS) +$(ERLANG_MK_RECURSIVE_SHELL_DEPS_LIST): $(LOCAL_DEPS_DIRS) $(ALL_DEPS_DIRS) $(ALL_SHELL_DEPS_DIRS) # Allow to use fetch-deps and $(DEP_TYPES) to fetch multiple types of # dependencies with a single target. diff --git a/test/core_deps.mk b/test/core_deps.mk index d6ff706..87f9855 100644 --- a/test/core_deps.mk +++ b/test/core_deps.mk @@ -825,6 +825,66 @@ dep_shelldep = git file://$(abspath $(APP)_shelldep) master\ $t cmp $(APP)/expected-all-deps.txt $(APP)/.erlang.mk/recursive-deps-list.log $t $(MAKE) -C $(APP) --no-print-directory distclean $v +core-deps-list-deps-with-apps: init + +# We pass $(MAKE) directly so that GNU Make can pass its context forward. +# If we didn't then $(MAKE) would be expanded in the call without context. + $(call add_dep_and_subdep,,$(MAKE)) + + $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 "Bootstrap another APP named $(APP)_app in $(APP) repository" + $t $(MAKE) -C $(APP) --no-print-directory new-lib in=my_app $v + + $i "Bootstrap another APP named $(APP)_dep_app in $(APP)_dep repository" + $t $(MAKE) -C $(APP)_dep --no-print-directory new-lib in=my_dep_app $v + $t sed -i.bak '2i\ +APPS_DIR := $$(CURDIR)/apps\ +LOCAL_DEPS = my_dep_app ssl\ +' $(APP)_dep/Makefile + $t echo 'unexport APPS_DIR' >> $(APP)_dep/Makefile + $t rm $(APP)_dep/Makefile.bak + $t git -C $(APP)_dep add . + $t git -C $(APP)_dep commit -q --no-gpg-sign -m "Add application" + + $i "Add $(APP)-dep as a dependency" + $t sed -i.bak '2i\ +DEPS = dep\ +dep_dep = git file://$(abspath $(APP)_dep) master\ +' $(APP)/Makefile + $t rm $(APP)/Makefile.bak + + $i "Create a Git repository for $(APP)" + $t (cd $(APP) && \ + git init -q && \ + git config user.name "Testsuite" && \ + git config user.email "testsuite@erlang.mk" && \ + git add . && \ + git commit -q --no-gpg-sign -m "Initial commit") + + $i "List application dependencies ($(APP)_app is missing)" + $t $(MAKE) -C $(APP) --no-print-directory list-deps $v + $t test -d $(APP)/deps/subdep + $t printf "%s\n%s\n%s\n" $(abspath $(APP)/deps/dep $(APP)/deps/dep/apps/my_dep_app $(APP)/deps/subdep) > $(APP)/expected-deps.txt + $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/recursive-deps-list.log + $t $(MAKE) -C $(APP) --no-print-directory distclean $v + + $i "Add $(APP)_app as a dependency" + $t sed -i.bak '3i\ +LOCAL_DEPS = my_app\ +' $(APP)/Makefile + $t rm $(APP)/Makefile.bak + + $i "List application dependencies ($(APP)_app is listed)" + $t $(MAKE) -C $(APP) --no-print-directory list-deps $v + $t test -d $(APP)/deps/subdep + $t printf "%s\n%s\n%s\n%s\n" $(abspath $(APP)/apps/my_app $(APP)/deps/dep $(APP)/deps/dep/apps/my_dep_app $(APP)/deps/subdep) > $(APP)/expected-deps.txt + $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/recursive-deps-list.log + $t $(MAKE) -C $(APP) --no-print-directory distclean $v + core-deps-makefile-change: init $i "Bootstrap a new OTP application named $(APP)" -- cgit v1.2.3