Libdeps is a subsystem within the build, which is centered around the LIBrary DEPendency graph. It tracks and maintains the dependency graph as well as lints, analyzes and provides useful metrics about the graph.
#### Different `LIBDEPS` variable types
The `LIBDEPS` variables are how the library relationships are defined within the build scripts. The primary variables are as follows:
*`LIBDEPS`:
The 'public' type which propagates lower level dependencies onward automatically.
*`LIBDEPS_PRIVATE`:
Creates a dependency only between the target and the dependency.
*`LIBDEPS_INTERFACE`:
Same as `LIBDEPS` but excludes itself from the propagation onward.
*`LIBDEPS_DEPENDENTS`:
Creates a reverse `LIBDEPS_PRIVATE` dependency where the dependency is the one declaring the relationship.
*`PROGDEPS_DEPENDENTS`:
Same as `LIBDEPS_DEPENDENTS` but for use with Program builders.
Libraries are added to these variables as lists per each SCons builder instance in the SConscripts depending on what type of relationship is needed. For more detailed information on theses types, refer to [`The LIBDEPS variables`](build_system_reference.md#the-libdeps-variables)
The libdeps subsystem is capable of linting and automatically detecting issues. Some of these linting rules are automatically checked during build-time (while the SConscripts are read and the build is performed) while others need to be manually run post-build (after the the generated graph file has been built). Some rules will include exemption tags which can be added to a libraries `LIBDEPS_TAGS` to override a rule for that library.
The build-time linter also has a print option `--libdeps-linting=print` which will print all issues without failing the build and ignoring exemption tags. This is useful for getting an idea of what issues are currently outstanding.
For a complete list of build-time lint rules, please refer to [`Build-time Libdeps Linter`](build_system_reference.md#build-time-libdeps-linter)
`LIBDEPS_TAGS` can also be used to supply flags to the libdeps subsystem to do special handling for certain libraries such as exemptions or inclusions for linting rules and also SCons command line expansion functions.
For a full list of tags refer to [`LIBDEPS_TAGS`](build_system_reference.md#libdeps_tags)
#### Using the post-build LIBDEPS Linter
To use the post-build tools, you must first build the libdeps dependency graph by building the `generate-libdeps-graph` target.
After the graph file is created, it can be used as input into the `gacli` tool to perform linting and analysis on the complete dependency graph. The `gacli` tool has options for what types of analysis to perform. A complete list can be found using the `--help` option. Minimally, you can run the `gacli` tool by just passing the graph file you wish to analyze:
Another tool which provides a graphical interface as well as visual representation of the graph is the graph visualizer. Minimally, it requires passing in a directory in which any files with the `.graphml` extension will be available for analysis. By default it will launch the web interface which is reachable in a web browser at http://localhost:3000.
For more information about the details of using the post-build linting tools refer to [`post-build linting and analysis`](build_system_reference.md#post-build-linting-and-analysis)