Examples of Zip


Examples of org.apache.tools.ant.taskdefs.Zip

        }
    }

    @Test
    public void testzipentryoutput() {
        Zip z = new Zip();
        z.setProject(project);
        Zip.WhenEmpty create = new Zip.WhenEmpty();
        create.setValue("create");
        z.setWhenempty(create);
        z.setBasedir(basedir);
        z.setExcludes("**/*");
        File f = project.resolveFile("foo");
        z.setDestFile(f);
        z.execute();
        ZipResource r = new ZipResource();
        r.setZipfile(f);
        r.setName("foo");
        try {
            testoutputbe(r);
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.Zip

            rc.setIncludes("bin/*.bat");
            tar.add(rc);

            archiver = tar;
        } else if ("zip".equals(artifact.getType())) {
            Zip zip = new Zip();
            zip.setDestFile(dest);
            ZipFileSet fs = new ZipFileSet();
            fs.setDir(source);
            fs.setPrefix(serverName);
            fs.setProject(project);
            zip.addFileset(fs);
            archiver = zip;
        } else {
            throw new IllegalArgumentException("Unknown target type: " + artifact.getType());
        }
        archiver.setProject(project);
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.Zip

            if(xmlDescriptor != null) {
                log("got module descriptor from woj ("+(System.currentTimeMillis() - start)+"ms)", Project.MSG_DEBUG);
                start = System.currentTimeMillis();
                writeFile(new File(getModuleDir(), Parameters.MODULE_DESCRIPTOR_FILE_NAME), xmlDescriptor);
               
                Zip zip = new Zip();
                zip.setTaskName(getTaskName());
                zip.setProject(getProject());
                zip.setBasedir(getModuleDir());
                zip.setDestFile(moduleZipFile);
                zip.execute();
               
                log("module zip built ("+(System.currentTimeMillis() - start)+"ms) - ready to upload to WOJ", Project.MSG_VERBOSE);
                return moduleZipFile;
            } else {
                throw new BuildException("impossible to get module descriptor from woj - your module was not accepted");
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.Zip

    private void createZipFile(final File theZipFile,
        final File theExistingFile)
    {
        Project antProject = new Project();
        antProject.init();
        Zip zip = new Zip();
        zip.setProject(antProject);
        zip.setDestFile(theZipFile);
        FileSet existingFileSet = new FileSet();
        existingFileSet.setFile(theExistingFile);
        zip.addFileset(existingFileSet);
        zip.execute();
    }
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.Zip

        project.setBaseDir( mojo.getOutputDirectory() );

        // ZIP Archive
        if ( archiveType.equalsIgnoreCase( "zip" ) )
        {
            Zip zipTask = new Zip();
            zipTask.setProject( project );
            zipTask.setDestFile( finalFile );
            zipTask.setBasedir( getTargetDirectory() );
            zipTask.setIncludes( getArchiveDirectory().getName() + "/**" );
            zipTask.execute();
        }
        // TAR Archive
        else if ( archiveType.equalsIgnoreCase( "tar" ) )
        {
            Tar tarTask = new Tar();
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.Zip

        project.setBaseDir( mojo.getOutputDirectory() );

        // ZIP Archive
        if ( archiveType.equalsIgnoreCase( "zip" ) )
        {
            Zip zipTask = new Zip();
            zipTask.setProject( project );
            zipTask.setDestFile( finalFile );
            zipTask.setBasedir( getTargetDirectory() );
            zipTask.setIncludes( getArchiveDirectory().getName() + "/**" );
            zipTask.execute();
        }
        // TAR Archive
        else if ( archiveType.equalsIgnoreCase( "tar" ) )
        {
            Tar tarTask = new Tar();
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.Zip

        return Arrays.asList(result);
    }

    protected Zip createTask() {
        Zip task = new Zip();
        task.setTaskName("zip");
        return task;
    }
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.Zip

            }
        }
    }

    public void testzipentryoutput() {
        Zip z = new Zip();
        z.setProject(getProject());
        Zip.WhenEmpty create = new Zip.WhenEmpty();
        create.setValue("create");
        z.setWhenempty(create);
        z.setBasedir(basedir);
        z.setExcludes("**/*");
        File f = getProject().resolveFile("foo");
        z.setDestFile(f);
        z.execute();
        ZipResource r = new ZipResource();
        r.setZipfile(f);
        r.setName("foo");
        try {
            testoutputbe(r);
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.Zip

                }
            }

            archiver = tar;
        } else if ("zip".equals(artifact.getType())) {
            Zip zip = new Zip();
            zip.setDestFile(dest);
            ZipFileSet fs = new ZipFileSet();
            fs.setDir(source);
            fs.setPrefix(serverName);
            fs.setProject(project);
            zip.addFileset(fs);

            for (Resource resource: this.project.getResources()) {
                File resourceFile = new File(resource.getDirectory());
                if (resourceFile.exists()) {
                    fs = new ZipFileSet();
                    fs.setPrefix(serverName);
                    fs.setProject(project);
                    fs.setDir(resourceFile);
                    fs.appendIncludes(resource.getIncludes().toArray(new String[0]));
                    fs.appendExcludes(resource.getExcludes().toArray(new String[0]));
                    zip.add(fs);
                }
            }

            archiver = zip;
        } else {
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.Zip

             * @param dest
             * @param paths
             */
            @Override
            public void zip(String dest, Collection<String> paths) {
                final Zip zip = new Zip();

                zip.setCompress(false);
                zip.setDestFile(new File(dest));
                zip.setProject(new Project());

                if (paths.size() != 1) {
                    for (String path : paths) {
                        final ZipFileSet set = new ZipFileSet();

                        final File file = new File(path);

                        set.setDir(file.getParentFile());
                        set.setIncludes(file.getName());

                        zip.addZipfileset(set);
                    }
                } else {
                    final ZipFileSet set = new ZipFileSet();

                    final File toAdd = new File(paths.iterator().next());

                    if (toAdd.isDirectory()) {
                        set.setDir(toAdd);
                    } else {
                        set.setFile(toAdd);
                    }

                    zip.addZipfileset(set);
                }

                zip.execute();
            }

            @Override
            public String newTempDir() {
                final File bearDir = new File(FileUtils.getTempDirectory(), "bear");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.