apply plugin: 'checkstyle'
apply plugin: 'findbugs'
apply plugin: 'pmd'

task checkstyle(type: Checkstyle) {
    configFile file("${rootProject.rootDir}/scripts/quality/checkstyle/checkstyle.xml")
    configProperties.checkstyleSuppressionsPath = file("${rootProject.rootDir}/scripts/quality/checkstyle/suppressions.xml")
    source 'src'
    include '**/*.java'
    exclude '**/gen/**'
    classpath = files()
}

task findbugs(type: FindBugs, dependsOn: assemble) {
    ignoreFailures = false
    effort = "max"
    reportLevel = "high"
    excludeFilter = new File("${rootProject.rootDir}/scripts/quality/findbugs/findbugs-filter.xml")
    classes = files("${project.projectDir}/build/intermediates/classes")

    source 'src'
    include '**/*.java'
    exclude '**/gen/**'

    reports {
        xml.enabled = false
        html.enabled = true
        xml {
            destination "$project.buildDir/reports/findbugs/findbugs.xml"
        }
        html {
            destination "$project.buildDir/reports/findbugs/findbugs.html"
        }
    }

    classpath = files()
}

task pmd(type: Pmd) {
    ignoreFailures = false
    ruleSetFiles = files("${rootProject.rootDir}/scripts/quality/pmd/pmd-ruleset.xml")
    ruleSets = []

    source 'src'
    include '**/*.java'
    exclude '**/gen/**'

    reports {
        xml.enabled = false
        html.enabled = true
        xml {
            destination "$project.buildDir/reports/pmd/pmd.xml"
        }
        html {
            destination "$project.buildDir/reports/pmd/pmd.html"
        }
    }
}

