use of org.codehaus.groovy.control.CompilationUnit in project grails-core by grails.
the class GrailsAwareClassLoader method createCompilationUnit.
/**
* @see groovy.lang.GroovyClassLoader#createCompilationUnit(org.codehaus.groovy.control.CompilerConfiguration, java.security.CodeSource)
*/
@Override
protected CompilationUnit createCompilationUnit(CompilerConfiguration config, CodeSource source) {
CompilationUnit cu = super.createCompilationUnit(config, source);
GrailsAwareInjectionOperation operation;
if (classInjectors == null) {
operation = new GrailsAwareInjectionOperation();
} else {
operation = new GrailsAwareInjectionOperation(classInjectors);
}
cu.addPhaseOperation(operation, Phases.CANONICALIZATION);
return cu;
}
use of org.codehaus.groovy.control.CompilationUnit in project freeplane by freeplane.
the class ScriptCompiler method compile.
private static void compile(File dir, File[] files) {
try {
final CompilerConfiguration compilerConfiguration = GroovyScript.createCompilerConfiguration();
compilerConfiguration.setTargetDirectory(dir);
final CompilationUnit unit = new CompilationUnit(compilerConfiguration, null, new GroovyClassLoader(ScriptingEngine.class.getClassLoader()));
new FileSystemCompiler(compilerConfiguration, unit).compile(files);
LogUtils.info("compiled in " + dir + ": " + createNameList(files));
} catch (Exception e) {
LogUtils.severe("error compiling in " + dir + createNameList(files), e);
}
}
Aggregations