autonomousapps / gradle-best-practices-plugin

Gradle Plugin that detects violations of Gradle best practices in Gradle Plugins
Apache License 2.0
180 stars 3 forks source link

Groovy support/documentation #7

Open mkm-dt opened 1 year ago

mkm-dt commented 1 year ago

I've tried to apply this plugin to a project with a plugin written in groovy, configuring classesDirs to point to the groovy output, but it still did not detect any issues (it should have at least found allProjects). It would be awesome to have full and automatic support for groovy, but until then, I'd settle for a mention of what should actually work and what isn't supported yet, so others can find out more easily.

autonomousapps commented 1 year ago

Do you have a reproducer? I'm surprised this isn't working:

      val mainOutput = extensions.getByType(SourceSetContainer::class.java)
        .findByName(SourceSet.MAIN_SOURCE_SET_NAME)
        ?.output
        ?.classesDirs
        ?: files()

That should analyze all the code in src/main regardless of source type.

mkm-dt commented 1 year ago

Sorry for the delay, I'll try to find some time for that this week

mkm-dt commented 1 year ago

Took a bit longer, but here it is: https://github.com/mkm-dt/gradle-best-practices-plugin-issues-7 It's just a gradle init plugin project using allprojects. gradlew :plugin:checkBestPractices does not complain, but it does not find any sources, apparently:

> Task :plugin:checkBestPractices
Caching disabled for task ':plugin:checkBestPractices' because:
  Build cache is disabled
Task ':plugin:checkBestPractices' is not up-to-date because:
  Executed with '--rerun-tasks'.
file or directory 'C:\workspaces\gradle_repro\plugin\build\classes\java\main', not found

BUILD SUCCESSFUL in 5s