This message was deleted.
# community-support
s
This message was deleted.
v
What do you mean with "this" that you did not create?
The cause for the problems? Then yes, you did
c
how so? and yes this problem
v
Copy code
val available = tasks.register("tests available") {
  val ss = sourceSets;
c
the problem with that is?
v
You capture
sourceSets
and use it at runtime. So it is tried to be serialized into configuration cache. And that is not supported
c
how can I fix that
I feel like there's a reason I did that, but I don't recall why
also possible it's copy pasta of someone elses code for fixing the problem that gradle doesn't blow up if it doesn't find tests and provides no facility for that behavior
v
Copy code
val available = tasks.register("tests available") {
    val java: Provider<FileCollection> = sourceSets.test.map { it.java }
    doLast {
        if (java.get().isEmpty) throw RuntimeException("no tests found")
    }
}
c
🤔
Copy code
> Task :app:tests available FAILED
Caching disabled for task ':app:tests available' because:
  Gradle would require more information to cache this task
Task ':app:tests available' is not up-to-date because:
  Task has not declared any outputs despite executing actions.
but if I run it twice it passes...
v
Why did it fail? You didn't paste any error
c
Copy code
FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:tests available'.
> class org.gradle.api.internal.file.collections.FileTreeAdapter cannot be cast to class org.gradle.api.file.SourceDirectorySet (org.gradle.api.internal.file.collections.FileTreeAdapter and org.gradle.api.file.SourceDirectorySet are in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader @1b701da1)
oh, it's because I removed the
Provider<
type...
👌 1
derp
yay....
I'm gonna go murder spotless now
😎 1
for other things...