Class CompileOptions
- Since:
- 1.0
- Author:
- Erik C. Thauvin
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRetrieves advanced compiler options.advancedOptions(String... options) Specify advanced compiler options.final CompileOptionsadvancedOptions(Collection<String> options) Specify advanced compiler options.Retrieves the version of Kotlin bundled libraries.apiVersion(int version) Allow using declarations only from the specified version of Kotlin bundled libraries.apiVersion(String version) Allow using declarations only from the specified version of Kotlin bundled libraries.argFile()Retrieves the files containing compiler options.Read the compiler options from the given files.Read the compiler options from the given files.Read the compiler options from the given files.final CompileOptionsargFile(Collection<File> files) Read the compiler options from the given files.final CompileOptionsargFilePaths(Collection<Path> files) Read the compiler options from the given files.final CompileOptionsargFileStrings(Collection<String> files) Read the compiler options from the given files.args()Returns the formatted arguments.Retrieves the class files classpath.Search for class files in the specified paths.Search for class files in the specified paths.Search for class files in the specified paths.final CompileOptionsclasspath(Collection<File> paths) Search for class files in the specified paths.final CompileOptionsclasspathPaths(Collection<Path> paths) Search for class files in the specified paths.final CompileOptionsclasspathStrings(Collection<String> paths) Search for class files in the specified paths.Retrieves the string to evaluate as a Kotlin script.expression(String expression) Evaluate the given string as a Kotlin script.booleanIndicates whetherjdkRelease(String)was set.booleanIndicates whetherjvmTarget(String)was set.includeRuntime(boolean includeRuntime) Include the Kotlin runtime in the resulting JAR file.booleanIndicates whetherincludeRuntime(boolean)was set.booleanIndicates whetherjavaParameters(boolean)was set.booleanisNoJdk()Indicates whethernoJdk(boolean)was set.booleanIndicates whethernoReflect(boolean)was set.booleanIndicates whethernoStdLib(boolean)was set.booleanisNoWarn()Indicates whethernoWarn(boolean)was set.booleanIndicates whetherprogressive(boolean)was set.booleanIndicates whetherverbose(boolean)was set.booleanisWError()Indicates whether warnings are turned into a compilation error.booleanisWExtra()Indicates whether additional declaration, expression, and type compiler checks emit warnings.javaParameters(boolean javaParameters) Generate metadata for Java 1.8 reflection on method parameters.jdkHome()Retrieves the custom JDK home directory.Use a custom JDK home directory to include in the classpath if it differs from the defaultJAVA_HOME.Use a custom JDK home directory to include in the classpath if it differs from the defaultJAVA_HOME.Use a custom JDK home directory to include in the classpath if it differs from the defaultJAVA_HOME.Return the specified JDK API version.jdkRelease(int version) Compile against the specified JDK API version.jdkRelease(String version) Compile against the specified JDK API version.Retrieves the JVM default methods option.jvmDefault(JvmDefault jvmDefault) Emit JVM default methods for interface declarations with bodies.Retrieves the target version of the generated JVM bytecode.jvmTarget(int target) Specify the target version of the generated JVM bytecode.Specify the target version of the generated JVM bytecode.Retrieves the custom path of the Kotlin compiler.kotlinHome(File path) Specify a custom path to the Kotlin compiler used for the discovery of runtime libraries.kotlinHome(String path) Specify a custom path to the Kotlin compiler used for the discovery of runtime libraries.kotlinHome(Path path) Specify a custom path to the Kotlin compiler used for the discovery of runtime libraries.Retrieves thelanguage version.languageVersion(String version) Provide source compatibility with the specified version of Kotlin.Retrieves themodule name.moduleName(String name) Set a custom name for the generated.kotlin_modulefile.noJdk(boolean noJdk) Don't automatically include the Java runtime into the classpath.noReflect(boolean noReflect) Don't automatically include the Kotlin reflection (kotlin-reflect.jar) into the classpath.noStdLib(boolean noStdLib) Don't automatically include the Kotlin/JVM stdlib (kotlin-stdlib.jar) and Kotlin reflection (kotlin-reflect.jar) into the classpath.noWarn(boolean noWarn) Suppress the compiler from displaying warnings during compilation.optIn()Retrieves the opt-in fully qualified names.Enable usages of API that requires opt-in with a requirement annotation with the given fully qualified name.final CompileOptionsoptIn(Collection<String> annotations) Enable usages of API that requires opt-in with a requirement annotation with the given fully qualified name.options()Retrieves additional compiler options.Specify additional compiler options.final CompileOptionsoptions(Collection<String> options) Specify additional compiler options.path()Retrieves the location to place generated class files into.Place the generated class files into the specified location.Place the generated class files into the specified location.Place the generated class files into the specified location.plugin()Retrieves the plugin options.Pass an option to a plugin.progressive(boolean progressive) Enable progressive compilation mode.Retrieves the script templates.scriptTemplates(String... classNames) Script definition template classes.final CompileOptionsscriptTemplates(Collection<String> classNames) Script definition template classes.toString()verbose(boolean verbose) Enable verbose logging output which includes details of the compilation process.wError(boolean wError) Turn any warnings into a compilation error.wExtra(boolean wExtra) Enable additional declaration, expression, and type compiler checks that emit warnings iftrue.
-
Constructor Details
-
CompileOptions
public CompileOptions()
-
-
Method Details
-
toString
-
advancedOptions
Specify advanced compiler options.- Parameters:
options- one or more advanced options- Returns:
- this operation instance
- Throws:
NullPointerException- ifoptionsisnullIllegalArgumentException- ifoptionsis empty, or containsnullor empty elements
-
advancedOptions
Specify advanced compiler options.- Parameters:
options- the compiler options- Returns:
- this operation instance
- Throws:
NullPointerException- ifoptionsisnullIllegalArgumentException- ifoptionsis empty, or containsnullor empty elements
-
advancedOptions
Retrieves advanced compiler options.- Returns:
- the advanced compiler options
-
apiVersion
Allow using declarations only from the specified version of Kotlin bundled libraries.- Parameters:
version- the API version- Returns:
- this operation instance
- Throws:
NullPointerException- ifversionisnullIllegalArgumentException- ifversionis empty
-
apiVersion
Allow using declarations only from the specified version of Kotlin bundled libraries.- Parameters:
version- the API version- Returns:
- this operation instance
-
apiVersion
Retrieves the version of Kotlin bundled libraries.- Returns:
- the API version
-
argFile
Read the compiler options from the given files.Such a file can contain compiler options with values and paths to the source files. Options and paths should be separated by whitespaces. For example:
-include-runtime -d hello.jar hello.kt
') or double (") quotes. If a value contains quotation marks in it, escape them with a backslash (\).-include-runtime -d 'My folder'
- Parameters:
files- one or more files- Returns:
- this operation instance
- Throws:
NullPointerException- iffilesisnullIllegalArgumentException- iffilesis empty, or containsnullor empty elements
-
argFile
Read the compiler options from the given files.- Parameters:
files- one or more files- Returns:
- this operation instance
- Throws:
NullPointerException- iffilesisnullIllegalArgumentException- iffilesis empty, or containsnullelements
-
argFile
Read the compiler options from the given files.- Parameters:
files- one or more files- Returns:
- this operation instance
- Throws:
NullPointerException- iffilesisnullIllegalArgumentException- iffilesis empty, or containsnullelements
-
argFile
Read the compiler options from the given files.- Parameters:
files- the compiler options files- Returns:
- this operation instance
- Throws:
NullPointerException- iffilesisnullIllegalArgumentException- iffilesis empty, or containsnullelements
-
argFile
Retrieves the files containing compiler options.- Returns:
- the compiler options files
-
argFilePaths
Read the compiler options from the given files.- Parameters:
files- the compiler options files (asPath)- Returns:
- this operation instance
- Throws:
NullPointerException- iffilesisnullIllegalArgumentException- iffilesis empty, or containsnullelements
-
argFileStrings
Read the compiler options from the given files.- Parameters:
files- the compiler options files (asString)- Returns:
- this operation instance
- Throws:
NullPointerException- iffilesisnullIllegalArgumentException- iffilesis empty, or containsnullor empty elements
-
args
Returns the formatted arguments.- Returns:
- the arguments
-
classpath
Search for class files in the specified paths.The classpath can contain file and directory paths, ZIP, or JAR files.
- Parameters:
paths- one or more paths- Returns:
- this operation instance
- Throws:
NullPointerException- ifpathsisnullIllegalArgumentException- ifpathsis empty, or containsnullor empty elements
-
classpath
Search for class files in the specified paths.The classpath can contain file and directory paths, ZIP, or JAR files.
- Parameters:
paths- one or more paths- Returns:
- this operation instance
- Throws:
NullPointerException- ifpathsisnullIllegalArgumentException- ifpathsis empty, or containsnullelements
-
classpath
Search for class files in the specified paths.The classpath can contain file and directory paths, ZIP, or JAR files.
- Parameters:
paths- one or more paths- Returns:
- this operation instance
- Throws:
NullPointerException- ifpathsisnullIllegalArgumentException- ifpathsis empty, or containsnullelements
-
classpath
Search for class files in the specified paths.The classpath can contain file and directory paths, ZIP, or JAR files.
- Parameters:
paths- the search paths- Returns:
- this operation instance
- Throws:
NullPointerException- ifpathsisnullIllegalArgumentException- ifpathsis empty, or containsnullelements
-
classpath
Retrieves the class files classpath.- Returns:
- the class files classpath
-
classpathPaths
Search for class files in the specified paths.- Parameters:
paths- the search paths (asPath)- Returns:
- this operation instance
- Throws:
NullPointerException- ifpathsisnullIllegalArgumentException- ifpathsis empty, or containsnullelements
-
classpathStrings
Search for class files in the specified paths.- Parameters:
paths- the search paths (asString)- Returns:
- this operation instance
- Throws:
NullPointerException- ifpathsisnullIllegalArgumentException- ifpathsis empty, or containsnullor empty elements
-
expression
Evaluate the given string as a Kotlin script.- Parameters:
expression- the expression- Returns:
- this operation instance
- Throws:
NullPointerException- ifexpressionisnullIllegalArgumentException- ifexpressionis empty
-
expression
Retrieves the string to evaluate as a Kotlin script.- Returns:
- the expression
-
hasRelease
public boolean hasRelease()Indicates whetherjdkRelease(String)was set.- Returns:
trueif the release was set; orfalseotherwise
-
hasTarget
public boolean hasTarget()Indicates whetherjvmTarget(String)was set.- Returns:
trueif the target was set; orfalseotherwise
-
includeRuntime
Include the Kotlin runtime in the resulting JAR file.- Parameters:
includeRuntime-trueorfalse- Returns:
- this operation instance
-
isIncludeRuntime
public boolean isIncludeRuntime()Indicates whetherincludeRuntime(boolean)was set.- Returns:
trueorfalse
-
isJavaParameters
public boolean isJavaParameters()Indicates whetherjavaParameters(boolean)was set.- Returns:
trueorfalse
-
isNoJdk
public boolean isNoJdk()Indicates whethernoJdk(boolean)was set.- Returns:
trueorfalse
-
isNoReflect
public boolean isNoReflect()Indicates whethernoReflect(boolean)was set.- Returns:
trueorfalse
-
isNoStdLib
public boolean isNoStdLib()Indicates whethernoStdLib(boolean)was set.- Returns:
trueorfalse
-
isNoWarn
public boolean isNoWarn()Indicates whethernoWarn(boolean)was set.- Returns:
trueorfalse
-
isProgressive
public boolean isProgressive()Indicates whetherprogressive(boolean)was set.- Returns:
trueorfalse
-
isVerbose
public boolean isVerbose()Indicates whetherverbose(boolean)was set.- Returns:
trueif verbose was set; orfalseotherwise
-
isWError
public boolean isWError()Indicates whether warnings are turned into a compilation error.- Returns:
trueorfalse
-
isWExtra
public boolean isWExtra()Indicates whether additional declaration, expression, and type compiler checks emit warnings.- Returns:
trueorfalse
-
javaParameters
Generate metadata for Java 1.8 reflection on method parameters.- Parameters:
javaParameters-trueorfalse- Returns:
- this operation instance
-
jdkHome
Use a custom JDK home directory to include in the classpath if it differs from the defaultJAVA_HOME.- Parameters:
jdkHome- the JDK home path- Returns:
- this operation instance
- Throws:
NullPointerException- ifjdkHomeisnullIllegalArgumentException- ifjdkHomeis empty
-
jdkHome
Use a custom JDK home directory to include in the classpath if it differs from the defaultJAVA_HOME.- Parameters:
jdkHome- the JDK home path- Returns:
- this operation instance
- Throws:
NullPointerException- ifjdkHomeisnullIllegalArgumentException- ifjdkHomeis empty
-
jdkHome
Use a custom JDK home directory to include in the classpath if it differs from the defaultJAVA_HOME.- Parameters:
jdkHome- the JDK home path- Returns:
- this operation instance
- Throws:
NullPointerException- ifjdkHomeisnullIllegalArgumentException- ifjdkHomeis empty
-
jdkHome
Retrieves the custom JDK home directory.- Returns:
- the JDK home path
-
jdkRelease
Compile against the specified JDK API version.Limit the API of the JDK in the classpath to the specified Java version. Automatically sets
JVM targetversion.Possible values are 1.8, 9, 10, ..., 23. The default value is 1.8.
- Parameters:
version- the target version- Returns:
- this operation instance
- Throws:
NullPointerException- ifversionis nullIllegalArgumentException- ifversionis empty
-
jdkRelease
Compile against the specified JDK API version.- Parameters:
version- the target version- Returns:
- this operation instance
- See Also:
-
jdkRelease
Return the specified JDK API version.- Returns:
- the API version
-
jvmDefault
Emit JVM default methods for interface declarations with bodies.- Parameters:
jvmDefault- the default methods option- Returns:
- this operation instance
- Throws:
NullPointerException- ifjvmDefaultisnullIllegalArgumentException- ifjvmDefaultisnull- Since:
- 1.1.0
-
jvmDefault
Retrieves the JVM default methods option.- Returns:
- the default methods option
- Since:
- 1.1.0
-
jvmTarget
Specify the target version of the generated JVM bytecode.Possible values are 1.8, 9, 10, ..., 23. The default value is 1.8.
- Parameters:
target- the target version- Returns:
- this operation instance
- Throws:
NullPointerException- ifjvmTargetisnullIllegalArgumentException- ifjvmTargetis empty
-
jvmTarget
Specify the target version of the generated JVM bytecode.- Parameters:
target- the target version- Returns:
- this operation instance
- See Also:
-
jvmTarget
Retrieves the target version of the generated JVM bytecode.- Returns:
- the target version
-
kotlinHome
Specify a custom path to the Kotlin compiler used for the discovery of runtime libraries.- Parameters:
path- the Kotlin home path- Returns:
- this operation instance
- Throws:
NullPointerException- ifpathisnull
-
kotlinHome
Specify a custom path to the Kotlin compiler used for the discovery of runtime libraries.- Parameters:
path- the Kotlin home path- Returns:
- this operation instance
- Throws:
NullPointerException- ifpathisnull
-
kotlinHome
Specify a custom path to the Kotlin compiler used for the discovery of runtime libraries.- Parameters:
path- the Kotlin home path- Returns:
- this operation instance
- Throws:
NullPointerException- ifpathisnullIllegalArgumentException- ifpathis empty
-
kotlinHome
Retrieves the custom path of the Kotlin compiler.- Returns:
- the Kotlin home path
-
languageVersion
Provide source compatibility with the specified version of Kotlin.- Parameters:
version- the language version- Returns:
- this operation instance
- Throws:
NullPointerException- ifversionis nullIllegalArgumentException- ifversionis empty
-
languageVersion
Retrieves thelanguage version.- Returns:
- the language version
-
moduleName
Set a custom name for the generated.kotlin_modulefile.- Parameters:
name- the module name- Returns:
- this operation instance
- Throws:
NullPointerException- ifnameis nullIllegalArgumentException- ifnameis empty
-
moduleName
Retrieves themodule name.- Returns:
- the module name
-
noJdk
Don't automatically include the Java runtime into the classpath.- Parameters:
noJdk-trueorfalse- Returns:
- this operation instance
-
noReflect
Don't automatically include the Kotlin reflection (kotlin-reflect.jar) into the classpath.- Parameters:
noReflect-trueorfalse- Returns:
- this operation instance
-
noStdLib
Don't automatically include the Kotlin/JVM stdlib (kotlin-stdlib.jar) and Kotlin reflection (kotlin-reflect.jar) into the classpath.- Parameters:
noStdLib-trueorfalse- Returns:
- this operation instance
-
noWarn
Suppress the compiler from displaying warnings during compilation.- Parameters:
noWarn-trueorfalse- Returns:
- this operation instance
-
optIn
Enable usages of API that requires opt-in with a requirement annotation with the given fully qualified name.- Parameters:
annotations- one or more annotation names- Returns:
- this operation instance
- Throws:
NullPointerException- ifannotationsisnullIllegalArgumentException- ifannotationsis empty, or containsnullor empty elements
-
optIn
Enable usages of API that requires opt-in with a requirement annotation with the given fully qualified name.- Parameters:
annotations- the annotation names- Returns:
- this operation instance
- Throws:
NullPointerException- ifannotationsisnullIllegalArgumentException- ifannotationsis empty, or containsnullor empty elements
-
optIn
Retrieves the opt-in fully qualified names.- Returns:
- the fully qualified names
-
options
Specify additional compiler options.- Parameters:
options- one or more compiler options- Returns:
- this operation instance
- Throws:
NullPointerException- ifoptionsisnullIllegalArgumentException- ifoptionsis empty, or containsnullor empty elements
-
options
Specify additional compiler options.- Parameters:
options- the compiler options- Returns:
- this operation instance
- Throws:
NullPointerException- ifoptionsisnullIllegalArgumentException- ifoptionsis empty, or containsnullor empty elements
-
options
Retrieves additional compiler options.- Returns:
- the compiler options
-
path
Place the generated class files into the specified location.The location can be a directory, a ZIP, or a JAR file.
- Parameters:
path- the location path- Returns:
- this operation instance
- Throws:
NullPointerException- ifpathisnull
-
path
Place the generated class files into the specified location.The location can be a directory, a ZIP, or a JAR file.
- Parameters:
path- the location path- Returns:
- this operation instance
- Throws:
NullPointerException- ifpathisnull
-
path
Place the generated class files into the specified location.The location can be a directory, a ZIP, or a JAR file.
- Parameters:
path- the location path- Returns:
- this operation instance
- Throws:
NullPointerException- ifpathisnullIllegalArgumentException- ifpathis empty
-
path
Retrieves the location to place generated class files into.- Returns:
- the location path
-
plugin
Pass an option to a plugin.- Parameters:
id- the plugin IDoptionName- the plugin option namevalue- the plugin option value- Returns:
- this operation instance
- Throws:
NullPointerException- ifid,optionName, orvaluearenullIllegalArgumentException- ifid,optionName, orvalueare empty
-
plugin
Retrieves the plugin options.- Returns:
- the plugin options
-
progressive
Enable progressive compilation mode.- Parameters:
progressive-trueorfalse- Returns:
- this operation instance
-
scriptTemplates
Script definition template classes.Use fully qualified class names.
- Parameters:
classNames- one or more class names- Returns:
- this operation instance
- Throws:
NullPointerException- ifclassNamesisnullIllegalArgumentException- ifclassNamesis empty, or containsnullor empty elements
-
scriptTemplates
Script definition template classes.Use fully qualified class names.
- Parameters:
classNames- the class names- Returns:
- this operation instance
- Throws:
NullPointerException- ifclassNamesisnullIllegalArgumentException- ifclassNamesis empty, or containsnullor empty elements
-
scriptTemplates
Retrieves the script templates.- Returns:
- the script templates
-
verbose
Enable verbose logging output which includes details of the compilation process.- Parameters:
verbose-trueorfalse- Returns:
- this operation instance
-
wError
Turn any warnings into a compilation error.- Parameters:
wError-trueorfalse- Returns:
- this operation instance
-
wExtra
Enable additional declaration, expression, and type compiler checks that emit warnings iftrue.- Parameters:
wExtra-trueorfalse- Returns:
- this operation instance
-