From 7edc30ad40cd5dc033bc8f0e914b951abf6d0527 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Tue, 25 Feb 2020 15:51:34 +0100 Subject: Add the query-deps family of targets The query-deps, query-doc-deps, query-rel-deps, query-test-deps and query-shell-deps targets go through dependencies and print some information about them: $ make query-deps ... cowboy: cowlib git https://github.com/ninenines/cowlib 2.7.3 cowboy: ranch git https://github.com/ninenines/ranch 1.7.1 $ make query-deps QUERY="name repo version absolute_path" ... cowboy: cowlib https://github.com/ninenines/cowlib 2.7.3 /path/to/deps/cowlib cowboy: ranch https://github.com/ninenines/ranch 1.7.1 /path/to/deps/ranch The query-deps target is recursive; the others aren't. This mirrors the behavior when fetching and building dependencies. The full list of options is: QUERY="fetch_method name repo version extra absolute_path" When an option has no corresponding value, "-" will be printed. For example most fetch methods do not have extra information to print. When there is extra information, the value will be prefixed with a descriptive name. For example: package-name=uuid_erl This commit also introduces changes to deps handling: some of the functions for querying will now be used directly. In the future the goal is to remove the old dep_name, dep_commit, etc. functions and replace their usage with the new query functions. Custom fetch methods should implement query functions in order to have information about the relevant dependencies printed properly. --- doc/src/guide/deps.asciidoc | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'doc/src') diff --git a/doc/src/guide/deps.asciidoc b/doc/src/guide/deps.asciidoc index 11f09fa..066a3d8 100644 --- a/doc/src/guide/deps.asciidoc +++ b/doc/src/guide/deps.asciidoc @@ -180,6 +180,7 @@ The following table lists all existing methods: | hex | hex version [pkg] | Download the given project version from hex.pm | fail | N/A | Always fail, reserved for internal use | legacy | N/A | Legacy Erlang.mk fetcher, reserved for internal use +| default | N/A | Reserved |=== The `git` and `hg` methods both have a repository and commit. @@ -369,6 +370,47 @@ of those files directly instead. The reason is that `make fetch-*` and `make list-*` may have unwanted content in their output, such as actual fetching of dependencies. +=== Querying dependencies + +You can obtain information about all dependencies with +the `make query-deps` family of commands: + +* `make query-deps` will list dependencies found in `BUILD_DEPS` + and `DEPS` recursively. +* `make query-doc-deps` will list documentation dependencies + of the current project. +* `make query-rel-deps` will list release dependencies + of the current project. +* `make query-shell-deps` will list shell dependencies + of the current project. +* `make query-test-deps` will list test dependencies + of the current project. + +By default the information printed will be the dependency name, +fetch method, repository and version, prefixed by the current +project's name. But this output can be customized via the +variable `QUERY`: + +[source,bash] +$ make query-deps QUERY="name fetch_method repo version extra absolute_path" + +The following options are available: + +name:: The dependency name. +fetch_method:: The dependency's fetch method. +repo:: The dependency's repository. +version:: The dependency's version, tag or commit. +extra:: Any additional information specific to the fetch method used. +absolute_path:: The dependency's location after it has been fetched. + +Fields that have no value will print `-`. For example +not all fetch methods have a value for the `version`. + +The value for `extra`, when available, will be formatted +with the name of the information printed prefixed. For +example the hex fetch method will add +`package-name=uuid_erl` for the `uuid` application. + === Ignoring unwanted dependencies Sometimes, you may want to ignore dependencies entirely. -- cgit v1.2.3