0

Currently lintRelease, task depends on the compilation task, and for some modules (which I dont care about since its only used for testing purposes), I want lintRelease to do nothing, just print Not supported is that possible with gradle KTS?

Basically this question is about gradle task replacement, I want to replace the lintRelease gradle task with a task that does nothing.

If you are thinking

You can skip lint checking for debug/release builds

The lintRelease task is manually triggered at the moment by a shell script, so thats not an option, I need this task to not do anything for this particular module lets call it module X

Bhargav
  • 8,118
  • 6
  • 40
  • 63

1 Answers1

0

Try this at the top of the Gradle file

tasks.whenTaskAdded { task ->
    if (task.name.equals("lint")) {
        task.enabled = false
    }
}

Even this can also help

android {
    lintOptions {
        tasks.lint.enabled = false
    }
}
Lakhwinder Singh
  • 6,799
  • 4
  • 25
  • 42
  • thanks these are different from the ones i tried. let me give it a shot thanks – Bhargav Mar 23 '20 at 06:35
  • so basically if I run `./gradlew lintRelease` it should not execute anything just print `not supported` and end, I think above code is not doing that – Bhargav Mar 23 '20 at 06:40
  • it will skip the lint task, thats it, you can put this in X module's gradle file – Lakhwinder Singh Mar 23 '20 at 06:41
  • not working because when i run `lintRelease` it will still execute all the steps in that task, including code compilation – Bhargav Mar 23 '20 at 08:21