Open anewdroid opened 2 months ago
Hi @notsatyarth In Talaiot 2.x we support custom publishers and depending on the logic in them it could be compatible with configuration cache. Given a publisher like:
class CustomPublisher : io.github.cdsap.talaiot.publisher.Publisher {
override fun publish(report: io.github.cdsap.talaiot.entities.ExecutionReport) {
println("[CustomPublisher] : Number of tasks = ${report.tasks?.size}")
println("[CustomPublisher] : Kotlin = ${report.customProperties.buildProperties["kotlin"]}")
println("[CustomPublisher] : Java = ${report.customProperties.buildProperties["java"]}")
println("[CustomPublisher] : PID = ${report.customProperties.taskProperties["pid"]}")
}
}
you can register it with:
talaiot {
publishers {
jsonPublisher = true
customPublishers(CustomPublisher())
}
}
Executing the first build:
❯ ./gradlew build --configuration-cache
Calculating task graph as configuration cache cannot be reused because file 'build.gradle.kts' has changed.
[CustomPublisher] : Number of tasks = 11
[CustomPublisher] : Kotlin = 1.4
[CustomPublisher] : Java = 8
[CustomPublisher] : PID = 2134
BUILD SUCCESSFUL in 4s
2 actionable tasks: 2 up-to-date
Configuration cache entry stored.
Second build reuses configuration cache:
❯ ./gradlew build --configuration-cache
Reusing configuration cache.
[CustomPublisher] : Number of tasks = 11
[CustomPublisher] : Kotlin = 1.4
[CustomPublisher] : Java = 8
[CustomPublisher] : PID = 2134
BUILD SUCCESSFUL in 4s
2 actionable tasks: 2 up-to-date
Configuration cache entry reused.
Hi @cdsap , thank you for the reply! with some trial and error , I could conclude that using the gradle logger
was preventing the publisher from being serializable. I noticed that the Talaio publishers also use println
internally. Is that intentional?
Hi Is the Custom Publisher compatible with Configuration Cache? The CC ticket at https://github.com/cdsap/Talaiot/issues/349 mentions that there was a compatibility issue here
In Talaiot 2.0, how shoudl we write custom publishers ?