Skip to content
Permalink
Browse files

[FIXED JENKINS-16681] Don't let Ant separate the patterns - and allow…

… the separator regex to be configured to enable patterns with spaces in them
  • Loading branch information
bap2000 committed Feb 10, 2013
1 parent 10181aa commit a972ce7c0c4d6695e7a80aa5de96f3e833e04d9a
@@ -42,14 +42,14 @@

public BapFtpTransfer(final String sourceFiles, final String remoteDirectory, final String removePrefix, final boolean asciiMode,
final boolean remoteDirectorySDF, final boolean flatten) {
this(sourceFiles, null, remoteDirectory, removePrefix, asciiMode, remoteDirectorySDF, flatten, false, false, false);
this(sourceFiles, null, remoteDirectory, removePrefix, asciiMode, remoteDirectorySDF, flatten, false, false, false, null);
}

@DataBoundConstructor
public BapFtpTransfer(final String sourceFiles, final String excludes, final String remoteDirectory, final String removePrefix,
final boolean asciiMode, final boolean remoteDirectorySDF, final boolean flatten, final boolean cleanRemote,
final boolean noDefaultExcludes, final boolean makeEmptyDirs) {
super(sourceFiles, excludes, remoteDirectory, removePrefix, remoteDirectorySDF, flatten, cleanRemote, noDefaultExcludes, makeEmptyDirs);
final boolean noDefaultExcludes, final boolean makeEmptyDirs, final String patternSeparator) {
super(sourceFiles, excludes, remoteDirectory, removePrefix, remoteDirectorySDF, flatten, cleanRemote, noDefaultExcludes, makeEmptyDirs, patternSeparator);
this.asciiMode = asciiMode;
}

@@ -5,6 +5,7 @@
import hudson.model.Hudson;
import hudson.util.FormValidation;
import jenkins.plugins.publish_over.BPTransfer;
import jenkins.plugins.publish_over.BPValidators;
import jenkins.plugins.publish_over_ftp.BapFtpPublisherPlugin;
import jenkins.plugins.publish_over_ftp.BapFtpTransfer;
import jenkins.plugins.publish_over_ftp.Messages;
@@ -30,6 +31,10 @@ public FormValidation doCheckSourceFiles(@QueryParameter final String value) {
return FormValidation.validateRequired(value);
}

public FormValidation doCheckPatternSeparator(@QueryParameter final String value) {
return BPValidators.validateRegularExpression(value);
}

public jenkins.plugins.publish_over.view_defaults.BPTransfer.Messages getCommonFieldNames() {
return new jenkins.plugins.publish_over.view_defaults.BPTransfer.Messages();
}
@@ -43,12 +43,13 @@
private final boolean cleanRemote;
private final boolean noDefaultExcludes;
private final boolean makeEmptyDirs;
private final String patternSeparator;

