dependency-analysis-gradle-plugin
dependency-analysis-gradle-plugin copied to clipboard
Allow determining if a project is an application
It would be really useful if there was a way to instruct the dependency-analysis plugin that a project should be analyzed as if it were an application. Currently this is determined by checking for various plugins in the project (e.g. application and org.springframework.boot), but this is rather inflexible.
In projects I'm working on there are several other types we'd like to consider as deployable projects (i.e. not libraries with an API), such as WAR and EJB projects, as well as runtime/implementation projects that implements an API defined elsewhere.
One way of allowing the user to set this could be to add a callback to the root-extension:
dependencyAnalysis {
projectIsApplicationIf { p -> p.name.endsWith("-impl") || p.pluginManager.hasPlugin("war") }
}
An alternative solution would be to add it as a Property<Boolean> to the IssueHandler, where it could then be configured for each project:
allprojects {
pluginManager.withPlugin("com.autonomousapps.dependency-analysis") {
if (name.endsWith("-impl") || pluginManager.hasPlugin("war")) {
dependencyAnalysis {
issues {
isApplication.set(true)
}
}
}
}
}
I'm willing to implement this and send a pull request, but I'd like to know if you find such a feature useful - and which of the two approaches you'd prefer. I personally prefer the first option as it's simpler and quite powerful.
Thanks for the issue. I'll consider it and get back to you.