Class GroovyCompileOptions

java.lang.Object
org.gradle.api.tasks.compile.GroovyCompileOptions
All Implemented Interfaces:
Serializable

public abstract class GroovyCompileOptions extends Object implements Serializable
Compilation options to be passed to the Groovy compiler.
See Also:
  • Constructor Details

    • GroovyCompileOptions

      public GroovyCompileOptions()
  • Method Details

    • getObjectFactory

      @Inject protected abstract ObjectFactory getObjectFactory()
    • getFailOnError

      @Input public abstract Property<Boolean> getFailOnError()
      Tells whether the compilation task should fail if compile errors occurred. Defaults to true.
    • getIsFailOnError

      @Internal public Property<Boolean> getIsFailOnError()
    • getVerbose

      @Console public abstract Property<Boolean> getVerbose()
      Tells whether to turn on verbose output. Defaults to false.
    • getIsVerbose

      @Internal public Property<Boolean> getIsVerbose()
    • getListFiles

      @Console public abstract Property<Boolean> getListFiles()
      Tells whether to print which source files are to be compiled. Defaults to false.
    • getIsListFiles

      @Internal public Property<Boolean> getIsListFiles()
    • getEncoding

      @Input public abstract Property<String> getEncoding()
      Tells the source encoding. Defaults to UTF-8.
    • getFork

      @Input public abstract Property<Boolean> getFork()
      Tells whether to run the Groovy compiler in a separate process. Defaults to true.
    • getIsFork

      @Internal public Property<Boolean> getIsFork()
    • getConfigurationScript

      @Optional @PathSensitive(NONE) @InputFile public abstract RegularFileProperty getConfigurationScript()
      A Groovy script file that configures the compiler, allowing extensive control over how the code is compiled.

      The script is executed as Groovy code, with the following context:

      This facilitates the following pattern:

       withConfig(configuration) {
         // use compiler configuration DSL here
       }
       

      For example, to activate type checking for all Groovy classes…

       import groovy.transform.TypeChecked
      
       withConfig(configuration) {
           ast(TypeChecked)
       }
       

      Please see the Groovy compiler customization builder documentation for more information about the compiler configuration DSL.

      This feature is only available if compiling with Groovy 2.1 or later.

      See Also:
    • getJavaAnnotationProcessing

      @Input public abstract Property<Boolean> getJavaAnnotationProcessing()
      Whether the Groovy code should be subject to Java annotation processing.

      Annotation processing of Groovy code works by having annotation processors visit the Java stubs generated by the Groovy compiler in order to support joint compilation of Groovy and Java source.

      When set to true, stubs will be unconditionally generated for all Groovy sources, and Java annotations processors will be executed on those stubs.

      When this option is set to false (the default), Groovy code will not be subject to annotation processing, but any joint compiled Java code will be. If the compiler argument "-proc:none" was specified as part of the Java compile options, the value of this flag will be ignored. No annotation processing will be performed regardless, on Java or Groovy source.

    • getIsJavaAnnotationProcessing

      @Internal public Property<Boolean> getIsJavaAnnotationProcessing()
    • getParameters

      @Input public abstract Property<Boolean> getParameters()
      Whether the Groovy compiler generate metadata for reflection on method parameter names on JDK 8 and above.
      Since:
      6.1
    • getIsParameters

      @Internal public Property<Boolean> getIsParameters()
    • getForkOptions

      public abstract GroovyForkOptions getForkOptions()
      Returns options for running the Groovy compiler in a separate process. These options only take effect if fork is set to true.
    • forkOptions

      public void forkOptions(Action<? super GroovyForkOptions> action)
      Execute the given action against getForkOptions().
      Since:
      8.11
    • getOptimizationOptions

      @Input @Optional public abstract MapProperty<String,Boolean> getOptimizationOptions()
      Returns optimization options for the Groovy compiler. Allowed values for an option are true and false. Only takes effect when compiling against Groovy 1.8 or higher.

      Known options are:

      indy
      Use the invokedynamic bytecode instruction. Requires JDK7 or higher and Groovy 2.0 or higher. Disabled by default.
      int
      Optimize operations on primitive types (e.g. integers). Enabled by default.
      all
      Enable or disable all optimizations. Note that some optimizations might be mutually exclusive.
    • getDisabledGlobalASTTransformations

      @Input public abstract SetProperty<String> getDisabledGlobalASTTransformations()
      Returns the set of global AST transformations which should not be loaded into the Groovy compiler.
      Since:
      7.4
      See Also:
    • getStubDir

      @Internal public abstract DirectoryProperty getStubDir()
      Returns the directory where Java stubs for Groovy classes will be stored during Java/Groovy joint compilation. Defaults to null, in which case a temporary directory will be used.
    • getFileExtensions

      @Input public abstract ListProperty<String> getFileExtensions()
      Returns the list of acceptable source file extensions. Only takes effect when compiling against Groovy 1.7 or higher. Defaults to ImmutableList.of("java", "groovy").
    • getKeepStubs

      @Input public abstract Property<Boolean> getKeepStubs()
      Tells whether Java stubs for Groovy classes generated during Java/Groovy joint compilation should be kept after compilation has completed. Useful for joint compilation debugging purposes. Defaults to false.
    • getIsKeepStubs

      @Internal public Property<Boolean> getIsKeepStubs()