Coder Social home page Coder Social logo

Cannot apply to buildSrc about ktlint-gradle HOT 4 OPEN

pkubowicz avatar pkubowicz commented on July 28, 2024 2
Cannot apply to buildSrc

from ktlint-gradle.

Comments (4)

JLLeitschuh avatar JLLeitschuh commented on July 28, 2024

Can you share a build scan?

Also, a minor reproducer would be nice.

@wakingrufus we could probably automatically filter out this directory when the kotlin-dsl plugin is applied. Thoughts?

from ktlint-gradle.

pkubowicz avatar pkubowicz commented on July 28, 2024

The scan is here: https://scans.gradle.com/s/enzehbyek47qs

Attached a simple reproducer.
gradle-kotlin-buildsrc.zip

from ktlint-gradle.

wakingrufus avatar wakingrufus commented on July 28, 2024

Can you share a build scan?

Also, a minor reproducer would be nice.

@wakingrufus we could probably automatically filter out this directory when the kotlin-dsl plugin is applied. Thoughts?

We could. I don't see this problem in regular projects using the kotlin-dsl plugin, so what is different about buildSrc that causes this?

from ktlint-gradle.

xenomachina avatar xenomachina commented on July 28, 2024

tl;dr: It looks like something is getting cached in buildSrc/.gradle/buildOutputCleanup/ that's preventing changes to excludes from being honored.


I ran into this same problem: ktlint was reporting errors in the Kotlin code that Gradle generates in buildSrc/. I added an exclude like this...

ktlint {
    filter {
        exclude {
            it.file.relativeTo(projectDir).startsWith(File("build"))
        }
    }
}

...and it continued reporting these errors. Eventually I used git clean to delete all ignored files from my repo, and then it started working.

I was able to narrow the problem down to buildSrc/.gradle/buildOutputCleanup/ by conducting the following series of tests:

  • Start from a clean repo, with the above exclude: WORKS
  • Remove exclude: FAILS
  • Add exclude back: FAILS
  • rm -rf buildSrc/.gradle/: WORKS
  • Remove exclude: FAILS
  • Add exclude back: FAILS
  • rm -rf buildSrc/.gradle/kotlin/: FAILS
  • rm -rf buildSrc/.gradle/buildOutputCleanup/: WORKS
  • Remove exclude: FAILS
  • Add exclude back: FAILS
  • rm -rf buildSrc/.gradle/buildOutputCleanup/: WORKS

"WORKS" and "FAILS" indicate the outcome of running ./gradlew :buildSrc:ktlintCheck after the corresponding operation.

from ktlint-gradle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.