* 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: *
* The classpath can contain file and directory paths, ZIP, or JAR files. * * @param paths one pr more paths * @return this operation instance */ public CompileKotlinOptions classpath(String... paths) { classpath_.addAll(List.of(paths)); return this; } /** * Search for class files in the specified paths. *
* The classpath can contain file and directory paths, ZIP, or JAR files.
*
* @param paths the list of paths
* @return this operation instance
*/
public CompileKotlinOptions classpath(Collection
* Limit the API of the JDK in the classpath to the specified Java version. Automatically sets
* {@link #jvmTarget(String) JVM target} version.
*
* Possible values are 1.8, 9, 10, ..., 21. The default value is 1.8.
*
* @param version the target version
* @return this operation instance
*/
public CompileKotlinOptions jdkRelease(String version) {
jdkRelease_ = version;
return this;
}
/**
* Specify the target version of the generated JVM bytecode.
*
* @param version the target version
* @return this operation instance
* @see #jdkRelease(String)
*/
public CompileKotlinOptions jdkRelease(int version) {
jdkRelease_ = String.valueOf(version);
return this;
}
/**
* Specify the target version of the generated JVM bytecode.
*
* Possible values are 1.8, 9, 10, ..., 21. The default value is 1.8.
*
* @param target the target version
* @return this operation instance
*/
public CompileKotlinOptions jvmTarget(String target) {
jvmTarget_ = target;
return this;
}
/**
* Specify the target version of the generated JVM bytecode.
*
* @param target the target version
* @return this operation instance
* @see #jvmTarget(String)
*/
public CompileKotlinOptions jvmTarget(int target) {
jvmTarget_ = String.valueOf(target);
return this;
}
/**
* Specify a custom path to the Kotlin compiler used for the discovery of runtime libraries.
*
* @param path the Kotlin home path
* @return this operation instance
*/
public CompileKotlinOptions kotlinHome(String path) {
kotlinHome_ = path;
return this;
}
/**
* Provide source compatibility with the specified version of Kotlin.
*
* @param version the language version
* @return this operation instance
*/
public CompileKotlinOptions languageVersion(String version) {
languageVersion_ = version;
return this;
}
/**
* Set a custom name for the generated {@code .kotlin_module} file.
*
* @param name the module name
* @return this operation instance
*/
public CompileKotlinOptions moduleName(String name) {
moduleName_ = name;
return this;
}
/**
* Don't automatically include the Java runtime into the classpath.
*
* @param noJdk {@code true} or {@code false}
* @return this operation instance
*/
public CompileKotlinOptions noJdk(boolean noJdk) {
noJdk_ = noJdk;
return this;
}
/**
* Don't automatically include the Kotlin reflection ({@code kotlin-reflect.jar}) into the classpath.
*
* @param noReflect {@code true} or {@code false}
* @return this operation instance
*/
public CompileKotlinOptions noReflect(boolean noReflect) {
noReflect_ = noReflect;
return this;
}
/**
* Don't automatically include the Kotlin/JVM stdlib ({@code kotlin-stdlib.jar}) and Kotlin reflection
* ({@code kotlin-reflect.jar}) into the classpath.
*
* @param noStdLib {@code true} or {@code false}
* @return this operation instance
*/
public CompileKotlinOptions noStdLib(boolean noStdLib) {
noStdLib_ = noStdLib;
return this;
}
/**
* Suppress the compiler from displaying warnings during compilation.
*
* @param noWarn {@code true} or {@code false}
* @return this operation instance
*/
public CompileKotlinOptions noWarn(boolean noWarn) {
noWarn_ = noWarn;
return this;
}
/**
* Enable usages of API that requires opt-in with a requirement annotation with the given fully qualified name.
*
* @param annotations one or more annotation names
* @return this operation instance
*/
public CompileKotlinOptions optIn(String... annotations) {
optIn_.addAll(List.of(annotations));
return this;
}
/**
* Enable usages of API that requires opt-in with a requirement annotation with the given fully qualified name.
*
* @param annotations list of annotation names
* @return this operation instance
*/
public CompileKotlinOptions optIn(Collection
* The location can be a directory, a ZIP, or a JAR file.
*
* @param path the location path
* @return this operation instance
*/
public CompileKotlinOptions path(File path) {
path_ = path.getAbsolutePath();
return this;
}
/**
* Place the generated class files into the specified location.
*
* The location can be a directory, a ZIP, or a JAR file.
*
* @param path the location path
* @return this operation instance
*/
public CompileKotlinOptions path(String path) {
path_ = path;
return this;
}
/**
* Pass an option to a plugin.
*
* @param id the plugin ID
* @param optionName the plugin option name
* @param value the plugin option value
* @return this operation instance
*/
public CompileKotlinOptions plugin(String id, String optionName, String value) {
plugin_.add(id + ':' + optionName + ':' + value);
return this;
}
/**
* Allow using declarations only from the specified version of Kotlin bundled libraries.
*
* @param progressive {@code true} or {@code false}
* @return this operation instance
*/
public CompileKotlinOptions progressive(boolean progressive) {
progressive_ = progressive;
return this;
}
/**
* Script definition template classes.
*
* Use fully qualified class names.
*
* @param classNames one or more class names
* @return this operation instance
*/
public CompileKotlinOptions scriptTemplates(String... classNames) {
scriptTemplates_.addAll(List.of(classNames));
return this;
}
/**
* Script definition template classes.
*
* Use fully qualified class names.
*
* @param classNames the list class names
* @return this operation instance
*/
public CompileKotlinOptions scriptTemplates(Collection