@DataBoundConstructor
public FtpOverrideTransferDefaults(final String sourceFiles, final String excludes, final String removePrefix,
final String remoteDirectory, final boolean flatten, boolean remoteDirectorySDF,
final boolean cleanRemote, final boolean asciiMode, final boolean noDefaultExcludes,
final boolean makeEmptyDirs) {
final boolean makeEmptyDirs, final String patternSeparator) {
this.asciiMode = asciiMode;
this.cleanRemote = cleanRemote;
this.excludes = excludes;
@@ -59,6 +60,7 @@ public FtpOverrideTransferDefaults(final String sourceFiles, final String exclud
this.sourceFiles = sourceFiles;
this.noDefaultExcludes = noDefaultExcludes;
this.makeEmptyDirs = makeEmptyDirs;
this.patternSeparator = patternSeparator;
}

public String getSourceFiles() {
@@ -101,6 +103,10 @@ public boolean isMakeEmptyDirs() {
return makeEmptyDirs;
}

public String getPatternSeparator() {
return patternSeparator;
}

public FtpOverrideTransferDefaultsDescriptor getDescriptor() {
return Hudson.getInstance().getDescriptorByType(FtpOverrideTransferDefaultsDescriptor.class);
}
@@ -50,6 +50,10 @@
<f:textbox default="${defaults.transfer.excludes}"/>
</f:entry>

<f:entry title="${m.patternSeparator()}" field="patternSeparator">
<f:textbox default="${defaults.transfer.patternSeparator}"/>
</f:entry>

<f:entry title="${m.noDefaultExcludes()}" field="noDefaultExcludes">
<f:checkbox default="${defaults.transfer.noDefaultExcludes}"/>
</f:entry>
@@ -0,0 +1,33 @@
<!--
~ The MIT License
~
~ Copyright (C) 2010-2013 by Anthony Robinson
~
~ Permission is hereby granted, free of charge, to any person obtaining a copy
~ of this software and associated documentation files (the "Software"), to deal
~ in the Software without restriction, including without limitation the rights
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
~ copies of the Software, and to permit persons to whom the Software is
~ furnished to do so, subject to the following conditions:
~
~ The above copyright notice and this permission notice shall be included in
~ all copies or substantial portions of the Software.
~
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
~ THE SOFTWARE.
-->

<div>
<p>The regular expression that is used to separate the <tt>Source files</tt> and <tt>Exclude files</tt> patterns.</p>
<p>The <tt>Source files</tt> and <tt>Exclude files</tt> both accept multiple patterns that by default are split using <pre>[, ]+</pre>
which is how Ant, by default, handles multiple patterns in a single string.
</p>
<p>The above expression makes it difficult to reference files or directories that contain spaces. This option allows
the expression to be set to something that will preserve the spaces in a pattern eg. a single comma.
</p>
</div>
@@ -40,6 +40,9 @@
<f:entry title="${m.excludes()}" field="excludes">
<f:textbox default="${defaults.transfer.excludes}"/>
</f:entry>
<f:entry title="${m.patternSeparator()}" field="patternSeparator">
<f:textbox default="${defaults.transfer.patternSeparator}"/>
</f:entry>
<f:entry title="${m.noDefaultExcludes()}" field="noDefaultExcludes">
<f:checkbox default="${defaults.transfer.noDefaultExcludes}"/>
</f:entry>
@@ -75,9 +75,9 @@ public void dontTestRoundTrip() throws Exception {
// public void testConfigureGlobal() throws Exception {}

private BapFtpPublisherPlugin createPlugin(final String config1, final String config2) {
final BapFtpTransfer transfer1 = new BapFtpTransfer("**/*", null, "/pub", "target", true, false, true, false, false, false);
final BapFtpTransfer transfer2 = new BapFtpTransfer("*", null, "", "WebApp", false, true, false, false, false, false);
final BapFtpTransfer transfer3 = new BapFtpTransfer("dave", null, "", "", false, true, true, false, false, false);
final BapFtpTransfer transfer1 = new BapFtpTransfer("**/*", null, "/pub", "target", true, false, true, false, false, false, null);
final BapFtpTransfer transfer2 = new BapFtpTransfer("*", null, "", "WebApp", false, true, false, false, false, false, null);
final BapFtpTransfer transfer3 = new BapFtpTransfer("dave", null, "", "", false, true, true, false, false, false, null);
final ArrayList<BapFtpTransfer> transfers1 = new ArrayList<BapFtpTransfer>();
transfers1.add(transfer1);
transfers1.add(transfer2);
@@ -72,7 +72,7 @@ public FTPClient createFTPClient() {
};
new JenkinsTestHelper().setGlobalConfig(testHostConfig);
final String dirToIgnore = "target";
final BapFtpTransfer transfer = new BapFtpTransfer("**/*", null, "sub-home", dirToIgnore, true, false, false, false, false, false);
final BapFtpTransfer transfer = new BapFtpTransfer("**/*", null, "sub-home", dirToIgnore, true, false, false, false, false, false, null);
final ArrayList transfers = new ArrayList(Collections.singletonList(transfer));
final BapFtpPublisher publisher = new BapFtpPublisher(testHostConfig.getName(), false, transfers, false, false, null, null, null);
final ArrayList publishers = new ArrayList(Collections.singletonList(publisher));
@@ -52,13 +52,13 @@ public void testLoadR0x1() throws Exception {
assertEquals(createHostConfiguration("b", expectedConfigBPort, expectedConfigBTimeout, true), configurations.get(1));

final BapFtpTransfer transfer1 = new BapFtpTransfer("**/*", null, "'helloo-${BUILD_NUMBER}'-MMDD", "target",
true, true, true, false, false, false);
true, true, true, false, false, false, null);
final ArrayList<BapFtpTransfer> transfers1 = new ArrayList<BapFtpTransfer>();
transfers1.add(transfer1);
final BapFtpPublisher publisher1 = new BapFtpPublisher("Config b", true, transfers1, false, false, null, null, null);
final BapFtpTransfer transfer21 = new BapFtpTransfer("target\\images\\*", null, "", "", false, false, false, false, false, false);
final BapFtpTransfer transfer21 = new BapFtpTransfer("target\\images\\*", null, "", "", false, false, false, false, false, false, null);
final BapFtpTransfer transfer22 = new BapFtpTransfer("target\\logs\\**\\*", null, "serverlogs", "target\\logs",
true, false, true, false, false, false);
true, false, true, false, false, false, null);
final ArrayList<BapFtpTransfer> transfers2 = new ArrayList<BapFtpTransfer>();
transfers2.add(transfer21);
transfers2.add(transfer22);

1 comment on commit a972ce7

@buildhive

This comment has been minimized.

Copy link

@buildhive buildhive commented on a972ce7 Feb 11, 2013

Jenkins » publish-over-ftp-plugin #12 FAILURE
Looks like this commit caused a build failure
(what's this?)

Please sign in to comment.
You can’t perform that action at this time.