summaryrefslogtreecommitdiff
path: root/src/main/groovy/FlycheckAndroidJavaTask.groovy
blob: e5fd985159d626dfd0e5e646dde69edea0fba56c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package org.thejk

import org.gradle.api.DefaultTask
import org.gradle.api.tasks.TaskAction
import org.gradle.api.tasks.compile.JavaCompile

class FlycheckAndroidJavaTask extends DefaultTask {
    FlycheckAndroidJavaTask() {
        def generate = project.tasks.findByName('generateDebugSources')
        if (generate) {
            dependsOn generate
        }
    }

    @TaskAction
    def action() {
        project.tasks.matching({ task ->
                if (!(task instanceof JavaCompile)) false
                return task.name.startsWith('compile') &&
                    (task.name.endsWith('DebugJavaWithJavac') ||
                     task.name.endsWith('DebugUnitTestJavaWithJavac'))
            }).each { compile ->
                println '***'
                println 'args=' + compile.options.compilerArgs
                println 'encoding=' + compile.options.encoding
                println 'bootcp=' + compile.options.bootClasspath
                println 'cp=' + compile.classpath.asPath
                println 'source=' + compile.sourceCompatibility
                println 'target=' + compile.targetCompatibility
                println 'files=' + compile.inputs.files.asPath
                println 'output=' + compile.destinationDir
            }
    }
}