Open pramod-knidal opened 1 year ago
I think the error message is giving you a workaround? You need to make the relationship between tasks more explicit and could use dependsOn
or mustRunAfter
to do that.
Adding the following should work.
tasks.named("ktfmtCheckMain") {
dependsOn("ktfmtFormatMain")
}
I think the error message is giving you a workaround? You need to make the relationship between tasks more explicit and could use
dependsOn
ormustRunAfter
to do that.Adding the following should work.
tasks.named("ktfmtCheckMain") { dependsOn("ktfmtFormatMain") }
Yeah. Tried several things similar to the one you noted. It was throwing an error saying ktfmtCheckMain
task not found. In gradle, the ordering matters. So, tried putting that logic in several places until it worked. After it worked, there was another similar error saying sourcesReleaseJar
should depend on ktfmtFormatMain
. After I fixed that, there was another similar one.
I thought having these dependencies explicitly defined in the plugin code would be a good solution. So, posted an issue here.
@pramodshri-tgsys Thanks for the report
I thought having these dependencies explicitly defined in the plugin code would be a good solution. So, posted an issue here.
The two tasks should not depend on each other. Could you provide a reproducer where you're having this behavior as I can't reproduce it in my testing?
@cortinico I don't have a reproducer. It was happening in a proprietary project when I tried to publish an aar
for an android library project using gradle plugin for maven publish
. It happens only when you try to publish a release aar.
You note that the two tasks should not depend on each other. However, adding the code that @WhosNickDoglio has put in his comment will get you past the error... to a new error...
π Describe the bug
./gradlew build
command fails with the following errorβ οΈ Current behavior
./gradlew build
fails with errorβ Expected behavior
./gradlew build
should not throw any warnings/errors related toktfmt-gradle
plugin.π£ Steps to reproduce
id 'com.ncorti.ktfmt.gradle' version '0.12.0'
./gradlew build
from terminalπ± Tech info
Notes
I found this issue when I was trying to generate a release build using 'maven-publish' which threw errors similar to the one above but it was asking me to include the implicit dependency between 'sourceReleaseJar
task and
ktfmtFormatRelease`.A workaround for now would be appreciated.