diff options
author | Jean-Sébastien Pédron <[email protected]> | 2015-09-14 13:34:25 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2016-10-25 14:55:55 +0300 |
commit | 2bc4ffab95db4ac38a0424d565590d68f7078aba (patch) | |
tree | 2562d5be6dc848825a96748b2c8bb2ea46703416 /test/core_deps.mk | |
parent | 2a06471461076f4ec9b1eeceb739429ba5142221 (diff) | |
download | erlang.mk-2bc4ffab95db4ac38a0424d565590d68f7078aba.tar.gz erlang.mk-2bc4ffab95db4ac38a0424d565590d68f7078aba.tar.bz2 erlang.mk-2bc4ffab95db4ac38a0424d565590d68f7078aba.zip |
core/deps-tools.mk: New targets `fetch-deps` and `list-deps`
.. to fetch and list deps recurvively.
Therefore, they work on direct dependencies, dependencies' dependencies,
and so on. Nothing is built with those targets.
The following targets are also available to work on other kinds of
dependencies:
make fetch-doc-deps
make fetch-rel-deps
make fetch-test-deps
make fetch-shell-deps
make list-doc-deps
make list-rel-deps
make list-test-deps
make list-shell-deps
In all cases, they include "normal" and eg. "test" dependencies of the
top-level project, then only "normal" dependencies' dependencies.
It's possible to include several kinds in one go:
make fetch-deps DEP_TYPES='doc test'
make list-deps DEP_TYPES='doc test'
As it may be difficult to use the output of `make list-*` because
the list could appear after other targets output (like dependencies
fetching), the list is available in files pointed by the following
variables:
$(ERLANG_MK_RECURSIVE_DEPS_LIST)
$(ERLANG_MK_RECURSIVE_DOC_DEPS_LIST)
$(ERLANG_MK_RECURSIVE_REL_DEPS_LIST)
$(ERLANG_MK_RECURSIVE_TEST_DEPS_LIST)
$(ERLANG_MK_RECURSIVE_SHELL_DEPS_LIST)
Internally, `list-deps` is simply implemented on top of `fetch-deps`:
the latter fills a sorted log with all the directories it traversed.
`list-deps` finally just prints the log file to stdout.
Fixes #560.
Diffstat (limited to 'test/core_deps.mk')
-rw-r--r-- | test/core_deps.mk | 137 |
1 files changed, 136 insertions, 1 deletions
diff --git a/test/core_deps.mk b/test/core_deps.mk index 767b66b..b89b885 100644 --- a/test/core_deps.mk +++ b/test/core_deps.mk @@ -1,6 +1,6 @@ # Core: Packages and dependencies. -CORE_DEPS_CASES = apps apps-build-count apps-conflict apps-deep-conflict apps-dir apps-dir-include-lib apps-new-app apps-new-lib apps-new-tpl apps-only autopatch-rebar 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-git-submodule 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_CASES = apps apps-build-count apps-conflict apps-deep-conflict apps-dir apps-dir-include-lib apps-new-app apps-new-lib apps-new-tpl apps-only autopatch-rebar 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-git-submodule fetch-hex fetch-hg fetch-legacy fetch-svn ignore list-deps 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)) .PHONY: core-deps $(CORE_DEPS_TARGETS) @@ -983,6 +983,141 @@ endif $i "Check that the correct dependencies were fetched" $t test -d $(APP)/deps/ranch +define add_dep_and_subdep + $i "Bootstrap a new OTP library named $(APP)-$(1)subdep" + $t mkdir $(APP)-$(1)subdep/ + $t cp ../erlang.mk $(APP)-$(1)subdep/ + $t $(MAKE) -C $(APP)-$(1)subdep --no-print-directory -f erlang.mk bootstrap-lib $$v + + $i "Create a Git repository for $(APP)-$(1)subdep" + $t (cd $(APP)-$(1)subdep && \ + git init -q && \ + git config user.name "Testsuite" && \ + git config user.email "[email protected]" && \ + git add . && \ + git commit -q -m "Initial commit") + + $i "Bootstrap a new OTP library named $(APP)-$(1)dep" + $t mkdir $(APP)-$(1)dep/ + $t cp ../erlang.mk $(APP)-$(1)dep/ + $t $(MAKE) -C $(APP)-$(1)dep --no-print-directory -f erlang.mk bootstrap-lib $$v + + $i "Add $(APP)-$(1)subdep as a dependency" + $t perl -ni.bak -e \ + 'print;if ($$.==1) {print "DEPS = $(1)subdep\ndep_$(1)subdep = git file://$(abspath $(APP)-$(1)subdep) master\n"}' \ + $(APP)-$(1)dep/Makefile + $t rm $(APP)-$(1)dep/Makefile.bak + + $i "Create a Git repository for $(APP)-$(1)dep" + $t (cd $(APP)-$(1)dep && \ + git init -q && \ + git config user.name "Testsuite" && \ + git config user.email "[email protected]" && \ + git add . && \ + git commit -q -m "Initial commit") +endef + +core-deps-list-deps: build clean + + $(call add_dep_and_subdep,) + $(call add_dep_and_subdep,doc) + $(call add_dep_and_subdep,rel) + $(call add_dep_and_subdep,test) + $(call add_dep_and_subdep,shell) + + $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 $(APP)-dep and $(APP)-testdep as a dependency" + $t sed -i.bak '2i\ +DEPS = dep\ +DOC_DEPS = docdep\ +REL_DEPS = reldep\ +TEST_DEPS = testdep\ +SHELL_DEPS = shelldep\ +dep_dep = git file://$(abspath $(APP)-dep) master\ +dep_docdep = git file://$(abspath $(APP)-docdep) master\ +dep_reldep = git file://$(abspath $(APP)-reldep) master\ +dep_testdep = git file://$(abspath $(APP)-testdep) master\ +dep_shelldep = git file://$(abspath $(APP)-shelldep) 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 -m "Initial commit") + + $i "List application dependencies" + $t $(MAKE) -C $(APP) --no-print-directory list-deps $v + $t test -d $(APP)/deps/subdep + $t printf "%s\n%s\n" $(abspath $(APP)/deps/dep $(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 "List application doc dependencies" + $t $(MAKE) -C $(APP) --no-print-directory list-doc-deps $v + $t test -d $(APP)/deps/subdep + $t test -d $(APP)/deps/docsubdep + $t printf "%s\n%s\n%s\n%s\n" \ + $(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/docdep $(APP)/deps/docsubdep) \ + | sort > $(APP)/expected-doc-deps.txt + $t cmp $(APP)/expected-doc-deps.txt $(APP)/.erlang.mk/recursive-doc-deps-list.log + $t $(MAKE) -C $(APP) --no-print-directory distclean $v + + $i "List application rel dependencies" + $t $(MAKE) -C $(APP) --no-print-directory list-rel-deps $v + $t test -d $(APP)/deps/subdep + $t test -d $(APP)/deps/relsubdep + $t printf "%s\n%s\n%s\n%s\n" \ + $(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/reldep $(APP)/deps/relsubdep) \ + | sort > $(APP)/expected-rel-deps.txt + $t cmp $(APP)/expected-rel-deps.txt $(APP)/.erlang.mk/recursive-rel-deps-list.log + $t $(MAKE) -C $(APP) --no-print-directory distclean $v + + $i "List application test dependencies" + $t $(MAKE) -C $(APP) --no-print-directory list-test-deps $v + $t test -d $(APP)/deps/subdep + $t test -d $(APP)/deps/testsubdep + $t printf "%s\n%s\n%s\n%s\n" \ + $(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/testdep $(APP)/deps/testsubdep) \ + | sort > $(APP)/expected-test-deps.txt + $t cmp $(APP)/expected-test-deps.txt $(APP)/.erlang.mk/recursive-test-deps-list.log + $t $(MAKE) -C $(APP) --no-print-directory distclean $v + + $i "List application shell dependencies" + $t $(MAKE) -C $(APP) --no-print-directory list-shell-deps $v + $t test -d $(APP)/deps/subdep + $t test -d $(APP)/deps/shellsubdep + $t printf "%s\n%s\n%s\n%s\n" \ + $(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/shelldep $(APP)/deps/shellsubdep) \ + | sort > $(APP)/expected-shell-deps.txt + $t cmp $(APP)/expected-shell-deps.txt $(APP)/.erlang.mk/recursive-shell-deps-list.log + $t $(MAKE) -C $(APP) --no-print-directory distclean $v + + $i "List application all dependencies (all kinds)" + $t $(MAKE) -C $(APP) --no-print-directory list-deps DEP_TYPES='doc rel test shell' $v + $t test -d $(APP)/deps/subdep + $t test -d $(APP)/deps/docsubdep + $t test -d $(APP)/deps/relsubdep + $t test -d $(APP)/deps/testsubdep + $t test -d $(APP)/deps/shellsubdep + $t printf "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n" \ + $(abspath \ + $(APP)/deps/dep $(APP)/deps/subdep \ + $(APP)/deps/docdep $(APP)/deps/docsubdep \ + $(APP)/deps/reldep $(APP)/deps/relsubdep \ + $(APP)/deps/testdep $(APP)/deps/testsubdep \ + $(APP)/deps/shelldep $(APP)/deps/shellsubdep) \ + | sort > $(APP)/expected-all-deps.txt + $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-mv: build clean $i "Bootstrap a new OTP library named $(APP)" |