I have a gradle task `checkStaging` that checks `l...
# gradle
a
I have a gradle task
checkStaging
that checks
lint
and
ktLintCheck
and after that run all unit tests for the modules. The problem is that even though
ktLintCheck
fails, the task keeps running and then fails after 8-11 minutes. I want the task to fail as soon as ktLintCheck failed. Any idea, how to do that?
Copy code
task cleanAll(dependsOn: [':lib_mvp:clean', ':lib_service:clean', ':Dream:clean'])
task checkStaging(dependsOn: ['cleanAll',
                              ':lib_mvp:lintDebug', ':lib_service:lintStagingDebug', ':Dream:lintStagingDebug',
                              ':lib_mvp:ktlintCheck', ':lib_service:ktlintCheck', ':Dream:ktlintCheck',
                              ':lib_mvp:testDebugUnitTest', ':lib_service:testStagingDebugUnitTest', ':Dream:testStagingDebugUnitTest'])
checkStaging.mustRunAfter cleanAll
Note: it’s build.gradle file which is in groovy.
v
Do you use things like configuration cache or
org.gradle.parallel
or
--parallel
or
--continue
?
Besides that your question is misplaced according to the Channel subject ;-)
a
Thanks Björn 🙂 In the
gradle.properties
file, I don’t see the configuration that you are mentioning above.
v
Just asking because those could cause tasks to run in parallel and thus not end immediately after a failed task.
Can you show a build scan where it happens?
a
Your question led me to play around with few properties and i made the improvement with caching. It kinda is working in my case. With this, it at-least fails/succeed faster.
Copy code
org.gradle.caching=true
v
That's just the task output cache. If a task that would still run to completion while the other failed already, is served from the cache instead, it will of course fail faster, but that's just in certain situations, not a general improvement. If the task simply is up-to-date you would probably see the same "improvement".