You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: Directory 'build/spotless/spotlessKotlin' specified for property 'spotlessOutDirectory' does not exist #741
$ ./gradlew check
...
FAILURE: Build failed with an exception.
* What went wrong:
A problem was found with the configuration of task ':{myModuleName}:spotlessKotlinCheck' (type 'SpotlessCheck').
> Directory '{pathToProject}/{myModuleName}/build/spotless/spotlessKotlin' specified for property 'spotlessOutDirectory' does not exist.
gradle or maven version
Gradle 6.7.1
spotless version
Spotless 5.8.2
operating system and version
macOS 10.14.6 (18G6042)
copy-paste your full Spotless configuration block(s), and a link to a public git repo that reproduces the problem if possible
Now the problem has solved itself. 😕
I was running 'CtrlCtrl gradle check Enter' from Android Studio. That lead to the problem above. When running ./gradlew check from CLI there was no issue. (???) Then, when running it from AS again, the issue was gone. (???) Even when doing a Gradle clean (which removes the missing directory) before check doesn't reproduce the issue.
Interesting. Each format has three tasks. In your case, there is spotlessKotlin, spotlessKotlinCheck, and spotlessKotlinApply.
The job of spotlessKotlin is to check the formatting of target, and write the correctly formatted result into build/spotless/spotlessKotlin. The spotlessKotlin task has up-to-date checking, buildcache, etc.
The other two tasks, check and apply, just look at the build/spotless/spotlessKotlin directory, but they do not support up-to-date, buildcache, etc. Well, they kind of do, but only in that spotlessKotlin does all of the actual computation and work, and then check and apply just interpret that result.
For a clean build, the directory needed by spotlessKotlinCheck and spotlessKotlinApply does not exist, because it is created by spotlessKotlin.
Since check and apply don't have any outputs (as far as Gradle is concerned), I wonder if we should not declare any inputs either... @bigdaz any thoughts on this?
Activity
erikhuizinga commentedon Nov 20, 2020
The problem is solved if I specify Kotlin targets:
erikhuizinga commentedon Nov 20, 2020
Now the problem has solved itself. 😕
I was running 'CtrlCtrl gradle check Enter' from Android Studio. That lead to the problem above. When running
./gradlew checkfrom CLI there was no issue. (???) Then, when running it from AS again, the issue was gone. (???) Even when doing a Gradleclean(which removes the missing directory) beforecheckdoesn't reproduce the issue.I'm confused.
nedtwigg commentedon Nov 20, 2020
Interesting. Each format has three tasks. In your case, there is
spotlessKotlin,spotlessKotlinCheck, andspotlessKotlinApply.The job of
spotlessKotlinis to check the formatting oftarget, and write the correctly formatted result intobuild/spotless/spotlessKotlin. ThespotlessKotlintask has up-to-date checking, buildcache, etc.The other two tasks,
checkandapply, just look at thebuild/spotless/spotlessKotlindirectory, but they do not support up-to-date, buildcache, etc. Well, they kind of do, but only in thatspotlessKotlindoes all of the actual computation and work, and thencheckandapplyjust interpret that result.For a clean build, the directory needed by
spotlessKotlinCheckandspotlessKotlinApplydoes not exist, because it is created byspotlessKotlin.spotless/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/SpotlessTask.java
Lines 140 to 143 in d9474fb
spotless/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/SpotlessCheck.java
Lines 46 to 50 in d9474fb
spotless/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/SpotlessApply.java
Lines 43 to 47 in d9474fb
Since
checkandapplydon't have any outputs (as far as Gradle is concerned), I wonder if we should not declare any inputs either... @bigdaz any thoughts on this?nedtwigg commentedon Dec 3, 2020
Related to this, we should enable support for
@IgnoreEmptyDirectorieswhen used on Gradle 6.8+No longer declare inputs on `SpotlessCheck` and `SpotlessApply` since…
No longer declare inputs on `SpotlessCheck` and `SpotlessApply` since…
nedtwigg commentedon Jan 4, 2021
Fixed in
plugin-gradle 5.9.0erikhuizinga commentedon Jan 4, 2021
Thanks, I'll try it ASAP and you'll hear from me if anything's wrong (but I don't expect any issues 😉).