) {
final CompilerConfiguration configuration = ((GroovyJavaCompilerSettings) pSettings).getCompilerConfiguration();
final ErrorCollector collector = new ErrorCollector(configuration);
final GroovyClassLoader groovyClassLoader = new GroovyClassLoader(pClassLoader);
final CompilationUnit unit = new CompilationUnit(configuration, null, groovyClassLoader);
final SourceUnit[] source = new SourceUnit[pResourceNames.length];
for (int i = 0; i < source.length; i++) {
final String resourceName = pResourceNames[i];
source[i] = new SourceUnit(
ConversionUtils.convertResourceToClassName(resourceName),
new String(pReader.getBytes(resourceName)), // FIXME delay the read
configuration,
groovyClassLoader,
collector
);
unit.addSource(source[i]);
}
final Collection problems = new ArrayList();
try {
log.debug("compiling");
unit.compile(Phases.CLASS_GENERATION);
final List classes = unit.getClasses();
for (final Iterator it = classes.iterator(); it.hasNext();) {
final GroovyClass clazz = (GroovyClass) it.next();
final byte[] bytes = clazz.getBytes();
pStore.write(ConversionUtils.convertClassToResourcePath(clazz.getName()), bytes);
}