Search code examples
builddependenciesbazel

How to find not used dependencies in Bazel build file?


Suppose I've a Bazel package with a BUILD.bazel file that contains a list of dependencies. Some dependencies are not in use anymore. How to find the dependencie that are not in use ?

This is a Java project but I think the language is not important.


Solution

  • unused_deps works for Java projects. There is no tool that works for all languages. For C++ a pattern like IWYU can help to decide when and how to make a dependency.