From 5ea5ec068a5cd7d4b1328b6c14a34d17ac69f69d Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Thu, 15 Feb 2018 22:28:25 +0100 Subject: Generate configurations for all variants Add new option, flycheck-android-java-variant, if a matching variant is found the matching configuration is used. If no matching variant is found the first one is used - same as if you had not set a variant. Variant is case-sensitive. --- src/main/groovy/FlycheckAndroidJavaTask.groovy | 47 ++++++++++++++------------ 1 file changed, 25 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/main/groovy/FlycheckAndroidJavaTask.groovy b/src/main/groovy/FlycheckAndroidJavaTask.groovy index 633c445..558981d 100644 --- a/src/main/groovy/FlycheckAndroidJavaTask.groovy +++ b/src/main/groovy/FlycheckAndroidJavaTask.groovy @@ -32,30 +32,33 @@ class FlycheckAndroidJavaTask extends DefaultTask { } variants = variants.sort() def configurations = ['', 'UnitTest'] - configurations.each { configuration -> - def name = 'compile' - name += variants.first().capitalize() - name += configuration.capitalize() + 'JavaWithJavac' - def compile = project.tasks.findByName(name) - if (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 + variants.each { variant -> + configurations.each { configuration -> + def name = 'compile' + name += variant.capitalize() + name += configuration.capitalize() + 'JavaWithJavac' + def compile = project.tasks.findByName(name) + if (compile) { + println '***' + println 'variant=' + variant + 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 + } } - } - def name = 'generate' - name += variants.first().capitalize() + 'Sources' - def generate = project.tasks.findByName(name) - if (generate != null) { - println '!!!' - println generate.path + def name = 'generate' + name += variant.capitalize() + 'Sources' + def generate = project.tasks.findByName(name) + if (generate != null) { + println '!!!' + println generate.path + } } } } -- cgit v1.2.3-70-g09d2