use of org.apache.tools.ant.types.resources.FileResource in project ant by apache.
the class XSLTProcess method configureLiaison.
/**
* Loads the stylesheet and set xsl:param parameters.
*
* @param stylesheet the file from which to load the stylesheet.
* @exception BuildException if the stylesheet cannot be loaded.
* @deprecated since Ant 1.7
*/
@Deprecated
protected void configureLiaison(final File stylesheet) throws BuildException {
final FileResource fr = new FileResource();
fr.setProject(getProject());
fr.setFile(stylesheet);
configureLiaison(fr);
}
use of org.apache.tools.ant.types.resources.FileResource in project ant by apache.
the class XmlProperty method getResource.
/**
* @return the resource.
*/
protected Resource getResource() {
// delegate this way around to support subclasses that
// overwrite getFile
File f = getFile();
FileProvider fp = src.as(FileProvider.class);
return f == null ? src : fp != null && fp.getFile().equals(f) ? src : new FileResource(f);
}
use of org.apache.tools.ant.types.resources.FileResource in project ant by apache.
the class TraXLiaison method setStylesheet.
/**
* Set the stylesheet file.
* @param stylesheet a <code>File</code> value
* @throws Exception on error
*/
public void setStylesheet(final File stylesheet) throws Exception {
final FileResource fr = new FileResource();
fr.setProject(project);
fr.setFile(stylesheet);
setStylesheet(fr);
}
use of org.apache.tools.ant.types.resources.FileResource in project jacoco by jacoco.
the class ReportTask method createBundle.
private IBundleCoverage createBundle(final GroupElement group) throws IOException {
final CoverageBuilder builder = new CoverageBuilder();
final Analyzer analyzer = new Analyzer(executionDataStore, builder);
for (final Iterator<?> i = group.classfiles.iterator(); i.hasNext(); ) {
final Resource resource = (Resource) i.next();
if (resource.isDirectory() && resource instanceof FileResource) {
analyzer.analyzeAll(((FileResource) resource).getFile());
} else {
final InputStream in = resource.getInputStream();
analyzer.analyzeAll(in, resource.getName());
in.close();
}
}
final IBundleCoverage bundle = builder.getBundle(group.name);
logBundleInfo(bundle, builder.getNoMatchClasses());
return bundle;
}
use of org.apache.tools.ant.types.resources.FileResource in project jacoco by jacoco.
the class AntResourcesLocatorTest method testFilePrecedence.
@Test
public void testFilePrecedence() throws IOException {
createFile("src/org/jacoco/example/Test.java", "DDD");
locator.add(new FileResource(folder.getRoot(), "src"));
locator.add(createFile("org/jacoco/example/Test.java", "FFF"));
final Reader source = locator.getSourceFile("org/jacoco/example", "Test.java");
assertContent("FFF", source);
}
Aggregations