Check transitivity of DefaultIvyDependency


(dinio.dinev) #1

I have spock test

import org.gradle.api.publish.ivy.internal.dependency.DefaultIvyDependency
when:
...
project.plugins.apply(IvyPublishPlugin.class)
...
PublishingExtension publishing
publishing = project.extensions.getByType(PublishingExtension)
IvyPublication publication = publishing.publications.ivy
...
then:
publication.dependencies.all {DefaultIvyDependency dep->
            ModuleDependency mdlDependency = dep.getModuleDependency()
            assert !mdlDependency.transitive
            assert "${mdlDependency.group}:${mdlDependency.name}:${mdlDependency.version}"==DEPENDENCY_NAME
   }

In the new version 1.7 of Gradle the the implementation of DefaultIvyDependency class is changed and I can’t get getModuleDependency() and to check if the dependency is transitive. I want to ask how can I check that?