Giter VIP home page Giter VIP logo

Comments (7)

JLLeitschuh avatar JLLeitschuh commented on May 10, 2024 1

We should support this. For now the solution is to do the following:

afterEvaluate {
    test.dependsOn ktlintCheck
}

from ktlint-gradle.

Tapchicoma avatar Tapchicoma commented on May 10, 2024 1

@mverleg feel free to reopen if it will not work for you.

from ktlint-gradle.

mverleg avatar mverleg commented on May 10, 2024

Thanks for the answer!

I'm afraid it still doesn't work. I can use the task directly, but putting the suggested code in the top-level build.gradle (near the bottom) still gives the same error.

(Using a string ':topproject:ktlintCheck' moves the error to runtime but doesn't work)

from ktlint-gradle.

Tapchicoma avatar Tapchicoma commented on May 10, 2024

@mverleg note, that if you have multimodule project, root project will not have test or check tasks. You can archive it with following:

subprojects {
    afterEvaluate {
        if (it.plugins.findPlugin("org.jlleitschuh.gradle.ktlint") != null) {
            check.dependsOn("ktlintCheck")
        }
    }
}

from ktlint-gradle.

Tapchicoma avatar Tapchicoma commented on May 10, 2024

Though I agree in general that check task should depend on ktlintCheck task.

from ktlint-gradle.

Tapchicoma avatar Tapchicoma commented on May 10, 2024

Actually plugin already set check task to depend on all ktlint check tasks.

For example:

$ ./gradlew -m :samples:kotlin-ks:check
:samples:kotlin-ks:ktlintMainCheck SKIPPED
:samples:kotlin-ks:ktlintTestCheck SKIPPED
:samples:kotlin-ks:compileKotlin SKIPPED
:samples:kotlin-ks:compileJava SKIPPED
:samples:kotlin-ks:processResources SKIPPED
:samples:kotlin-ks:classes SKIPPED
:samples:kotlin-ks:compileTestKotlin SKIPPED
:samples:kotlin-ks:compileTestJava SKIPPED
:samples:kotlin-ks:processTestResources SKIPPED
:samples:kotlin-ks:testClasses SKIPPED
:samples:kotlin-ks:test SKIPPED
:samples:kotlin-ks:check SKIPPED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
See https://docs.gradle.org/4.5/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 0s

@mverleg can you check it for your project setup?

from ktlint-gradle.

mverleg avatar mverleg commented on May 10, 2024

Yeah I made a sample and it does have the dependency by default for JVM project, so I think this will mostly be fixed by #58 .

Though it's worth noting that

test.dependsOn ktlintCheck

still gives the error from the first post, even for JVM. It's not really a problem since it already happens by default, but it's a little weird.

This does work for JVM, but not for other platforms:

afterEvaluate {
    test.dependsOn ktlintCheck
}

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.