Search in sources :

Example 1 with StatsASTTransformation

use of com.disney.groovity.compile.StatsASTTransformation in project groovity by disney.

the class Groovity method createCompilerConfiguration.

protected CompilerConfiguration createCompilerConfiguration(Map<Integer, Integer> sourceLineNumbers, Collection<String> initDependencies) {
    CompilerConfiguration compilerConfiguration = new CompilerConfiguration();
    if (scriptBaseClass != null) {
        compilerConfiguration.setScriptBaseClass(scriptBaseClass);
        compilerConfiguration.addCompilationCustomizers(new ImportCustomizer().addImports(scriptBaseClass));
    }
    compilerConfiguration.addCompilationCustomizers(new ImportCustomizer().addStarImports("java.util.concurrent", "groovy.transform", "java.util.function", "com.disney.groovity.model").addImports(ClosureWritable.class.getName(), AsyncChannel.class.getName(), GroovityStatistics.class.getName(), Taggable.class.getName(), Tag.class.getName(), Attr.class.getName(), Function.class.getName(), Arg.class.getName(), SkipStatistics.class.getName()));
    compilerConfiguration.addCompilationCustomizers(new ASTTransformationCustomizer(new GroovityASTTransformation(this, sourceLineNumbers, initDependencies)));
    compilerConfiguration.addCompilationCustomizers(new ASTTransformationCustomizer(new StatsASTTransformation()));
    Map<String, Boolean> options = compilerConfiguration.getOptimizationOptions();
    options.put(CompilerConfiguration.JDK8, true);
    compilerConfigurationDecorators.forEach(decorator -> {
        decorator.decorate(compilerConfiguration);
    });
    return compilerConfiguration;
}
Also used : ASTTransformationCustomizer(org.codehaus.groovy.control.customizers.ASTTransformationCustomizer) CompilerConfiguration(org.codehaus.groovy.control.CompilerConfiguration) ImportCustomizer(org.codehaus.groovy.control.customizers.ImportCustomizer) StatsASTTransformation(com.disney.groovity.compile.StatsASTTransformation) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) GroovityASTTransformation(com.disney.groovity.compile.GroovityASTTransformation)

Aggregations

GroovityASTTransformation (com.disney.groovity.compile.GroovityASTTransformation)1 StatsASTTransformation (com.disney.groovity.compile.StatsASTTransformation)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 CompilerConfiguration (org.codehaus.groovy.control.CompilerConfiguration)1 ASTTransformationCustomizer (org.codehaus.groovy.control.customizers.ASTTransformationCustomizer)1 ImportCustomizer (org.codehaus.groovy.control.customizers.ImportCustomizer)1