From c72d0ec850dfd42c75e80f08c4ff3eae5d215db4 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Fri, 17 Jan 2020 20:59:23 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Change=20annotation=20on=20outpu?= =?UTF-8?q?t=20properties?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @Input properties must be serializable. --- src/main/kotlin/at.phatbl.shellexec/ShellExec.kt | 5 +++-- .../at.phatbl.shellexec/logging/GradleLogOutputStream.kt | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/at.phatbl.shellexec/ShellExec.kt b/src/main/kotlin/at.phatbl.shellexec/ShellExec.kt index 5a8a2de..5046057 100644 --- a/src/main/kotlin/at.phatbl.shellexec/ShellExec.kt +++ b/src/main/kotlin/at.phatbl.shellexec/ShellExec.kt @@ -4,6 +4,7 @@ import at.phatbl.shellexec.logging.GradleLogOutputStream import org.gradle.api.DefaultTask import org.gradle.api.GradleException import org.gradle.api.logging.LogLevel +import org.gradle.api.tasks.Console import org.gradle.api.tasks.Input import org.gradle.api.tasks.InputDirectory import org.gradle.api.tasks.Internal @@ -24,10 +25,10 @@ open class ShellExec: DefaultTask() { @InputDirectory var workingDir: File = project.projectDir - @Input + @Console var standardOutput: OutputStream = GradleLogOutputStream(logger, LogLevel.LIFECYCLE) - @Input + @Console var errorOutput: OutputStream = GradleLogOutputStream(logger, LogLevel.ERROR) @Input diff --git a/src/main/kotlin/at.phatbl.shellexec/logging/GradleLogOutputStream.kt b/src/main/kotlin/at.phatbl.shellexec/logging/GradleLogOutputStream.kt index 53eebad..12addc1 100644 --- a/src/main/kotlin/at.phatbl.shellexec/logging/GradleLogOutputStream.kt +++ b/src/main/kotlin/at.phatbl.shellexec/logging/GradleLogOutputStream.kt @@ -9,7 +9,11 @@ import java.io.File /** * Adapter which passes log output through to Gradle's logger. */ -class GradleLogOutputStream(val logger: Logger, level: LogLevel, val logFiles: Array? = null): LogOutputStream(level.ordinal) { +class GradleLogOutputStream( + val logger: Logger, + level: LogLevel, + val logFiles: Array? = null +): LogOutputStream(level.ordinal) { /** * Logs a line to the log system of the user. *