public ApiGroovyCompiler(Compiler<JavaCompileSpec> javaCompiler) {
this.javaCompiler = javaCompiler;
}
public WorkResult execute(final GroovyJavaJointCompileSpec spec) {
CompilerConfiguration configuration = new CompilerConfiguration();
configuration.setVerbose(spec.getGroovyCompileOptions().isVerbose());
configuration.setSourceEncoding(spec.getGroovyCompileOptions().getEncoding());
configuration.setTargetBytecode(spec.getTargetCompatibility());
configuration.setTargetDirectory(spec.getDestinationDir());
canonicalizeValues(spec.getGroovyCompileOptions().getOptimizationOptions());
if (spec.getGroovyCompileOptions().getConfigurationScript() != null) {
applyConfigurationScript(spec.getGroovyCompileOptions().getConfigurationScript(), configuration);
}
try {
configuration.setOptimizationOptions(spec.getGroovyCompileOptions().getOptimizationOptions());
} catch (NoSuchMethodError ignored) { /* method was only introduced in Groovy 1.8 */ }
Map<String, Object> jointCompilationOptions = new HashMap<String, Object>();
jointCompilationOptions.put("stubDir", spec.getGroovyCompileOptions().getStubDir());
jointCompilationOptions.put("keepStubs", spec.getGroovyCompileOptions().isKeepStubs());
configuration.setJointCompilationOptions(jointCompilationOptions);
URLClassLoader classPathLoader = new GroovyCompileTransformingClassLoader(new DefaultClassPath(spec.getClasspath()));
GroovyClassLoader compileClasspathClassLoader = new GroovyClassLoader(classPathLoader, null);
FilteringClassLoader groovyCompilerClassLoader = new FilteringClassLoader(GroovyClassLoader.class.getClassLoader());