Skip to content

Commit

Permalink
[FIXED JENKINS-13693] Add option to disable default excludes
Browse files Browse the repository at this point in the history
  • Loading branch information
bap2000 committed Jul 24, 2012
1 parent 9be8374 commit b079339
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -69,7 +69,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>publish-over</artifactId>
<version>0.13</version>
<version>0.15-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.samba.jcifs</groupId>
Expand Down
Expand Up @@ -37,8 +37,8 @@ public class CifsTransfer extends BPTransfer {

@DataBoundConstructor
public CifsTransfer(final String sourceFiles, final String excludes, final String remoteDirectory, final String removePrefix,
final boolean remoteDirectorySDF, final boolean flatten, final boolean cleanRemote) {
super(sourceFiles, excludes, remoteDirectory, removePrefix, remoteDirectorySDF, flatten, cleanRemote);
final boolean remoteDirectorySDF, final boolean flatten, final boolean cleanRemote, final boolean noDefaultExcludes) {
super(sourceFiles, excludes, remoteDirectory, removePrefix, remoteDirectorySDF, flatten, cleanRemote, noDefaultExcludes);
}

public boolean equals(final Object that) {
Expand Down
Expand Up @@ -132,6 +132,9 @@ public FormValidation doCheckRetryDelay(@QueryParameter final String value) {
public boolean canUseExcludes() {
return BPTransfer.canUseExcludes();
}
public boolean canUseNoDefaultExcludes() {
return BPTransfer.canUseNoDefaultExcludes();

This comment has been minimized.

Copy link
@ndeloof
}
public String getDefaultMasterNodeName() {
return BPInstanceConfig.DEFAULT_MASTER_NODE_NAME;
}
Expand Down
Expand Up @@ -41,18 +41,20 @@ public class CifsOverrideTransferDefaults implements TransferOptions, Describabl
private final boolean remoteDirectorySDF;
private final boolean flatten;
private final boolean cleanRemote;
private final boolean noDefaultExcludes;

@DataBoundConstructor
public CifsOverrideTransferDefaults(final String sourceFiles, final String excludes, final String removePrefix,
final String remoteDirectory, final boolean flatten, final boolean remoteDirectorySDF,
final boolean cleanRemote) {
final boolean cleanRemote, final boolean noDefaultExcludes) {
this.cleanRemote = cleanRemote;
this.excludes = excludes;
this.flatten = flatten;
this.remoteDirectory = remoteDirectory;
this.remoteDirectorySDF = remoteDirectorySDF;
this.removePrefix = removePrefix;
this.sourceFiles = sourceFiles;
this.noDefaultExcludes = noDefaultExcludes;
}

public String getSourceFiles() {
Expand Down Expand Up @@ -83,6 +85,10 @@ public boolean isCleanRemote() {
return cleanRemote;
}

public boolean isNoDefaultExcludes() {
return noDefaultExcludes;
}

public CifsOverrideTransferDefaultsDescriptor getDescriptor() {
return Hudson.getInstance().getDescriptorByType(CifsOverrideTransferDefaultsDescriptor.class);
}
Expand All @@ -99,6 +105,10 @@ public boolean canUseExcludes() {
return BPTransfer.canUseExcludes();
}

public boolean canUseNoDefaultExcludes() {
return BPTransfer.canUseNoDefaultExcludes();
}

public jenkins.plugins.publish_over.view_defaults.BPTransfer.Messages getCommonFieldNames() {
return new jenkins.plugins.publish_over.view_defaults.BPTransfer.Messages();
}
Expand Down
Expand Up @@ -115,6 +115,12 @@
</f:entry>
</j:if>

<j:if test="${descriptor.publisherDescriptor.canUseNoDefaultExcludes()}">
<f:entry title="${m_trans.noDefaultExcludes()}" help="${descriptor.publisherDescriptor.getHelpFile('noDefaultExcludes')}">
<f:checkbox name="noDefaultExcludes" value="${transfer.noDefaultExcludes}" default="${defaults.transfer.noDefaultExcludes}"/>
</f:entry>
</j:if>

<f:entry title="${m_trans.flatten()}" help="${helpUrl}flatten.html">
<f:checkbox name="flatten" checked="${transfer.flatten}" default="${defaults.transfer.flatten}"/>
</f:entry>
Expand Down
Expand Up @@ -56,7 +56,7 @@
<f:textbox name="_.port" value="${instance.port}" default="${defaultPort}" checkUrl="${descriptor.getCheckUrl('port')}"/>
</f:entry>
<f:entry title="${m.timeout()}" help="${helpUrl}timeout.html">
<f:textbox name="_.timeout" value="${instance.timeout}" default="${defaultTimeout}" checkUrl="${descriptor.getCheckUrl('timeout')}"/>
<f:textbox name="_.timeout" value="${instance.timeOut}" default="${defaultTimeout}" checkUrl="${descriptor.getCheckUrl('timeout')}"/>
</f:entry>
</f:advanced>
<f:validateButton
Expand Down
@@ -0,0 +1,39 @@
<?jelly escape-by-default='true'?>

<!--
~ The MIT License
~
~ Copyright (C) 2012 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.
-->

<j:jelly xmlns:j="jelly:core">

Select this option to disable the default exclude patterns.
<p>The default exclude patterns are:
<j:invokeStatic var="defaultExcludes" method="getDefaultExcludes" className="org.apache.tools.ant.DirectoryScanner"/>
<pre>
<j:forEach var="pattern" items="${defaultExcludes}">
${pattern}<br/>
</j:forEach>
</pre>
</p>

</j:jelly>
Expand Up @@ -42,6 +42,11 @@
<f:textbox default="${defaults.transfer.excludes}"/>
</f:entry>
</j:if>
<j:if test="${descriptor.canUseNoDefaultExcludes()}">
<f:entry title="${m.noDefaultExcludes()}" field="noDefaultExcludes">
<f:checkbox default="${defaults.transfer.noDefaultExcludes}"/>
</f:entry>
</j:if>
<f:entry title="${m.flatten()}" field="flatten">
<f:checkbox default="${defaults.transfer.flatten}"/>
</f:entry>
Expand Down
Expand Up @@ -152,7 +152,7 @@ public class CifsClientTest {

@Test public void testBeginTransfersFailIfNoSourceFiles() throws Exception {
try {
new CifsClient(buildInfo, TEST_ROOT_URL, null).beginTransfers(new CifsTransfer("", "", "", "", false, false, false));
new CifsClient(buildInfo, TEST_ROOT_URL, null).beginTransfers(new CifsTransfer("", "", "", "", false, false, false, false));
fail();
} catch (BapPublisherException bpe) {
assertEquals(Messages.exception_noSourceFiles(), bpe.getMessage());
Expand Down

0 comments on commit b079339

Please sign in to comment.