ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/AntTasks/source/net/douglasthrift/anttasks/UnixZip.java
(Generate patch)

Comparing AntTasks/source/net/douglasthrift/anttasks/UnixZip.java (file contents):
Revision 974 by douglas, 2007-12-19T16:22:45-08:00 vs.
Revision 975 by douglas, 2007-12-19T22:56:17-08:00

# Line 21 | Line 21
21  
22   package net.douglasthrift.anttasks;
23  
24 < import java.io.File;
24 > import java.io.ByteArrayInputStream;
25 > import java.io.IOException;
26 > import java.util.ArrayList;
27  
28   import org.apache.tools.ant.Task;
29 < import org.apache.tools.ant.util.FileUtils;
28 <
29 < import org.apache.tools.zip.AsiExtraField;
30 < import org.apache.tools.zip.UnixStat;
31 < import org.apache.tools.zip.ZipEntry;
32 < import org.apache.tools.zip.ZipExtraField;
29 > import org.apache.tools.ant.taskdefs.Zip;
30   import org.apache.tools.zip.ZipOutputStream;
31  
32 < public class UnixZip extends Task
32 > public class UnixZip extends Zip
33   {
34 <        public void execute()
34 >        public static class Symlink extends Task
35 >        {
36 >                private String link;
37 >                private String resource;
38 >
39 >                public void setLink(String link)
40 >                {
41 >                        this.link = link;
42 >                }
43 >
44 >                public void setResource(String resource)
45 >                {
46 >                        this.resource = resource;
47 >                }
48 >        }
49 >
50 >        private ArrayList<Symlink> symlinks = new ArrayList<Symlink>();
51 >
52 >        public Symlink createSymlink()
53 >        {
54 >                Symlink symlink = new Symlink();
55 >
56 >                this.symlinks.add(symlink);
57 >
58 >                return symlink;
59 >        }
60 >
61 >        protected void finalizeZipOutputStream(ZipOutputStream output) throws IOException
62          {
63 +                for (Symlink symlink: symlinks)
64 +                        this.zipFile(new ByteArrayInputStream(symlink.resource.getBytes()), output, symlink.link, System.currentTimeMillis(), null, 0120755);
65          }
66   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines