From f43cde68a8349cb62d3ea55da869a2b0e80d1d8c Mon Sep 17 00:00:00 2001 From: Pedro Rodriguez Date: Fri, 15 Mar 2013 23:41:37 -0400 Subject: [PATCH] Added help-allowEmptyArchive.html. Did some cleanup in ArtifactArchiver and config.jelly --- core/src/main/java/hudson/tasks/ArtifactArchiver.java | 10 +++------- .../hudson/tasks/ArtifactArchiver/config.jelly | 4 ++-- .../tasks/ArtifactArchiver/help-allowEmptyArchive.html | 5 +++++ 3 files changed, 10 insertions(+), 9 deletions(-) create mode 100644 core/src/main/resources/hudson/tasks/ArtifactArchiver/help-allowEmptyArchive.html diff --git a/core/src/main/java/hudson/tasks/ArtifactArchiver.java b/core/src/main/java/hudson/tasks/ArtifactArchiver.java index 4f092119e4..5e903fcba3 100644 --- a/core/src/main/java/hudson/tasks/ArtifactArchiver.java +++ b/core/src/main/java/hudson/tasks/ArtifactArchiver.java @@ -41,6 +41,7 @@ import java.io.File; import java.io.IOException; import net.sf.json.JSONObject; +import javax.annotation.Nonnull; /** * Copies the artifacts into an archive directory. @@ -67,14 +68,9 @@ public class ArtifactArchiver extends Recorder { /** * Fail (or not) the build if archiving returns nothing. */ + @Nonnull private Boolean allowEmptyArchive; - /** - * Compatibility for systems using the older setting. - */ - private static final Boolean allowEmptyArchiveSystemProp = - Boolean.getBoolean(ArtifactArchiver.class.getName()+".warnOnEmpty"); - @DataBoundConstructor public ArtifactArchiver(String artifacts, String excludes, boolean latestOnly, boolean allowEmptyArchive) { this.artifacts = artifacts.trim(); @@ -86,7 +82,7 @@ public class ArtifactArchiver extends Recorder { // Backwards compatibility for older builds public Object readResolve() { if (allowEmptyArchive == null) { - this.allowEmptyArchive = allowEmptyArchiveSystemProp; + this.allowEmptyArchive = Boolean.getBoolean(ArtifactArchiver.class.getName()+".warnOnEmpty"); } return this; } diff --git a/core/src/main/resources/hudson/tasks/ArtifactArchiver/config.jelly b/core/src/main/resources/hudson/tasks/ArtifactArchiver/config.jelly index dbce5d776d..659b36011d 100644 --- a/core/src/main/resources/hudson/tasks/ArtifactArchiver/config.jelly +++ b/core/src/main/resources/hudson/tasks/ArtifactArchiver/config.jelly @@ -31,10 +31,10 @@ THE SOFTWARE. - + - + diff --git a/core/src/main/resources/hudson/tasks/ArtifactArchiver/help-allowEmptyArchive.html b/core/src/main/resources/hudson/tasks/ArtifactArchiver/help-allowEmptyArchive.html new file mode 100644 index 0000000000..2c97f795e4 --- /dev/null +++ b/core/src/main/resources/hudson/tasks/ArtifactArchiver/help-allowEmptyArchive.html @@ -0,0 +1,5 @@ +
+ Normally, a build fails if archiving returns zero artifacts. + This option allows the archiving process to return nothing without failing the build. + Instead, the build will simply throw a warning. +
\ No newline at end of file -- GitLab