use of org.apache.tools.ant.taskdefs.Expand in project hudson-2.x by hudson.
the class ClassicPluginStrategy method explode.
/**
* Explodes the plugin into a directory, if necessary.
*/
private static void explode(File archive, File destDir) throws IOException {
if (!destDir.exists())
destDir.mkdirs();
// timestamp check
File explodeTime = new File(destDir, ".timestamp");
if (explodeTime.exists() && explodeTime.lastModified() == archive.lastModified())
// no need to expand
return;
// delete the contents so that old files won't interfere with new files
Util.deleteContentsRecursive(destDir);
try {
Expand e = new Expand();
e.setProject(new Project());
e.setTaskType("unzip");
e.setSrc(archive);
e.setDest(destDir);
e.execute();
} catch (BuildException x) {
throw new IOException2("Failed to expand " + archive, x);
}
try {
new FilePath(explodeTime).touch(archive.lastModified());
} catch (InterruptedException e) {
// impossible
throw new AssertionError(e);
}
}
use of org.apache.tools.ant.taskdefs.Expand in project adempiere by adempiere.
the class CreateZipFile method unpackFile.
public static void unpackFile(File zipFilepath, File destinationDir) {
Expand Unzipper = new Expand();
Unzipper.setDest(destinationDir);
Unzipper.setSrc(zipFilepath);
Unzipper.setTaskType("unzip");
Unzipper.setTaskName("unzip");
Unzipper.setProject(new Project());
Unzipper.setOwningTarget(new Target());
Unzipper.execute();
}
use of org.apache.tools.ant.taskdefs.Expand in project JessMA by ldcsaa.
the class UnArchiver method getTask.
/** 获取解压任务对象 */
@Override
protected Task getTask() {
Project project = new Project();
Expand expand = getExpand();
PatternSet ps = getPatternSet();
expand.setProject(project);
expand.setSrc(getSourceFile());
expand.setDest(getTargetDir());
expand.setOverwrite(isOverwrite());
if (ps != null) {
ps.setProject(project);
expand.addPatternset(ps);
}
return expand;
}
Aggregations