public final class JkKotlinCompiler
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static JkPathMatcher |
KOTLIN_SOURCE_MATCHER |
static java.lang.String |
KOTLIN_VERSION_OPTION |
Modifier and Type | Method and Description |
---|---|
JkKotlinCompiler |
addJvmOption(java.lang.String option)
Adds JVM options to pass to compiler program (which is a Java program).
|
JkKotlinCompiler |
addOption(java.lang.String option) |
JkKotlinCompiler |
addPlugin(java.nio.file.Path pluginJar) |
JkKotlinCompiler |
addPlugin(java.lang.String pluginModule) |
JkKotlinCompiler |
addPluginOption(java.lang.String pluginId,
java.lang.String name,
java.lang.String value) |
boolean |
compile(JkKotlinJvmCompileSpec compileSpec)
Actually compile the source files to the output directory.
|
java.util.List<java.lang.String> |
getPluginOptions() |
java.util.List<java.lang.String> |
getPlugins() |
JkRepoSet |
getRepos() |
JkPathSequence |
getStdJdk8Lib() |
java.nio.file.Path |
getStdLib()
Returns path of stdlib located in JEKA_HOME (if the compiler is provided by the platform) of from
a repo (if the comiler is managed by Jeka, meaning the version is specified)
|
java.lang.String |
getVersion()
Returns the version of Kotlin this compiler stands for.
|
boolean |
isProvidedCompiler()
Returns true if this compiler is provided by the host machine, meaning it has not been downloaded and managed by Jeka.
|
static JkKotlinCompiler |
ofCommand(java.lang.String command)
Creates a
JkKotlinCompiler based on the specified command. |
static JkKotlinCompiler |
ofJvm(JkRepoSet repos) |
static JkKotlinCompiler |
ofJvm(JkRepoSet repos,
java.lang.String version) |
static JkKotlinCompiler |
ofKotlinHomeCommand(java.lang.String command)
Creates a
JkKotlinCompiler based on the specified command located in `KOTLIN_HOME` directory. |
static JkKotlinCompiler |
ofTarget(JkRepoSet repos,
dev.jeka.core.api.kotlin.JkKotlinCompiler.Target target,
java.lang.String kotlinVersion)
Creates a
JkKotlinCompiler of the specified Kotlin version for the specified target platform. |
JkKotlinCompiler |
setFailOnError(boolean fail) |
JkKotlinCompiler |
setLogCommand(boolean log) |
JkKotlinCompiler |
setLogOutput(boolean log) |
JkKotlinCompiler |
setRepos(JkRepoSet repos)
Set the repo to fetch stdlib and plugins
|
public static final java.lang.String KOTLIN_VERSION_OPTION
public static final JkPathMatcher KOTLIN_SOURCE_MATCHER
public static JkKotlinCompiler ofCommand(java.lang.String command)
JkKotlinCompiler
based on the specified command. The specified command is supposed to be
accessible from the working directory. Examples of command are "kotlinc", "kotlinc-native", "/my/kotlin/home/kotlin-js', ...public static JkKotlinCompiler ofKotlinHomeCommand(java.lang.String command)
JkKotlinCompiler
based on the specified command located in `KOTLIN_HOME` directory.
Examples of command are "kotlinc", "kotlin-jvm", "kotlin-js".public static JkKotlinCompiler ofTarget(JkRepoSet repos, dev.jeka.core.api.kotlin.JkKotlinCompiler.Target target, java.lang.String kotlinVersion)
JkKotlinCompiler
of the specified Kotlin version for the specified target platform. The
compiler matching the specified Kotlin version is downloaded from the specified repo.public static JkKotlinCompiler ofJvm(JkRepoSet repos, java.lang.String version)
public static JkKotlinCompiler ofJvm(JkRepoSet repos)
public boolean isProvidedCompiler()
public java.lang.String getVersion()
null
.public java.nio.file.Path getStdLib()
public JkPathSequence getStdJdk8Lib()
public JkKotlinCompiler setFailOnError(boolean fail)
public JkKotlinCompiler setLogCommand(boolean log)
public JkKotlinCompiler setLogOutput(boolean log)
public JkRepoSet getRepos()
public JkKotlinCompiler setRepos(JkRepoSet repos)
public JkKotlinCompiler addJvmOption(java.lang.String option)
public JkKotlinCompiler addPluginOption(java.lang.String pluginId, java.lang.String name, java.lang.String value)
public JkKotlinCompiler addPlugin(java.nio.file.Path pluginJar)
public JkKotlinCompiler addPlugin(java.lang.String pluginModule)
public JkKotlinCompiler addOption(java.lang.String option)
public boolean compile(JkKotlinJvmCompileSpec compileSpec)
false
if a compilation error occurred.java.lang.IllegalStateException
- if a compilation error occurred and the 'withFailOnError' flag is true
.public java.util.List<java.lang.String> getPlugins()
public java.util.List<java.lang.String> getPluginOptions()