aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <[email protected]>2019-06-17 15:35:10 +0200
committerLoïc Hoguin <[email protected]>2019-06-21 12:33:19 +0200
commit9f89dd73fc478cbd688245b785c627a18af0f20f (patch)
tree77b72d2f9ef6c4679e498617be7a1354f79b63d7
parent39d29a33416b38f5d7f78f4bc9a64d2968aaa738 (diff)
downloaderlang.mk-9f89dd73fc478cbd688245b785c627a18af0f20f.tar.gz
erlang.mk-9f89dd73fc478cbd688245b785c627a18af0f20f.tar.bz2
erlang.mk-9f89dd73fc478cbd688245b785c627a18af0f20f.zip
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.
-rw-r--r--CHANGELOG.asciidoc3
-rw-r--r--core/deps-tools.mk10
-rw-r--r--test/core_deps.mk60
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 "[email protected]" && \
+ 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)"