K2JVMCompiler: cleanup after J2K
This commit is contained in:
@@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.cli.jvm
|
package org.jetbrains.kotlin.cli.jvm
|
||||||
|
|
||||||
import com.google.common.base.Splitter
|
|
||||||
import com.google.common.collect.Lists
|
|
||||||
import com.intellij.openapi.Disposable
|
import com.intellij.openapi.Disposable
|
||||||
import kotlin.Unit
|
import kotlin.Unit
|
||||||
import org.jetbrains.kotlin.cli.common.CLICompiler
|
import org.jetbrains.kotlin.cli.common.CLICompiler
|
||||||
@@ -71,15 +69,11 @@ public class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
|
|||||||
|
|
||||||
if (IncrementalCompilation.ENABLED) {
|
if (IncrementalCompilation.ENABLED) {
|
||||||
val incrementalCacheProvider = services.get(javaClass<IncrementalCacheProvider>())
|
val incrementalCacheProvider = services.get(javaClass<IncrementalCacheProvider>())
|
||||||
if (incrementalCacheProvider != null) {
|
configuration.put(JVMConfigurationKeys.INCREMENTAL_CACHE_PROVIDER, incrementalCacheProvider)
|
||||||
configuration.put(JVMConfigurationKeys.INCREMENTAL_CACHE_PROVIDER, incrementalCacheProvider)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val locator = services.get(javaClass<CompilerJarLocator>())
|
val locator = services.get(javaClass<CompilerJarLocator>())
|
||||||
if (locator != null) {
|
configuration.put(JVMConfigurationKeys.COMPILER_JAR_LOCATOR, locator)
|
||||||
configuration.put(JVMConfigurationKeys.COMPILER_JAR_LOCATOR, locator)
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!arguments.noJdk) {
|
if (!arguments.noJdk) {
|
||||||
@@ -198,11 +192,7 @@ public class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (arguments.reportPerf) {
|
if (arguments.reportPerf) {
|
||||||
PerformanceCounter.report(object : Function1<String, Unit> {
|
PerformanceCounter.report { s -> reportPerf(environment.configuration, s) }
|
||||||
override fun invoke(s: String): Unit {
|
|
||||||
reportPerf(environment.configuration, s)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
return OK
|
return OK
|
||||||
}
|
}
|
||||||
@@ -224,9 +214,7 @@ public class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
|
|||||||
/**
|
/**
|
||||||
* Allow derived classes to add additional command line arguments
|
* Allow derived classes to add additional command line arguments
|
||||||
*/
|
*/
|
||||||
override fun createArguments(): K2JVMCompilerArguments {
|
override fun createArguments() = K2JVMCompilerArguments()
|
||||||
return K2JVMCompilerArguments()
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
@@ -235,9 +223,8 @@ public class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public fun reportPerf(configuration: CompilerConfiguration, message: String) {
|
public fun reportPerf(configuration: CompilerConfiguration, message: String) {
|
||||||
val collector = configuration.get(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY)
|
val collector = configuration[CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY]!!
|
||||||
assert(collector != null)
|
collector.report(CompilerMessageSeverity.INFO, "PERF: " + message, CompilerMessageLocation.NO_LOCATION)
|
||||||
collector!!.report(CompilerMessageSeverity.INFO, "PERF: " + message, CompilerMessageLocation.NO_LOCATION)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun putAdvancedOptions(configuration: CompilerConfiguration, arguments: K2JVMCompilerArguments) {
|
private fun putAdvancedOptions(configuration: CompilerConfiguration, arguments: K2JVMCompilerArguments) {
|
||||||
@@ -248,11 +235,9 @@ public class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun getClasspath(paths: KotlinPaths, arguments: K2JVMCompilerArguments): List<File> {
|
private fun getClasspath(paths: KotlinPaths, arguments: K2JVMCompilerArguments): List<File> {
|
||||||
val classpath = Lists.newArrayList<File>()
|
val classpath = arrayListOf<File>()
|
||||||
if (arguments.classpath != null) {
|
if (arguments.classpath != null) {
|
||||||
for (element in Splitter.on(File.pathSeparatorChar).split(arguments.classpath)) {
|
classpath.addAll(arguments.classpath.split(File.pathSeparatorChar).map { File(it) })
|
||||||
classpath.add(File(element))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (!arguments.noStdlib) {
|
if (!arguments.noStdlib) {
|
||||||
classpath.add(paths.getRuntimePath())
|
classpath.add(paths.getRuntimePath())
|
||||||
@@ -261,11 +246,9 @@ public class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun getAnnotationsPath(paths: KotlinPaths, arguments: K2JVMCompilerArguments): List<File> {
|
private fun getAnnotationsPath(paths: KotlinPaths, arguments: K2JVMCompilerArguments): List<File> {
|
||||||
val annotationsPath = Lists.newArrayList<File>()
|
val annotationsPath = arrayListOf<File>()
|
||||||
if (arguments.annotations != null) {
|
if (arguments.annotations != null) {
|
||||||
for (element in Splitter.on(File.pathSeparatorChar).split(arguments.annotations)) {
|
annotationsPath.addAll(arguments.annotations.split(File.pathSeparatorChar).map { File(it) })
|
||||||
annotationsPath.add(File(element))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (!arguments.noJdkAnnotations) {
|
if (!arguments.noJdkAnnotations) {
|
||||||
annotationsPath.add(paths.getJdkAnnotationsPath())
|
annotationsPath.add(paths.getJdkAnnotationsPath())
|
||||||
|
|||||||
Reference in New Issue
Block a user