Slackbot
09/29/2023, 9:53 PMChris Lee
09/29/2023, 9:54 PMChris Lee
09/29/2023, 9:56 PMprivate val executor = Executors.newCachedThreadPool()
private fun <T> pipedStreams(block: PipedStreamsDsl<T>.() -> Unit): T {
val dsl = PipedStreamsDsl<T>()
dsl.apply(block)
val sourceAction = requireNotNull(dsl.source)
val sinkAction = requireNotNull(dsl.sink)
return PipedOutputStream().use { source ->
PipedInputStream(source).use { sink ->
// start reading in separate thread
val futureResult = executor.submit<T> {
sinkAction(sink)
}
// Gradle exec here
// invoke the main action that writes into source
// keep on the same thread for Gradle compatibility
sourceAction(source)
// wait for everything to complete
futureResult.get()
}
}
}ephemient
09/29/2023, 9:56 PMChris Lee
09/29/2023, 9:57 PMephemient
09/29/2023, 9:57 PMProcessBuilder and only emits the subset you care about, if you wanted to stay in the configuration-cache friendly worldephemient
09/29/2023, 9:58 PMexec?Kelvin Chung
09/29/2023, 10:00 PMproviders.exec { ... }.standardOutput.asText.map { ... }, until it gets terrible for whatever reason. It's just wishful thinking.Chris Lee
09/29/2023, 10:01 PMKelvin Chung
09/29/2023, 10:02 PMValueSource anyways, given the second map will probably be a doozy.ephemient
09/29/2023, 10:02 PMExecOperations / project.exec is still there for the non-Provider wayephemient
09/29/2023, 10:03 PMproviders.exec it's hashed into the configuration cache inputs, which might not be what if it's large amounts of output