Class GroovyCompileOptions
- All Implemented Interfaces:
- Serializable
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionDeprecated.This method will be removed in Gradle 9.0voidforkOptions(Action<? super GroovyForkOptions> action) Execute the given action againstgetForkOptions().A Groovy script file that configures the compiler, allowing extensive control over how the code is compiled.Returns the set of global AST transformations which should not be loaded into the Groovy compiler.Tells the source encoding.Returns the list of acceptable source file extensions.Returns options for running the Groovy compiler in a separate process.protected ObjectFactoryReturns optimization options for the Groovy compiler.Returns the directory where Java stubs for Groovy classes will be stored during Java/Groovy joint compilation.booleanTells whether the compilation task should fail if compile errors occurred.booleanisFork()Tells whether to run the Groovy compiler in a separate process.booleanWhether the Groovy code should be subject to Java annotation processing.booleanTells whether Java stubs for Groovy classes generated during Java/Groovy joint compilation should be kept after compilation has completed.booleanTells whether to print which source files are to be compiled.booleanWhether the Groovy compiler generate metadata for reflection on method parameter names on JDK 8 and above.booleanTells whether to turn on verbose output.voidsetConfigurationScript(File configurationFile) Sets the path to the groovy configuration file.voidsetEncoding(String encoding) Sets the source encoding.voidsetFailOnError(boolean failOnError) Sets whether the compilation task should fail if compile errors occurred.voidsetFileExtensions(List<String> fileExtensions) Sets the list of acceptable source file extensions.voidsetFork(boolean fork) Sets whether to run the Groovy compiler in a separate process.voidsetForkOptions(GroovyForkOptions forkOptions) Deprecated.Setting a new instance of this property is unnecessary.voidsetJavaAnnotationProcessing(boolean javaAnnotationProcessing) Sets whether Java annotation processors should process annotations on stubs.voidsetKeepStubs(boolean keepStubs) Sets whether Java stubs for Groovy classes generated during Java/Groovy joint compilation should be kept after compilation has completed.voidsetListFiles(boolean listFiles) Sets whether to print which source files are to be compiled.voidsetOptimizationOptions(Map<String, Boolean> optimizationOptions) Sets optimization options for the Groovy compiler.voidsetParameters(boolean parameters) Sets whether metadata for reflection on method parameter names should be generated.voidsetStubDir(File stubDir) Sets the directory where Java stubs for Groovy classes will be stored during Java/Groovy joint compilation.voidsetVerbose(boolean verbose) Sets whether to turn on verbose output.Methods inherited from class org.gradle.api.tasks.compile.AbstractOptionsdefine
- 
Constructor Details- 
GroovyCompileOptionspublic GroovyCompileOptions()
 
- 
- 
Method Details- 
getObjectFactory
- 
isFailOnErrorTells whether the compilation task should fail if compile errors occurred. Defaults totrue.
- 
setFailOnErrorpublic void setFailOnError(boolean failOnError) Sets whether the compilation task should fail if compile errors occurred. Defaults totrue.
- 
isVerboseTells whether to turn on verbose output. Defaults tofalse.
- 
setVerbosepublic void setVerbose(boolean verbose) Sets whether to turn on verbose output. Defaults tofalse.
- 
isListFilesTells whether to print which source files are to be compiled. Defaults tofalse.
- 
setListFilespublic void setListFiles(boolean listFiles) Sets whether to print which source files are to be compiled. Defaults tofalse.
- 
getEncodingTells the source encoding. Defaults toUTF-8.
- 
setEncodingSets the source encoding. Defaults toUTF-8.
- 
isForkTells whether to run the Groovy compiler in a separate process. Defaults totrue.
- 
setForkpublic void setFork(boolean fork) Sets whether to run the Groovy compiler in a separate process. Defaults totrue.
- 
getConfigurationScriptA 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: - The instance of CompilerConfiguration available as the configurationvariable.
- All static members of CompilerCustomizationBuilder pre imported.
 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:
 
- The instance of CompilerConfiguration available as the 
- 
setConfigurationScriptSets the path to the groovy configuration file.- See Also:
 
- 
isJavaAnnotationProcessingWhether 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.
- 
setJavaAnnotationProcessingpublic void setJavaAnnotationProcessing(boolean javaAnnotationProcessing) Sets whether Java annotation processors should process annotations on stubs. Defaults tofalse.
- 
isParametersWhether the Groovy compiler generate metadata for reflection on method parameter names on JDK 8 and above.- Since:
- 6.1
 
- 
setParameterspublic void setParameters(boolean parameters) Sets whether metadata for reflection on method parameter names should be generated. Defaults tofalse- Since:
- 6.1
 
- 
getForkOptionsReturns options for running the Groovy compiler in a separate process. These options only take effect ifforkis set totrue.
- 
setForkOptionsDeprecated.Setting a new instance of this property is unnecessary. This method will be removed in Gradle 9.0. UseforkOptions(Action)instead.Sets options for running the Groovy compiler in a separate process. These options only take effect ifforkis set totrue.
- 
forkOptionsExecute the given action againstgetForkOptions().- Since:
- 8.11
 
- 
getOptimizationOptionsReturns optimization options for the Groovy compiler. Allowed values for an option aretrueandfalse. 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.
 
- 
setOptimizationOptionsSets optimization options for the Groovy compiler. Allowed values for an option aretrueandfalse. Only takes effect when compiling against Groovy 1.8 or higher.
- 
getDisabledGlobalASTTransformationsReturns the set of global AST transformations which should not be loaded into the Groovy compiler.- Since:
- 7.4
- See Also:
 
- 
getStubDirReturns the directory where Java stubs for Groovy classes will be stored during Java/Groovy joint compilation. Defaults tonull, in which case a temporary directory will be used.
- 
setStubDirSets the directory where Java stubs for Groovy classes will be stored during Java/Groovy joint compilation. Defaults tonull, in which case a temporary directory will be used.
- 
getFileExtensionsReturns the list of acceptable source file extensions. Only takes effect when compiling against Groovy 1.7 or higher. Defaults toImmutableList.of("java", "groovy").
- 
setFileExtensionsSets the list of acceptable source file extensions. Only takes effect when compiling against Groovy 1.7 or higher. Defaults toImmutableList.of("java", "groovy").
- 
isKeepStubsTells 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 tofalse.
- 
setKeepStubspublic void setKeepStubs(boolean keepStubs) Sets 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 tofalse.
- 
forkDeprecated.This method will be removed in Gradle 9.0Convenience method to setGroovyForkOptionswith named parameter syntax. Calling this method will setforktotrue.
 
-