Closed ishestakov closed 7 years ago
Could you elaborate a bit more ? what part doesn't work with gradle that require you to change this class ?
To my knowledge, this class is only a helper to simplify calls to ProcessBuilder, which is an abstraction that should remain below maven/gradle.
The crucial feature we need for Gradle is to set process output stream to System.out
as only in that case the output of the process occurs on the build console as by default the build will run in a fork process and any other output instead of System.out
won't be displayed.
Also Gradle has it's own abstraction for running system process as well: ExecHandle (which actually uses ProcessBuilder under the hood).
The idea is to provide the adapter between Gradle abstraction for executing system processes and Carnotzet CommandRunner
. Moreover using this approach anybody would be able to provide any decorators to instrument the CommandRunner
in any suitable way (as mentioned above for remote SSH execution, log output to the console and log file at the same time, etc.)
Moreover the abstraction will simplify unit testing.
Description
At the moment
com.github.swissquote.carnotzet.runtime.docker.compose.DockerComposeRuntime
usescom.github.swissquote.carnotzet.core.runtime.CommandRunner
which is an utility class with all the static methods. The suggestion is toCommandRunner
utility methods to an interface and provide default implementation for it.CommandRunner
interface tocom.github.swissquote.carnotzet.runtime.docker.compose.DockerComposeRuntime
at construction time.CommandRunner
interface as a fallback.Rationale.
For the purpose of gradle-carnotzet-plugin I'm working on, it's a blocking point as I need to provide alternative Gradle specific version to run processes. Moreover, doing so will allow to provide another specific implementations of
CommandRunner
interface e.g. for remote command execution (over SSH, etc.)