Skip to content
This repository has been archived by the owner on Feb 11, 2022. It is now read-only.

Gradle error with Kapt #199

Closed
pablisco opened this issue Sep 16, 2019 · 4 comments
Closed

Gradle error with Kapt #199

pablisco opened this issue Sep 16, 2019 · 4 comments
Labels

Comments

@pablisco
Copy link
Contributor

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

@tasomaniac
Copy link
Contributor

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

@tasomaniac
Copy link
Contributor

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.

@pablisco
Copy link
Contributor Author

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']
        }
    }

@pablisco
Copy link
Contributor Author

Ah yeah, we are using Gradle 5.6

@tasomaniac tasomaniac added the bug label Nov 8, 2019
tasomaniac added a commit that referenced this issue Nov 8, 2019
…ects.

Added special configuration-only tests that also include kotlin projects even when the tool is Kotlin only.
tasomaniac added a commit that referenced this issue Nov 8, 2019
We were never dependant on that particular class and it seems like applying other plugins change the implementation class.

Fixes #199
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants