Anton Afanasev
12/09/2021, 8:12 PMdependency
task that prints all the dependencies, but I am not able to assemble that pieces to a working solution.
tasks.register("checkForAndroidxDependencies") {
description = "verify that no androidx dependencies are present"
group = "verification"
dependsOn("androidDependencies") // how do I get the output of the androidDependencies?
doLast {
exec {
commandLine = listOf("grep", "androidDependencies") // Are there any way to execute the "grep" on the androidDependencies?
}
}
}
Any help will be much appreciated.Vampire
12/09/2021, 8:56 PMAnton Afanasev
12/14/2021, 7:39 PMtarget.tasks.create<DependencyValidatorTask>("abc") {
dependsOn("androidDependencies")
project.configurations.all {
resolutionStrategy.eachDependency {
if (this.requested.group.contains(excludeGroup)) {
throw IllegalArgumentException("Sorry, $excludeGroup libraries are not welcomed here.")
}
}
}
}
But it looks like there are some limitations. I have to create this task in Plugin::apply block.
otherwise If I add this block as a standalone task I am failing to run it.
Cannot change resolution strategy of dependency configuration ':mymodule:debugAndroidTestCompileClasspath' after it has been resolved.
I understand thats because resolutionStrategy.eachDependency
is a "mutation" api. Wonder if anybody can hint me what am I doing wrong/how can I access complete resolved dependency graph?Vampire
12/14/2021, 9:18 PMabc
task the project.configurations.all
action.
That doesn't sound nearly like anything you should want to do.
Why debugging and why no convenient way?
I linked you to the docs where It is documented how to access the full dependency graph.