CompileOptions (Gradle API 2.14.1)

Package: org.gradle.api.tasks.compile

## [Java] Class CompileOptions

- org.gradle.api.tasks.compile.CompileOptions

- Main options for Java compilation.

- - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `CompileOptions` | `debug(Map<String, Object> debugArgs)` Convenience method to set DebugOptions with named parameter syntax.
    `CompileOptions` | `depend(Map<String, Object> dependArgs)` Convenience method to set DependOptions with named parameter syntax.
    `protected boolean` | `excludeFromAntProperties(String fieldName)`
    `CompileOptions` | `fork(Map<String, Object> forkArgs)` Convenience method to set ForkOptions with named parameter syntax.
    `protected String` | `getAntPropertyName(String fieldName)`
    `protected Object` | `getAntPropertyValue(String fieldName, Object value)`
    `String` | `getBootClasspath()` Returns the bootstrap classpath to be used for the compiler process.
    `List<String>` | `getCompilerArgs()` Returns any additional arguments to be passed to the compiler.
    `DebugOptions` | `getDebugOptions()` Returns options for generating debugging information.
    `DependOptions` | `getDependOptions()` Returns options for using the Ant `<depend>` task.
    `String` | `getEncoding()` Returns the character encoding to be used when reading source files.
    `String` | `getExtensionDirs()` Returns the extension dirs to be used for the compiler process.
    `ForkOptions` | `getForkOptions()` Returns options for running the compiler in a child process.
    `FileCollection` | `getSourcepath()` The source path to use for the compilation.
    `boolean` | `isDebug()` Tells whether to include debugging information in the generated class files.
    `boolean` | `isDeprecation()` Tells whether to log details of usage of deprecated members or classes.
    `boolean` | `isFailOnError()` Tells whether to fail the build when compilation fails.
    `boolean` | `isFork()` Tells whether to run the compiler in its own process.
    `boolean` | `isIncremental()` informs whether to use experimental incremental compilation feature.
    `boolean` | `isListFiles()` Tells whether to log the files to be compiled.
    `boolean` | `isUseDepend()` Tells whether to use the Ant `<depend>` task.
    `boolean` | `isVerbose()` Tells whether to produce verbose output.
    `boolean` | `isWarnings()` Tells whether to log warning messages.
    `Map<String, Object>` | `optionMap()` Configure the java compilation to be incremental (e.g. compiles only those java classes that were changed or that are dependencies to the changed classes).
    `void` | `setBootClasspath(String bootClasspath)` Sets the bootstrap classpath to be used for the compiler process.
    `void` | `setCompilerArgs(List<String> compilerArgs)` Sets any additional arguments to be passed to the compiler.
    `void` | `setDebug(boolean debug)` Sets whether to include debugging information in the generated class files.
    `void` | `setDebugOptions(DebugOptions debugOptions)` Sets options for generating debugging information.
    `void` | `setDependOptions(DependOptions dependOptions)` Sets options for using the Ant `<depend>` task.
    `void` | `setDeprecation(boolean deprecation)` Sets whether to log details of usage of deprecated members or classes.
    `void` | `setEncoding(String encoding)` Sets the character encoding to be used when reading source files.
    `void` | `setExtensionDirs(String extensionDirs)` Sets the extension dirs to be used for the compiler process.
    `void` | `setFailOnError(boolean failOnError)` Sets whether to fail the build when compilation fails.
    `void` | `setFork(boolean fork)` Sets whether to run the compiler in its own process.
    `void` | `setForkOptions(ForkOptions forkOptions)` Sets options for running the compiler in a child process.
    `CompileOptions` | `setIncremental(boolean incremental)`
    `void` | `setListFiles(boolean listFiles)` Sets whether to log the files to be compiled.
    `void` | `setSourcepath(FileCollection sourcepath)` Sets the source path to use for the compilation.
    `void` | `setUseDepend(boolean useDepend)` Sets whether to use the Ant `<depend>` task.
    `void` | `setVerbose(boolean verbose)` Sets whether to produce verbose output.
    `void` | `setWarnings(boolean warnings)` Sets whether to log warning messages.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class AbstractOptions` | `define, excludeFromAntProperties, getAntPropertyName, getAntPropertyValue, optionMap`
    `class Object` | `wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll`

- - ### Method Detail

    - #### public CompileOptions debug(Map<String, Object> debugArgs)

      Convenience method to set DebugOptions with named parameter syntax. Calling this method will set `debug` to `true`.

    - #### public CompileOptions depend(Map<String, Object> dependArgs)

      Convenience method to set DependOptions with named parameter syntax. Calling this method will set `useDepend` to `true`.

    - #### @Override protected boolean excludeFromAntProperties(String fieldName)

    - #### public CompileOptions fork(Map<String, Object> forkArgs)

      Convenience method to set ForkOptions with named parameter syntax. Calling this method will set `fork` to `true`.

    - #### @Override protected String getAntPropertyName(String fieldName)

    - #### @Override protected Object getAntPropertyValue(String fieldName, Object value)

    - #### @Input @Optional public String getBootClasspath()

      Returns the bootstrap classpath to be used for the compiler process. Defaults to `null`.

    - #### @Input public List<String> getCompilerArgs()

      Returns any additional arguments to be passed to the compiler. Defaults to the empty list.

    - #### @Nested public DebugOptions getDebugOptions()

      Returns options for generating debugging information.

    - #### public DependOptions getDependOptions()

      Returns options for using the Ant `<depend>` task.

    - #### @Input @Optional public String getEncoding()

      Returns the character encoding to be used when reading source files. Defaults to `null`, in which case the platform default encoding will be used.

    - #### @Input @Optional public String getExtensionDirs()

      Returns the extension dirs to be used for the compiler process. Defaults to `null`.

    - #### @Nested public ForkOptions getForkOptions()

      Returns options for running the compiler in a child process.

    - #### @Input @Optional @Incubating public FileCollection getSourcepath()

      The source path to use for the compilation.

      The source path indicates the location of source files that may be compiled if necessary. It is effectively a complement to the class path, where the classes to be compiled against are in source form. It does not indicate the actual primary source being compiled.

      The source path feature of the Java compiler is rarely needed for modern builds that use dependency management.

      The default value for the source path is `null`, which indicates an empty source path. Note that this is different to the default value for the `-sourcepath` option for `javac`, which is to use the value specified by `-classpath`. If you wish to use any source path, it must be explicitly set.

      Returns:
        the source path
      See Also:
        setSourcepath(FileCollection)

    - #### @Input public boolean isDebug()

      Tells whether to include debugging information in the generated class files. Defaults to `true`. See DebugOptions.getDebugLevel for which debugging information will be generated.

    - #### public boolean isDeprecation()

      Tells whether to log details of usage of deprecated members or classes. Defaults to `false`.

    - #### @Input public boolean isFailOnError()

      Tells whether to fail the build when compilation fails. Defaults to `true`.

    - #### public boolean isFork()

      Tells whether to run the compiler in its own process. Note that this does not necessarily mean that a new process will be created for each compile task. Defaults to `false`.

    - #### @Incubating public boolean isIncremental()

      informs whether to use experimental incremental compilation feature. See setIncremental(boolean)

    - #### public boolean isListFiles()

      Tells whether to log the files to be compiled. Defaults to `false`.

    - #### public boolean isUseDepend()

      Tells whether to use the Ant `<depend>` task. Only takes effect if `useAnt` is `true`. Defaults to `false`.

    - #### public boolean isVerbose()

      Tells whether to produce verbose output. Defaults to `false`.

    - #### public boolean isWarnings()

      Tells whether to log warning messages. The default is `true`.

    - #### @Override public Map<String, Object> optionMap()

      Configure the java compilation to be incremental (e.g. compiles only those java classes that were changed or that are dependencies to the changed classes). The feature is incubating and does not yet satisfies all compilation scenarios.

    - #### public void setBootClasspath(String bootClasspath)

      Sets the bootstrap classpath to be used for the compiler process. Defaults to `null`.

    - #### public void setCompilerArgs(List<String> compilerArgs)

      Sets any additional arguments to be passed to the compiler. Defaults to the empty list.

    - #### public void setDebug(boolean debug)

      Sets whether to include debugging information in the generated class files. Defaults to `true`. See DebugOptions.getDebugLevel for which debugging information will be generated.

    - #### public void setDebugOptions(DebugOptions debugOptions)

      Sets options for generating debugging information.

    - #### public void setDependOptions(DependOptions dependOptions)

      Sets options for using the Ant `<depend>` task.

    - #### public void setDeprecation(boolean deprecation)

      Sets whether to log details of usage of deprecated members or classes. Defaults to `false`.

    - #### public void setEncoding(String encoding)

      Sets the character encoding to be used when reading source files. Defaults to `null`, in which case the platform default encoding will be used.

    - #### public void setExtensionDirs(String extensionDirs)

      Sets the extension dirs to be used for the compiler process. Defaults to `null`.

    - #### public void setFailOnError(boolean failOnError)

      Sets whether to fail the build when compilation fails. Defaults to `true`.

    - #### public void setFork(boolean fork)

      Sets whether to run the compiler in its own process. Note that this does not necessarily mean that a new process will be created for each compile task. Defaults to `false`.

    - #### public void setForkOptions(ForkOptions forkOptions)

      Sets options for running the compiler in a child process.

    - #### @Incubating /** * Configure the java compilation to be incremental (e.g. compiles only those java classes that were changed or that are dependencies to the changed classes). * The feature is incubating and does not yet satisfies all compilation scenarios. */ public CompileOptions setIncremental(boolean incremental)

    - #### public void setListFiles(boolean listFiles)

      Sets whether to log the files to be compiled. Defaults to `false`.

    - #### @Incubating public void setSourcepath(FileCollection sourcepath)

      Sets the source path to use for the compilation.

      Parameters:
        `sourcepath` - the source path

    - #### public void setUseDepend(boolean useDepend)

      Sets whether to use the Ant `<depend>` task. Only takes effect if `useAnt` is `true`. Defaults to `false`.

    - #### public void setVerbose(boolean verbose)

      Sets whether to produce verbose output. Defaults to `false`.

    - #### public void setWarnings(boolean warnings)

      Sets whether to log warning messages. The default is `true`.