Without the configuration cache, this snippet is w...
# configuration-cache
j
Without the configuration cache, this snippet is working
Copy code
val catalog: VersionCatalog = versionCatalogs.named("hubdle")

val catalogDependencies: Provider<List<MinimalExternalModuleDependency>> = provider {
    catalog.libraryAliases.mapNotNull { catalog.findLibrary(it).getOrNull()?.orNull }
}

val hubdleCodegen: TaskProvider<GenerateHubdleTask> =
    tasks.register<GenerateHubdleTask>("generateHubdle")

hubdleCodegen.configure {
    group = "build"

    libraries.set(catalogDependencies)
    libraryAliases.set(provider { catalog.libraryAliases })
    pluginAliases.set(provider { catalog.pluginAliases })
}
But with config cache I get
Copy code
* What went wrong:
Could not load the value of field `libraries` of task `:hubdle-gradle-plugin:generateHubdle` of type `com.javiersc.hubdle.logic.GenerateHubdleTask`.
> java.lang.NullPointerException (no error message)
m
Do you have a full stack trace? Nothing strikes me as obviously broken :(
j
Untitled
If I put an
error(...)
inside the provider to force a crash, the list is of dependencies is correct
m
Hm, do you run your builds with
--configuration-cache-problems=warn
by chance? There is a serialization problem, because CC cannot serialize
MinimalExternalModuleDependency
j
Yes, I am using
warn
. I will try to create my own object and share the outcome this afternoon. Thank you!
It worked, thank you!