Hi,
How to create a common task in root build.gradle which can be executed for all modules.
Ex:
root/build.gradle
task findbugs(type: FindBugs) {
ignoreFailures = true
effort = “max"
reportLevel = “low"
excludeFilter = new File(”${rootDir}/…/Tools/findBugs/exclude.xml”)
classes = files("${project.buildDir}/intermediates/classes/debug")
source 'src’
include “/*.java"
exclude "/gen/**”
reports {
xml.enabled = true
xml.withMessages = true
html.enabled = false
xml {
destination “$project.buildDir/reports/${project.name}.xml”
}
}
classpath = files()
}
task findbugsHtml << {
if (file("${buildDir}/reports/${project.name}.xml").exists()) {
ant.xslt(in: “${buildDir}/reports/${project.name}.xml”,
style:"${rootDir}/findbugs.xsl",
out:"${buildDir}/reports/${project.name}.html"
)
}
}
To run it for App module
gradle clean :App:findbugs