use of org.apache.tools.ant.Target in project gradle by gradle.
the class DefaultAntBuilder method importBuild.
public void importBuild(Object antBuildFile, Transformer<? extends String, ? super String> taskNamer) {
File file = gradleProject.file(antBuildFile);
final File baseDir = file.getParentFile();
Set<String> existingAntTargets = new HashSet<String>(getAntProject().getTargets().keySet());
File oldBaseDir = getAntProject().getBaseDir();
getAntProject().setBaseDir(baseDir);
try {
getAntProject().setUserProperty(MagicNames.ANT_FILE, file.getAbsolutePath());
ProjectHelper.configureProject(getAntProject(), file);
} catch (Exception e) {
throw new GradleException("Could not import Ant build file '" + String.valueOf(file) + "'.", e);
} finally {
getAntProject().setBaseDir(oldBaseDir);
}
// Chuck away the implicit target. It has already been executed
getAntProject().getTargets().remove("");
// Add an adapter for each newly added target
Set<String> newAntTargets = new HashSet<String>(getAntProject().getTargets().keySet());
newAntTargets.removeAll(existingAntTargets);
for (String name : newAntTargets) {
final Target target = getAntProject().getTargets().get(name);
String taskName = taskNamer.transform(target.getName());
final AntTarget task = gradleProject.getTasks().create(taskName, AntTarget.class);
configureTask(target, task, baseDir, taskNamer);
}
}
use of org.apache.tools.ant.Target 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.Target in project adempiere by adempiere.
the class CreateZipFile method tarFolder.
public static void tarFolder(File srcFolder, File destTarFile, String includesdir) {
Tar tarer = new Tar();
tarer.setDestFile(destTarFile);
tarer.setBasedir(srcFolder);
tarer.setIncludes(includesdir);
tarer.setCaseSensitive(false);
tarer.setTaskName("tar");
tarer.setTaskType("tar");
tarer.setProject(new Project());
tarer.setOwningTarget(new Target());
tarer.execute();
}
use of org.apache.tools.ant.Target in project adempiere by adempiere.
the class CreateZipFile method gzipFile.
public static void gzipFile(File srcFile, File destFile) {
GZip GZiper = new GZip();
GZiper.setDestfile(destFile);
GZiper.setSrc(srcFile);
GZiper.setTaskName("gzip");
GZiper.setTaskType("gzip");
GZiper.setProject(new Project());
GZiper.setOwningTarget(new Target());
GZiper.execute();
}
use of org.apache.tools.ant.Target in project Gargoyle by callakrsos.
the class AntJavaCompilerTest method extracted.
private Target extracted(Project p) {
Target target = new Target() {
};
target.setProject(p);
target.setName("Hello build");
target.setDescription("Runtime Adding Target");
Echo echo = new Echo();
echo.setMessage("Hello ant build");
echo.setProject(p);
target.addTask(echo);
return target;
}
Aggregations