201: CoreApplicationEnvironment.registerExtensionPointAndExtensions accepts Path
This commit is contained in:
committed by
Nikolay Krasko
parent
cf78058cc2
commit
beb70526a2
@@ -216,7 +216,7 @@ class KotlinCoreEnvironment private constructor(
|
|||||||
)
|
)
|
||||||
|
|
||||||
val (initialRoots, javaModules) =
|
val (initialRoots, javaModules) =
|
||||||
classpathRootsResolver.convertClasspathRoots(configuration.getList(CLIConfigurationKeys.CONTENT_ROOTS))
|
classpathRootsResolver.convertClasspathRoots(configuration.getList(CLIConfigurationKeys.CONTENT_ROOTS))
|
||||||
this.initialRoots.addAll(initialRoots)
|
this.initialRoots.addAll(initialRoots)
|
||||||
|
|
||||||
if (!configuration.getBoolean(JVMConfigurationKeys.SKIP_RUNTIME_VERSION_CHECK) && messageCollector != null) {
|
if (!configuration.getBoolean(JVMConfigurationKeys.SKIP_RUNTIME_VERSION_CHECK) && messageCollector != null) {
|
||||||
@@ -228,7 +228,7 @@ class KotlinCoreEnvironment private constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val (roots, singleJavaFileRoots) =
|
val (roots, singleJavaFileRoots) =
|
||||||
initialRoots.partition { (file) -> file.isDirectory || file.extension != JavaFileType.DEFAULT_EXTENSION }
|
initialRoots.partition { (file) -> file.isDirectory || file.extension != JavaFileType.DEFAULT_EXTENSION }
|
||||||
|
|
||||||
// REPL and kapt2 update classpath dynamically
|
// REPL and kapt2 update classpath dynamically
|
||||||
rootsIndex = JvmDependenciesDynamicCompoundIndex().apply {
|
rootsIndex = JvmDependenciesDynamicCompoundIndex().apply {
|
||||||
@@ -528,7 +528,7 @@ class KotlinCoreEnvironment private constructor(
|
|||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
val pluginRoot =
|
val pluginRoot: File =
|
||||||
configuration.get(CLIConfigurationKeys.INTELLIJ_PLUGIN_ROOT)?.let(::File)
|
configuration.get(CLIConfigurationKeys.INTELLIJ_PLUGIN_ROOT)?.let(::File)
|
||||||
?: PathUtil.getResourcePathForClass(this::class.java).takeIf { it.hasConfigFile(configFilePath) }
|
?: PathUtil.getResourcePathForClass(this::class.java).takeIf { it.hasConfigFile(configFilePath) }
|
||||||
// hack for load extensions when compiler run directly from project directory (e.g. in tests)
|
// hack for load extensions when compiler run directly from project directory (e.g. in tests)
|
||||||
@@ -538,7 +538,7 @@ class KotlinCoreEnvironment private constructor(
|
|||||||
"(cp:\n ${(Thread.currentThread().contextClassLoader as? UrlClassLoader)?.urls?.joinToString("\n ") { it.file }})"
|
"(cp:\n ${(Thread.currentThread().contextClassLoader as? UrlClassLoader)?.urls?.joinToString("\n ") { it.file }})"
|
||||||
)
|
)
|
||||||
|
|
||||||
CoreApplicationEnvironment.registerExtensionPointAndExtensions(pluginRoot, configFilePath, Extensions.getRootArea())
|
registerExtensionPointAndExtensionsEx(pluginRoot, configFilePath, Extensions.getRootArea())
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun workaroundIbmJdkStaxReportCdataEventIssue() {
|
private fun workaroundIbmJdkStaxReportCdataEventIssue() {
|
||||||
@@ -715,4 +715,3 @@ class KotlinCoreEnvironment private constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.cli.jvm.compiler
|
||||||
|
|
||||||
|
import com.intellij.core.CoreApplicationEnvironment
|
||||||
|
import com.intellij.openapi.extensions.ExtensionsArea
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
// BUNCH: 193
|
||||||
|
fun registerExtensionPointAndExtensionsEx(pluginFile: File, fileName: String, area: ExtensionsArea) {
|
||||||
|
@Suppress("MissingRecentApi")
|
||||||
|
CoreApplicationEnvironment.registerExtensionPointAndExtensions(pluginFile, fileName, area)
|
||||||
|
}
|
||||||
+18
@@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.cli.jvm.compiler
|
||||||
|
|
||||||
|
import com.intellij.core.CoreApplicationEnvironment
|
||||||
|
import com.intellij.openapi.extensions.ExtensionsArea
|
||||||
|
import java.io.File
|
||||||
|
import java.nio.file.FileSystems
|
||||||
|
|
||||||
|
// BUNCH: 193
|
||||||
|
fun registerExtensionPointAndExtensionsEx(pluginFile: File, fileName: String, area: ExtensionsArea) {
|
||||||
|
val pluginRoot = FileSystems.getDefault().getPath(pluginFile.path)
|
||||||
|
@Suppress("MissingRecentApi")
|
||||||
|
CoreApplicationEnvironment.registerExtensionPointAndExtensions(pluginRoot, fileName, area)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user