Adam Murdoch wrote:

On 27/10/2010, at 3:47 AM, thomas wrote:


How does Gradle or Ivy help with unused dependencies?

It usually happens in projects that dependencies are getting added to the
build.gradle file which later then don't get removed when the code gets
changed and the need for the dependency becomes superfluous.

Is there any reporting available that could be used to identify these cases?

Not yet, but we do want to add some.

Not sure yet how this will look, but I imagine we'd start by using the static type dependencies in the code, so that we can verify the compile-time dependencies. We might later provide some reporting which shows which bits of the code depend on which dependencies, and probably expose this information so you can write your own rules about which dependencies are legal and which are not.

There's a bunch of other things we might use this dependency information for, so it is certainly worth our while adding it. For example: * incremental compilation, where we compile only those source files whose compile-time dependencies have changed. * incremental testing, where we only run the tests whose dependencies have changed. * dependency discovery, where you don't need to declare the dependencies in the build script, and Gradle figures them out from the source code.

Runtime dependencies are quite a bit tougher, as there are so many ways which they can be introduced. But, just like the compile-time dependencies, there are a bunch of useful things we can do with them. We have a few options. We can do static analysis of the code. We can analyse various types of config files. We can use test coverage. And we can provide some way for you to provide your own analysers.

Hmm, there's some code in Apache River in the package com.sun.jini.tools.classdepend that uses ASM and bytecode analysis to build a dependency map, you could use it.

Cheers,

Peter.




--
Adam Murdoch
Gradle Developer
http://www.gradle.org
CTO, Gradle Inc. - Gradle Training, Support, Consulting
http://www.gradle.biz



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to