提交 5f194852 编写于 作者: K kohsuke

added the excludes pattern support.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@1988 71c3de6d-444a-0410-be80-ed276b4c234a
上级 704467b9
......@@ -506,13 +506,19 @@ public final class FilePath implements Serializable {
void close() throws IOException;
}
public int copyRecursiveTo(String fileMask, FilePath target) throws IOException, InterruptedException {
return copyRecursiveTo(fileMask,null,target);
}
/**
* Copies the files that match the given file mask to the specified target node.
*
* @param excludes
* Files to be excluded. Can be null.
* @return
* the number of files copied.
*/
public int copyRecursiveTo(final String fileMask, final FilePath target) throws IOException, InterruptedException {
public int copyRecursiveTo(final String fileMask, final String excludes, final FilePath target) throws IOException, InterruptedException {
if(this.channel==target.channel) {
// local to local copy.
return act(new FileCallable<Integer>() {
......@@ -542,6 +548,7 @@ public final class FilePath implements Serializable {
FileSet src = new FileSet();
src.setDir(base);
src.setIncludes(fileMask);
src.setExcludes(excludes);
copyTask.addFileset(src);
copyTask.execute();
......
......@@ -24,13 +24,19 @@ public class ArtifactArchiver extends Publisher {
*/
private final String artifacts;
/**
* Possibly null 'excludes' pattern as in Ant.
*/
private final String excludes;
/**
* Just keep the last successful artifact set, no more.
*/
private final boolean latestOnly;
public ArtifactArchiver(String artifacts, boolean latestOnly) {
public ArtifactArchiver(String artifacts, String excludes, boolean latestOnly) {
this.artifacts = artifacts;
this.excludes = excludes;
this.latestOnly = latestOnly;
}
......@@ -38,6 +44,10 @@ public class ArtifactArchiver extends Publisher {
return artifacts;
}
public String getExcludes() {
return excludes;
}
public boolean isLatestOnly() {
return latestOnly;
}
......@@ -97,6 +107,7 @@ public class ArtifactArchiver extends Publisher {
public Publisher newInstance(StaplerRequest req) {
return new ArtifactArchiver(
req.getParameter("artifacts").trim(),
Util.fixEmpty(req.getParameter("artifacts_excludes").trim()),
req.getParameter("artifacts_latest_only")!=null);
}
};
......
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<f:entry title="Files to archive"
description="
Can use wildcards like 'module/dist/**/*.zip'.
See &lt;a href='http://ant.apache.org/manual/CoreTypes/fileset.html'>
the @includes of Ant fileset&lt;/a> for the exact format.
the base directory is &lt;a href='ws/'>the workspace&lt;/a>.
">
<input class="setting-input" name="artifacts"
type="text" value="${instance.artifacts}"/>
<f:entry title="Files to archive" help="/help/tasks/artifactArchiver/includes.html">
<f:textbox name="artifacts" value="${instance.artifacts}"/>
</f:entry>
<f:entry title="">
<f:checkbox name="artifacts_latest_only" checked="${instance.latestOnly}" />
Discard all but the last successful artifact to save disk space
</f:entry>
<f:advanced>
<f:entry title="Excludes" help="/help/tasks/artifactArchiver/excludes.html">
<f:textbox name="artifacts_excludes" value="${instance.excludes}"/>
</f:entry>
<f:entry title="">
<f:checkbox name="artifacts_latest_only" checked="${instance.latestOnly}" />
Discard all but the last successful artifact to save disk space
</f:entry>
</f:advanced>
</j:jelly>
\ No newline at end of file
......@@ -68,7 +68,7 @@
<!--
enable automatic reloading when some files change.
-->
<scanIntervalSeconds>1</scanIntervalSeconds>
<!--scanIntervalSeconds>1</scanIntervalSeconds-->
<webAppSourceDirectory>${basedir}/resources</webAppSourceDirectory>
<systemProperties>
<systemProperty>
......
<div>
Optionally specify <a href='http://ant.apache.org/manual/CoreTypes/fileset.html'>the 'excludes' pattern</a>,
such as "foo/bar/**/*". Files that match this mask will not be archived even if it matches the
mask specified in 'files to archive' section.
</div>
\ No newline at end of file
<div>
Can use wildcards like 'module/dist/**/*.zip'.
See <a href='http://ant.apache.org/manual/CoreTypes/fileset.html'>
the @includes of Ant fileset</a> for the exact format.
the base directory is <a href='ws/'>the workspace</a>.
</div>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册