novoda/gradle-static-analysis-plugin

Gradle error with Kapt

pablisco opened this issue · 4 comments

We've observed a problem when running gradle-static-analysis-plugin alongside kapt:

* What went wrong:

Could not determine the dependencies of task ':models:findbugsMain'.

> No signature of method: com.novoda.staticanalysis.internal.findbugs.FindbugsConfigurator$_createClassesTreeFrom_closure11.doCall() is applicable for argument types: (org.gradle.api.internal.file.UnionFileTree, File) values: [file tree, /storage/jenkins/workspace/ALL-4-PIPELINE_PR-10233/base/models/build/tmp/kapt3/classes/main]

  Possible solutions: doCall(org.gradle.api.file.ConfigurableFileTree, java.io.File), findAll(), findAll()

We have @AutoValue set up using kts like this:

plugins {
  // ...
  kotlin("kapt")
}

dependencies {

  // ...

  compileOnly("com.google.auto.value:auto-value-annotations:1.6.3") 
  kapt("com.google.auto.value:auto-value:1.6.3")

}

The problem is solved by removing kotlin("kapt") and changing the kapt dependency to annotationProcessor

Hi, can you also post the findbugs { } configuration?

It looks like kapt uses UnionFileTree and we expect ConfigurableFileTree and they are not compatible. We should be able to reproduce this pretty easily.

We should be able to write test case for this too. The only problem is that this probably happens in newer versions of Kapt and that will require Gradle 5 upgrade.

This is the findBugs config:

    findbugs {
        toolVersion findbugsVersion
        exclude project.fileTree('src/test/java')
        exclude project.fileTree('src/testDebug/java')
        excludeFilter rootProject.file('team-props/findbugs-rules/findbugs-excludes.xml')
        includeVariants { variant ->
            variant.name in ['release', 'googleDebug']
        }
    }

Ah yeah, we are using Gradle 5.6