org.springframework.boot.cli.compiler

Class GroovyCompiler



  • public class GroovyCompiler
    extends Object
    Compiler for Groovy sources. Primarily a simple Facade for GroovyClassLoader.parseClass(GroovyCodeSource) with the following additional features:
    • CompilerAutoConfiguration strategies will be read from META-INF/services/org.springframework.boot.cli.compiler.CompilerAutoConfiguration (per the standard java ServiceLoader contract) and applied during compilation
    • Multiple classes can be returned if the Groovy source defines more than one Class
    • Generated class files can also be loaded using ClassLoader.getResource(String)
    Author:
    Phillip Webb, Dave Syer, Andy Wilkinson
    • Method Detail

      • getAstTransformations

        public List<org.codehaus.groovy.transform.ASTTransformation> getAstTransformations()
        Return a mutable list of the ASTTransformations to be applied during compile(String...).
        Returns:
        the AST transformations to apply
      • addCompilationCustomizers

        public void addCompilationCustomizers(org.codehaus.groovy.control.customizers.CompilationCustomizer... customizers)
      • compile

        public Class<?>[] compile(String... sources)
                           throws org.codehaus.groovy.control.CompilationFailedException,
                                  IOException
        Compile the specified Groovy sources, applying any CompilerAutoConfigurations. All classes defined in the sources will be returned from this method.
        Parameters:
        sources - the sources to compile
        Returns:
        compiled classes
        Throws:
        org.codehaus.groovy.control.CompilationFailedException - in case of compilation failures
        IOException - in case of I/O errors
        org.codehaus.groovy.control.CompilationFailedException - in case of compilation errors