From c24e3a29f5cb7c91cc85c73c17063585957fe814 Mon Sep 17 00:00:00 2001 From: Arthur Ramsey <54082931+c42-arthur@users.noreply.github.com> Date: Thu, 10 Aug 2023 11:13:42 -0500 Subject: [PATCH] Support allow empty junit results (#40) * Support allow empty archive * Support allow empty junit results --------- Co-authored-by: Caleb Reder --- .../jenkins/pipelinekt/dsl/step/declarative/JUnitDsl.kt | 7 ++++++- .../jenkins/pipelinekt/internal/step/declarative/JUnit.kt | 4 ++-- version.txt | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/dsl/src/main/kotlin/com/code42/jenkins/pipelinekt/dsl/step/declarative/JUnitDsl.kt b/dsl/src/main/kotlin/com/code42/jenkins/pipelinekt/dsl/step/declarative/JUnitDsl.kt index 746539a1..ed04aeab 100644 --- a/dsl/src/main/kotlin/com/code42/jenkins/pipelinekt/dsl/step/declarative/JUnitDsl.kt +++ b/dsl/src/main/kotlin/com/code42/jenkins/pipelinekt/dsl/step/declarative/JUnitDsl.kt @@ -7,7 +7,12 @@ import com.code42.jenkins.pipelinekt.dsl.DslContext import com.code42.jenkins.pipelinekt.internal.step.declarative.JUnit fun DslContext.junit(testResults: String) = + junit(testResults = testResults.strDouble(), false) + +fun DslContext.junit(testResults: String, allowEmptyResults: Boolean) = junit(testResults = testResults.strDouble()) fun DslContext.junit(testResults: Var.Literal.Str) = - add(JUnit(testResults = testResults)) + add(JUnit(testResults = testResults. false)) +fun DslContext.junit(testResults: Var.Literal.Str, allowEmptyResults: Boolean) = + add(JUnit(testResults = testResults. allowEmptyResults=allowEmptyResults)) diff --git a/internal/src/main/kotlin/com/code42/jenkins/pipelinekt/internal/step/declarative/JUnit.kt b/internal/src/main/kotlin/com/code42/jenkins/pipelinekt/internal/step/declarative/JUnit.kt index 448a0237..89545792 100644 --- a/internal/src/main/kotlin/com/code42/jenkins/pipelinekt/internal/step/declarative/JUnit.kt +++ b/internal/src/main/kotlin/com/code42/jenkins/pipelinekt/internal/step/declarative/JUnit.kt @@ -5,8 +5,8 @@ import com.code42.jenkins.pipelinekt.core.step.SingletonStep import com.code42.jenkins.pipelinekt.core.vars.Var import com.code42.jenkins.pipelinekt.core.writer.GroovyWriter -data class JUnit(val testResults: Var.Literal.Str) : DeclarativeStep, SingletonStep { +data class JUnit(val testResults: Var.Literal.Str, val allowEmptyResults: Boolean = false) : DeclarativeStep, SingletonStep { override fun toGroovy(writer: GroovyWriter) { - writer.writeln("junit ${testResults.toGroovy()}") + writer.writeln("junit ${testResults.toGroovy()}, allowEmptyResults: $allowEmptyResults") } } diff --git a/version.txt b/version.txt index 918820be..a881cf79 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.19.3 \ No newline at end of file +0.20.0 \ No newline at end of file