When a gradleApi dependency doesn't respond as expected when contentEquals is called with parameter gradleApi that is a new instance

I am trying to write a plugin that will do things specific when someone adds the gradleApi() as a dependency. I tried to use the contentEquals method but it will always return false when the objects being compared are different instanced of dependencies.gradleApi()


apply plugin: 'java'
println dependencies.gradleApi().contentEquals(dependencies.gradleApi())


❯ gradle build
:compileJava UP-TO-DATE

I have made a patch that would allow users to be able to determine what kind of dependency was added, when its a classpath type (gradleApi, lovalGroovy).


I’ve fixed this for 2.4.

Thanks for the report.