use of org.apache.tools.ant.Project in project aries by apache.
the class EsaTaskTest method generateArchiveWithFileManifest.
@Test
public void generateArchiveWithFileManifest() {
File srcDir = new File("../src/test/resources");
File destfile = new File("target/esa-test2.esa");
if (destfile.exists()) {
destfile.delete();
}
assertFalse(destfile.exists());
EsaTask esaTask = new EsaTask();
Project testProject = new Project();
esaTask.setProject(testProject);
FileSet fileSet = new FileSet();
fileSet.setDir(srcDir);
fileSet.setIncludes("*.jar");
esaTask.addFileset(fileSet);
esaTask.setDestFile(destfile);
esaTask.setSymbolicName("esatask-test");
esaTask.setVersion("1.0.0");
esaTask.setManifest(new File(srcDir, "SUBSYSTEM.MF"));
esaTask.execute();
assertTrue(destfile.exists());
try {
ZipFile esaArchive = new ZipFile(destfile);
assertNotNull(esaArchive);
ZipEntry subsystemManifest = esaArchive.getEntry("OSGI-INF/SUBSYSTEM.MF");
assertNotNull(subsystemManifest);
} catch (IOException e) {
fail(e.getMessage());
}
}
use of org.apache.tools.ant.Project in project ceylon-compiler by ceylon.
the class SelectToolTask method execute.
@Override
public void execute() {
Project p = getProject();
Properties props = readProperties(propertyFile);
toolName = props.getProperty("tool.name");
if (toolName != null) {
toolArgs = props.getProperty(toolName + ".args", "");
}
if (toolProperty == null || askIfUnset && (toolName == null || (argsProperty != null && toolArgs == null))) {
showGUI(props);
}
// finally, return required values, if any
if (toolProperty != null && !(toolName == null || toolName.equals(""))) {
p.setProperty(toolProperty, toolName);
if (argsProperty != null && toolArgs != null)
p.setProperty(argsProperty, toolArgs);
}
}
use of org.apache.tools.ant.Project in project Gargoyle by callakrsos.
the class AntJavaCompilerTest method runtimeAddingTarget.
@Test
public void runtimeAddingTarget() {
Project p = new Project();
p.init();
p.addTarget(extracted(p));
p.addBuildListener(extracted());
p.executeTarget("Hello build");
}
use of org.apache.tools.ant.Project in project bnd by bndtools.
the class ExpandPropertiesTask method execute.
@Override
@SuppressWarnings("cast")
public void execute() throws BuildException {
try {
if (propertyFile.exists()) {
Properties properties = new UTF8Properties();
properties.putAll((Map<?, ?>) getProject().getProperties());
try (Processor processor = new Processor(properties)) {
processor.setProperties(propertyFile);
Project project = getProject();
Properties flattened = processor.getFlattenedProperties();
for (Iterator<Object> i = flattened.keySet().iterator(); i.hasNext(); ) {
String key = (String) i.next();
if (project.getProperty(key) == null) {
project.setProperty(key, flattened.getProperty(key));
}
}
}
}
report();
} catch (IOException e) {
e.printStackTrace();
throw new BuildException(e);
}
}
use of org.apache.tools.ant.Project in project Gargoyle by callakrsos.
the class AntJavaCompiler method parse.
/**
*
* build.xml파일을 파싱처리하여
* 빌드처리 준비상태로 처리한다.
* 이후 run 함수를 호출하여 빌드를 실행할 수 있다.
*
* @작성자 : KYJ
* @작성일 : 2017. 3. 7.
*/
public void parse() {
p = new Project();
p.setUserProperty("ant.file", buildFile.getAbsolutePath());
p.setUserProperty("encoding", encoding.displayName());
p.init();
helper = ProjectHelper.getProjectHelper();
p.addReference("ant.projectHelper", helper);
if (baseDir != null && baseDir.exists())
p.setBaseDir(baseDir);
else
p.setBaseDir(buildFile.getParentFile());
//setting console
DefaultLogger consoleLogger = getLogger();
consoleLogger.setOutputPrintStream(new PrintStream(out));
consoleLogger.setErrorPrintStream(new PrintStream(err));
consoleLogger.setMessageOutputLevel(Project.MSG_VERBOSE);
p.addBuildListener(consoleLogger);
//parse build.xml
helper.parse(p, buildFile);
LOGGER.debug(" ##### base dir : " + p.getBaseDir());
LOGGER.debug(" ##### default target : " + p.getDefaultTarget());
//append build debugger.
BuildListener buildListener = getBuildListener();
if (buildListener != null)
p.addBuildListener(buildListener);
wasParse = true;
}
Aggregations