use of org.apache.tools.ant.Project in project intellij-community by JetBrains.
the class Javac2 method buildClasspathClassLoader.
/**
* Create class loader based on classpath, bootclasspath, and sourcepath.
*
* @return a URL classloader
*/
private InstrumentationClassFinder buildClasspathClassLoader() {
final StringBuffer classPathBuffer = new StringBuffer();
final Project project = getProject();
final Path cp = new Path(project);
appendPath(cp, getBootclasspath());
cp.setLocation(getDestdir().getAbsoluteFile());
appendPath(cp, getClasspath());
appendPath(cp, getSourcepath());
appendPath(cp, getSrcdir());
if (getIncludeantruntime()) {
cp.addExisting(cp.concatSystemClasspath("last"));
}
boolean shouldInclude = getIncludejavaruntime();
if (!shouldInclude) {
if (project != null) {
final String propValue = project.getProperty(PROPERTY_INSTRUMENTATION_INCLUDE_JAVA_RUNTIME);
shouldInclude = !("false".equalsIgnoreCase(propValue) || "no".equalsIgnoreCase(propValue));
} else {
shouldInclude = true;
}
}
if (shouldInclude) {
cp.addJavaRuntime();
}
cp.addExtdirs(getExtdirs());
final String[] pathElements = cp.list();
for (int i = 0; i < pathElements.length; i++) {
final String pathElement = pathElements[i];
classPathBuffer.append(File.pathSeparator);
classPathBuffer.append(pathElement);
}
final String classPath = classPathBuffer.toString();
log("classpath=" + classPath, Project.MSG_VERBOSE);
try {
return createInstrumentationClassFinder(classPath);
} catch (MalformedURLException e) {
fireError(e.getMessage());
return null;
}
}
use of org.apache.tools.ant.Project in project robolectric by robolectric.
the class MavenDependencyResolverTest method setUp.
@Before
public void setUp() {
dependenciesTask = spy(new DependenciesTask());
doNothing().when(dependenciesTask).execute();
doAnswer(new Answer() {
@Override
public Void answer(InvocationOnMock invocationOnMock) throws Throwable {
invocationOnMock.callRealMethod();
Object[] args = invocationOnMock.getArguments();
project = (Project) args[0];
project.setProperty("group1:artifact1:jar", "path1");
project.setProperty("group2:artifact2:jar", "path2");
project.setProperty("group3:artifact3:jar:classifier3", "path3");
return null;
}
}).when(dependenciesTask).setProject(any(Project.class));
}
use of org.apache.tools.ant.Project in project randomizedtesting by randomizedtesting.
the class AntBuildFileTestBase method setupProject.
protected void setupProject(File projectFile) {
try {
restoreSysout = System.out;
restoreSyserr = System.err;
output = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(output, true, "UTF-8");
System.setOut(ps);
System.setErr(ps);
project = new Project();
project.init();
project.setUserProperty(MagicNames.ANT_FILE, projectFile.getAbsolutePath());
ProjectHelper.configureProject(project, projectFile);
listener = new DefaultLogger();
listener.setMessageOutputLevel(Project.MSG_DEBUG);
listener.setErrorPrintStream(ps);
listener.setOutputPrintStream(ps);
getProject().addBuildListener(listener);
DefaultLogger console = new DefaultLogger();
console.setMessageOutputLevel(Project.MSG_INFO);
console.setErrorPrintStream(restoreSyserr);
console.setOutputPrintStream(restoreSysout);
getProject().addBuildListener(console);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
use of org.apache.tools.ant.Project in project adempiere by adempiere.
the class CreateZipFile method zipFolder.
/**
* Zip the srcFolder into the destFileZipFile. All the folder subtree of the src folder is added to the destZipFile
* archive.
*
*
* @param srcFolder File, the path of the srcFolder
* @param destZipFile File, the path of the destination zipFile. This file will be created or erased.
*/
public static void zipFolder(File srcFolder, File destZipFile, String includesdir) {
Zip zipper = new Zip();
zipper.setDestFile(destZipFile);
zipper.setBasedir(srcFolder);
zipper.setIncludes(includesdir);
zipper.setUpdate(true);
zipper.setCompress(true);
zipper.setCaseSensitive(false);
zipper.setFilesonly(false);
zipper.setTaskName("zip");
zipper.setTaskType("zip");
zipper.setProject(new Project());
zipper.setOwningTarget(new Target());
zipper.execute();
System.out.println(destZipFile);
}
use of org.apache.tools.ant.Project in project aries by apache.
the class EsaTaskTest method generateArchiveNoManifest.
@Test
public void generateArchiveNoManifest() {
File srcDir = new File("../src/test/resources");
File destfile = new File("target/esa-test1.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.execute();
assertTrue(destfile.exists());
try {
ZipFile esaArchive = new ZipFile(destfile);
assertNotNull(esaArchive);
ZipEntry subsystemManifest = esaArchive.getEntry("OSGI-INF/SUBSYSTEM.MF");
assertNull(subsystemManifest);
} catch (IOException e) {
fail(e.getMessage());
}
}
Aggregations