From 1f00f6cea00524f072f64ee83c45f39257b004f3 Mon Sep 17 00:00:00 2001 From: abayer Date: Thu, 4 Mar 2010 18:30:32 +0000 Subject: [PATCH] Changed FileSystemProvisioner.snapshot to take a glob argument git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@28263 71c3de6d-444a-0410-be80-ed276b4c234a --- .../main/java/hudson/FileSystemProvisioner.java | 16 +++++++++++++--- .../java/hudson/os/solaris/ZFSProvisioner.java | 7 +++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/hudson/FileSystemProvisioner.java b/core/src/main/java/hudson/FileSystemProvisioner.java index 7f12f20af5..3a88861316 100644 --- a/core/src/main/java/hudson/FileSystemProvisioner.java +++ b/core/src/main/java/hudson/FileSystemProvisioner.java @@ -167,8 +167,11 @@ public abstract class FileSystemProvisioner implements ExtensionPoint, Describab * @param ws * New workspace should be prepared in this location. This is the same value as * {@code build.getProject().getWorkspace()} but passed separately for convenience. + * @param glob + * Ant-style file glob for files to include in the snapshot. May not be pertinent for all + * implementations. */ - public abstract WorkspaceSnapshot snapshot(AbstractBuild build, FilePath ws, TaskListener listener) throws IOException, InterruptedException; + public abstract WorkspaceSnapshot snapshot(AbstractBuild build, FilePath ws, String glob, TaskListener listener) throws IOException, InterruptedException; public FileSystemProvisionerDescriptor getDescriptor() { return (FileSystemProvisionerDescriptor) Hudson.getInstance().getDescriptorOrDie(getClass()); @@ -198,13 +201,20 @@ public abstract class FileSystemProvisioner implements ExtensionPoint, Describab } /** - * Creates a tar ball. + * @deprecated as of 1.350 */ public WorkspaceSnapshot snapshot(AbstractBuild build, FilePath ws, TaskListener listener) throws IOException, InterruptedException { + return snapshot(build, ws, "**/*", listener); + } + + /** + * Creates a tar ball. + */ + public WorkspaceSnapshot snapshot(AbstractBuild build, FilePath ws, String glob, TaskListener listener) throws IOException, InterruptedException { File wss = new File(build.getRootDir(),"workspace.zip"); OutputStream os = new BufferedOutputStream(new FileOutputStream(wss)); try { - ws.zip(os); + ws.zip(os,glob); } finally { os.close(); } diff --git a/core/src/main/java/hudson/os/solaris/ZFSProvisioner.java b/core/src/main/java/hudson/os/solaris/ZFSProvisioner.java index 3c45a12011..78a7abb00c 100644 --- a/core/src/main/java/hudson/os/solaris/ZFSProvisioner.java +++ b/core/src/main/java/hudson/os/solaris/ZFSProvisioner.java @@ -95,10 +95,17 @@ public class ZFSProvisioner extends FileSystemProvisioner implements Serializabl }); } + /** + * @deprecated as of 1.350 + */ public WorkspaceSnapshot snapshot(AbstractBuild build, FilePath ws, TaskListener listener) throws IOException, InterruptedException { throw new UnsupportedOperationException(); } + public WorkspaceSnapshot snapshot(AbstractBuild build, FilePath ws, String glob, TaskListener listener) throws IOException, InterruptedException { + throw new UnsupportedOperationException(); + } + @Extension public static final class DescriptorImpl extends FileSystemProvisionerDescriptor { public boolean discard(FilePath ws, TaskListener listener) throws IOException, InterruptedException {