use of spoon.compiler.SpoonFile in project spoon by INRIA.
the class SourceOptions method sources.
/**
* adds the given {@link spoon.compiler.SpoonFile} as sources
*/
public T sources(List<SpoonFile> sources) {
if (sources == null || sources.size() == 0) {
args.add(".");
return myself;
}
for (SpoonFile source : sources) {
if (source.isActualFile()) {
args.add(source.toString());
} else {
try {
File file = File.createTempFile(source.getName(), ".java");
file.deleteOnExit();
IOUtils.copy(source.getContent(), new FileOutputStream(file));
args.add(file.toString());
} catch (IOException e) {
throw new RuntimeException(e.getMessage(), e);
}
}
}
return myself;
}
Aggregations