Added Android code
[wl-app.git] / Android / r2-streamer / config / quality / quality.gradle
1 /**
2  * Set up Checkstyle, Findbugs and PMD to perform extensive code analysis.
3  *
4  * Gradle tasks added:
5  * - checkstyle
6  * - findbugs
7  * - pmd
8  *
9  * The three tasks above are added as dependencies of the check task so running check will
10  * run all of them.
11  */
12
13 apply plugin: 'checkstyle'
14 apply plugin: 'findbugs'
15 apply plugin: 'pmd'
16
17 dependencies {
18     checkstyle 'com.puppycrawl.tools:checkstyle:6.5'
19 }
20
21 def qualityConfigDir = "$project.rootDir/config/quality";
22 def reportsDir = "$project.buildDir/reports"
23
24 check.dependsOn 'checkstyle', 'findbugs', 'pmd'
25
26 task checkstyle(type: Checkstyle, group: 'Verification', description: 'Runs code style checks') {
27     configFile file("$qualityConfigDir/checkstyle/checkstyle-config.xml")
28     source 'src'
29     include '**/*.java'
30
31     reports {
32         xml.enabled = true
33         xml {
34             destination "$reportsDir/checkstyle/checkstyle.xml"
35         }
36     }
37
38     classpath = files( )
39 }
40
41 task findbugs(type: FindBugs,
42         group: 'Verification',
43         description: 'Inspect java bytecode for bugs',
44         dependsOn: ['compileDebugSources','compileReleaseSources']) {
45
46     ignoreFailures = false
47     effort = "max"
48     reportLevel = "high"
49     excludeFilter = new File("$qualityConfigDir/findbugs/android-exclude-filter.xml")
50     classes = files("$project.rootDir/folioreader/build/intermediates/classes")
51
52     source 'src'
53     include '**/*.java'
54     exclude '**/gen/**'
55
56     reports {
57         xml.enabled = false
58         html.enabled = true
59         xml {
60             destination "$reportsDir/findbugs/findbugs.xml"
61         }
62         html {
63             destination "$reportsDir/findbugs/findbugs.html"
64         }
65     }
66
67     classpath = files()
68 }
69
70
71 task pmd(type: Pmd, group: 'Verification', description: 'Inspect sourcecode for bugs') {
72     ruleSetFiles = files("$qualityConfigDir/pmd/pmd-ruleset.xml")
73     ignoreFailures = false
74     ruleSets = []
75
76     source 'src'
77     include '**/*.java'
78     exclude '**/gen/**'
79
80     reports {
81         xml.enabled = true
82         html.enabled = true
83         xml {
84             destination "$reportsDir/pmd/pmd.xml"
85         }
86         html {
87             destination "$reportsDir/pmd/pmd.html"
88         }
89     }
90 }