Gábor Török
12/11/2024, 10:02 PMinterface Services {
@get:Inject val exec: ExecOperations
}
tasks.register("calculateCliProperties") {
val exec = project.objects.newInstance<Services>().exec
val stdOut = ByteArrayOutputStream()
exec.exec {
commandLine("some command")
standardOutput = stdOut
}
val cliResult = stdOut.toString()
inputs.property("cliResult", cliResult)
doLast {
... do something with the result...
}
}
of course this won't work, because i get this error:
> Starting an external process '...' during configuration time is unsupported.what would be the right way to be able to both use that result during the task execution AND being able to set it as an input, so it can determine how we cache?
ephemient
12/11/2024, 10:37 PMAdam
12/12/2024, 1:45 PMproviders.exec { }.standardOutput
https://docs.gradle.org/current/kotlin-dsl/gradle/org.gradle.api.provider/-provider-factory/exec.htmlGábor Török
12/12/2024, 5:30 PMValueSource
, and it workeD!