Class CompileOptions
- Since:
- 1.0
- Author:
- Erik C. Thauvin
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionRetrieves advanced compiler options.advancedOptions
(String... options) Specify advanced compiler options.advancedOptions
(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.argFile
(Collection<File> files) Read the compiler options from the given files.argFilePaths
(Collection<Path> files) Read the compiler options from the given files.argFileStrings
(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.classpath
(Collection<File> paths) Search for class files in the specified paths.classpathPaths
(Collection<Path> paths) Search for class files in the specified paths.classpathStrings
(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.boolean
Indicates whether thejdkRelease
was set.includeRuntime
(boolean includeRuntime) Include the Kotlin runtime into the resulting JAR file.boolean
Indicates whether theincludeRuntime(boolean)
was set.boolean
Indicates whetherjavaParameters(boolean)
was set.boolean
isNoJdk()
Indicates whethernoJdk
was set.boolean
Indicates whethernoRflect
was set.boolean
Indicates whethernoStdLib
+was set.boolean
isNoWarn()
Indicates whethernoWarn
was set.boolean
Indicates whetherprogressive
was set.boolean
Indicates whetherverbose(boolean)
was set.boolean
isWError()
Indicates whether warnings are turned into a compilation error.boolean
isWExtra()
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 into the classpath if it differs from the defaultJAVA_HOME
.Use a custom JDK home directory to include into the classpath if it differs from the defaultJAVA_HOME
.Use a custom JDK home directory to include into 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 Java Virtual Machine options.jvmOptions
(String... jvmOptions) Pass an option directly to JVMjvmOptions
(Collection<String> jvmOptions) Pass an option directly to Java Virtual MachineRetrieves 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_module
file.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.optIn
(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.options
(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) Allow using declarations only from the specified version of Kotlin bundled libraries.Retrieves the script templates.scriptTemplates
(String... classNames) Script definition template classes.scriptTemplates
(Collection<String> classNames) Script definition template classes.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
-
advancedOptions
Specify advanced compiler options.- Parameters:
options
- one or more advanced options- Returns:
- this operation instance
-
advancedOptions
Specify advanced compiler options.- Parameters:
options
- the compiler options- Returns:
- this operation instance
-
advancedOptions
Retrieves advanced compiler options.- Returns:
- the advanced compiler options
-
apiVersion
Retrieves the version of Kotlin bundled libraries.- Returns:
- the API version
-
apiVersion
Allow using declarations only from the specified version of Kotlin bundled libraries.- Parameters:
version
- the API version- Returns:
- this operation instance
-
apiVersion
Allow using declarations only from the specified version of Kotlin bundled libraries.- Parameters:
version
- the API version- Returns:
- this operation instance
-
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
- See Also:
-
argFile
Read the compiler options from the given files.- Parameters:
files
- the compiler options files- Returns:
- this operation instance
- See Also:
-
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
- See Also:
-
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
- See Also:
-
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- Returns:
- this operation instance
- See Also:
-
argFileStrings
Read the compiler options from the given files.- Parameters:
files
- the compiler options files- Returns:
- this operation instance
- See Also:
-
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 pr more paths- Returns:
- this operation instance
- See Also:
-
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 path- Returns:
- this operation instance
- See Also:
-
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 path- Returns:
- this operation instance
- See Also:
-
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
- See Also:
-
classpath
Retrieves the class files classpath.- Returns:
- the class files classpath
-
classpathPaths
Search for class files in the specified paths.The classpath can contain file and directory paths, ZIP, or JAR files.
- Parameters:
paths
- one pr more paths- Returns:
- this operation instance
- See Also:
-
classpathStrings
Search for class files in the specified paths.The classpath can contain file and directory paths, ZIP, or JAR files.
- Parameters:
paths
- one pr more paths- Returns:
- this operation instance
- See Also:
-
expression
Retrieves the string to evaluate as a Kotlin script.- Returns:
- the expression
-
expression
Evaluate the given string as a Kotlin script.- Parameters:
expression
- the expression- Returns:
- this operation instance
-
hasRelease
public boolean hasRelease()Indicates whether thejdkRelease
was set.- Returns:
true
if the release was set; orfalse
otherwise
-
includeRuntime
Include the Kotlin runtime into the resulting JAR file. Makes the resulting archive runnable on any Java-enabled environment.- Parameters:
includeRuntime
-true
orfalse
- Returns:
- this operation instance
-
isIncludeRuntime
public boolean isIncludeRuntime()Indicates whether theincludeRuntime(boolean)
was set.- Returns:
true
orfalse
-
isJavaParameters
public boolean isJavaParameters()Indicates whetherjavaParameters(boolean)
was set.- Returns:
true
orfalse
-
isNoJdk
public boolean isNoJdk()Indicates whethernoJdk
was set.- Returns:
true
orfalse
-
isNoReflect
public boolean isNoReflect()Indicates whethernoRflect
was set.- Returns:
true
orfalse
-
isNoStdLib
public boolean isNoStdLib()Indicates whethernoStdLib
+was set.- Returns:
true
orfalse
-
isNoWarn
public boolean isNoWarn()Indicates whethernoWarn
was set.- Returns:
true
orfalse
-
isProgressive
public boolean isProgressive()Indicates whetherprogressive
was set.- Returns:
true
orfalse
-
isVerbose
public boolean isVerbose()Indicates whetherverbose(boolean)
was set.- Returns:
true
if verbose was set; orfalse
otherwise
-
isWError
public boolean isWError()Indicates whether warnings are turned into a compilation error.- Returns:
true
orfalse
-
isWExtra
public boolean isWExtra()Indicates whether additional declaration, expression, and type compiler checks emit warnings.- Returns:
true
orfalse
-
javaParameters
Generate metadata for Java 1.8 reflection on method parameters.- Parameters:
javaParameters
-true
orfalse
- Returns:
- this operation instance
-
jdkHome
Use a custom JDK home directory to include into the classpath if it differs from the defaultJAVA_HOME
.- Parameters:
jdkHome
- the JDK home path- Returns:
- this operation instance
-
jdkHome
Use a custom JDK home directory to include into the classpath if it differs from the defaultJAVA_HOME
.- Parameters:
jdkHome
- the JDK home path- Returns:
- this operation instance
-
jdkHome
Use a custom JDK home directory to include into the classpath if it differs from the defaultJAVA_HOME
.- Parameters:
jdkHome
- the JDK home path- Returns:
- this operation instance
-
jdkHome
Retrieves the custom JDK home directory.- Returns:
- the JDK home path.
-
jdkRelease
Return the specified JDK API version.- Returns:
- the API version
-
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 target
version.Possible values are 1.8, 9, 10, ..., 22. The default value is 1.8.
- Parameters:
version
- the target version- Returns:
- this operation instance
-
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 target
version.Possible values are 1.8, 9, 10, ..., 22. The default value is 1.8.
- Parameters:
version
- the target version- Returns:
- this operation instance
- See Also:
-
jvmOptions
Retrieves the Java Virtual Machine options.- Returns:
- the JVM options
-
jvmOptions
Pass an option directly to Java Virtual Machine- Parameters:
jvmOptions
- the JVM options- Returns:
- this operation instance
-
jvmOptions
Pass an option directly to JVM- Parameters:
jvmOptions
- one or more JVM option- Returns:
- this operation instance
-
jvmTarget
Specify the target version of the generated JVM bytecode.- Parameters:
target
- the target version- Returns:
- this operation instance
- See Also:
-
jvmTarget
Specify the target version of the generated JVM bytecode.Possible values are 1.8, 9, 10, ..., 22. The default value is 1.8.
- Parameters:
target
- the target version- Returns:
- this operation instance
-
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
-
kotlinHome
Retrieves the custom path of the Kotlin compiler.- Returns:
- the Kotlin home path
-
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
-
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
-
languageVersion
Provide source compatibility with the specified version of Kotlin.- Parameters:
version
- the language version- Returns:
- this operation instance
-
languageVersion
Retrieves thelanguage version
.- Returns:
- the language version
-
moduleName
Set a custom name for the generated.kotlin_module
file.- Parameters:
name
- the module name- Returns:
- this operation instance
-
moduleName
Retrieves themodule name
.- Returns:
- the module name
-
noJdk
Don't automatically include the Java runtime into the classpath.- Parameters:
noJdk
-true
orfalse
- Returns:
- this operation instance
-
noReflect
Don't automatically include the Kotlin reflection (kotlin-reflect.jar
) into the classpath.- Parameters:
noReflect
-true
orfalse
- 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
-true
orfalse
- Returns:
- this operation instance
-
noWarn
Suppress the compiler from displaying warnings during compilation.- Parameters:
noWarn
-true
orfalse
- 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
-
optIn
Retrieves the opt-in fully qualified names.- Returns:
- the fully qualified names
-
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
-
options
Specify additional compiler options.- Parameters:
options
- one or more compiler options- Returns:
- this operation instance
-
options
Retrieves additional compiler options.- Returns:
- the compiler options
-
options
Specify additional compiler options.- Parameters:
options
- the compiler options- Returns:
- this operation instance
-
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
-
path
Retrieves the location to place generated class files into.- Returns:
- the location path.
-
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
-
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
-
plugin
Pass an option to a plugin.- Parameters:
id
- the plugin IDoptionName
- the plugin option namevalue
- the plugin option value- Returns:
- this operation instance
-
plugin
Retrieves the plugin options.- Returns:
- the plugin options.
-
progressive
Allow using declarations only from the specified version of Kotlin bundled libraries.- Parameters:
progressive
-true
orfalse
- 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
-
scriptTemplates
Retrieves the script templates.- Returns:
- the script templates.
-
scriptTemplates
Script definition template classes.Use fully qualified class names.
- Parameters:
classNames
- the class names- Returns:
- this operation instance
-
verbose
Enable verbose logging output which includes details of the compilation process.- Parameters:
verbose
-true
orfalse
- Returns:
- this operation instance
-
wError
Turn any warnings into a compilation error.- Parameters:
wError
-true
orfalse
- Returns:
- this operation instance
-
wExtra
Enable additional declaration, expression, and type compiler checks that emit warnings iftrue
.- Parameters:
wExtra
-true
orfalse
- Returns:
- this operation instance
-