CLI: Allow to specify JDK for classpath building with '-jdk' compiler argument.

Maven: support jdk parameter linked to kotlin.compiler.jdk property.
Gradle: support jdk compiler option.
This commit is contained in:
Ilya Gorbunov
2016-06-16 22:00:07 +03:00
parent 1157e052ee
commit 644df89dc9
7 changed files with 35 additions and 8 deletions
@@ -62,7 +62,19 @@ class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
try {
if (!arguments.noJdk) {
configuration.addJvmClasspathRoots(PathUtil.getJdkClassesRoots())
if (arguments.jdk != null) {
configuration.addJvmClasspathRoots(PathUtil.getJdkClassesRoots(File(arguments.jdk)))
}
else {
configuration.addJvmClasspathRoots(PathUtil.getJdkClassesRoots())
}
}
else {
if (arguments.jdk != null) {
messageCollector.report(CompilerMessageSeverity.WARNING,
"The '-jdk' option with a path to JDK is ignored because '-no-jdk' is specified",
CompilerMessageLocation.NO_LOCATION)
}
}
}
catch (t: Throwable) {