Move META-INF/extensions/compiler.xml to module 'cli'

This commit is contained in:
Alexander Udalov
2017-12-08 13:53:42 +01:00
parent 02857dbfdb
commit 95f9884799
4 changed files with 7 additions and 13 deletions
@@ -0,0 +1,54 @@
<idea-plugin>
<id>org.jetbrains.kotlin</id>
<version>1.2</version>
<extensionPoints>
<extensionPoint qualifiedName="org.jetbrains.kotlin.diagnosticSuppressor"
interface="org.jetbrains.kotlin.resolve.diagnostics.DiagnosticSuppressor"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.expressionCodegenExtension"
interface="org.jetbrains.kotlin.codegen.extensions.ExpressionCodegenExtension"
area="IDEA_PROJECT"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.syntheticResolveExtension"
interface="org.jetbrains.kotlin.resolve.extensions.SyntheticResolveExtension"
area="IDEA_PROJECT"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.jsSyntheticTranslateExtension"
interface="org.jetbrains.kotlin.js.translate.extensions.JsSyntheticTranslateExtension"
area="IDEA_PROJECT"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.simpleNameReferenceExtension"
interface="org.jetbrains.kotlin.plugin.references.SimpleNameReferenceExtension"
area="IDEA_PROJECT"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.kotlinIndicesHelperExtension"
interface="org.jetbrains.kotlin.idea.core.extension.KotlinIndicesHelperExtension"
area="IDEA_PROJECT"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.classBuilderFactoryInterceptorExtension"
interface="org.jetbrains.kotlin.codegen.extensions.ClassBuilderInterceptorExtension"
area="IDEA_PROJECT"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.packageFragmentProviderExtension"
interface="org.jetbrains.kotlin.resolve.jvm.extensions.PackageFragmentProviderExtension"
area="IDEA_PROJECT"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.quickFixContributor"
interface="org.jetbrains.kotlin.idea.quickfix.QuickFixContributor"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.storageComponentContainerContributor"
interface="org.jetbrains.kotlin.extensions.StorageComponentContainerContributor"
area="IDEA_PROJECT"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.scriptDefinitionContributor"
interface="org.jetbrains.kotlin.idea.core.script.ScriptDefinitionContributor"
area="IDEA_PROJECT"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.scriptTemplatesProvider"
interface="org.jetbrains.kotlin.idea.core.script.ScriptTemplatesProvider"
area="IDEA_PROJECT"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.facetConfigurationExtension"
interface="org.jetbrains.kotlin.idea.facet.KotlinFacetConfigurationExtension"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.versionInfoProvider"
interface="org.jetbrains.kotlin.idea.facet.KotlinVersionInfoProvider"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.completionInformationProvider"
interface="org.jetbrains.kotlin.idea.completion.CompletionInformationProvider" />
<extensionPoint qualifiedName="org.jetbrains.kotlin.moduleBuilder"
interface="com.intellij.ide.util.projectWizard.ModuleBuilder"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.defaultScriptDependenciesProvider"
interface="org.jetbrains.kotlin.idea.core.script.DefaultScriptDependenciesProvider"
area="IDEA_PROJECT"/>
<extensionPoint qualifiedName="org.jetbrains.kotlin.renameHandler"
interface="com.intellij.refactoring.rename.RenameHandler"/>
</extensionPoints>
</idea-plugin>
@@ -509,7 +509,6 @@ class KotlinCoreEnvironment private constructor(
}
private fun registerApplicationExtensionPointsAndExtensionsFrom(configuration: CompilerConfiguration, configFilePath: String) {
fun File.hasConfigFile(configFile: String): Boolean =
if (isDirectory) File(this, "META-INF" + File.separator + configFile).exists()
else try {
@@ -524,9 +523,9 @@ class KotlinCoreEnvironment private constructor(
val pluginRoot =
configuration.get(CLIConfigurationKeys.INTELLIJ_PLUGIN_ROOT)?.let(::File)
?: configuration.get(CLIConfigurationKeys.COMPILER_JAR_LOCATOR)?.compilerJar
?: PathUtil.pathUtilJar.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)
?: File("idea/src").takeIf { it.hasConfigFile(configFilePath) }
?: File("compiler/cli/src").takeIf { it.hasConfigFile(configFilePath) }
?: throw IllegalStateException("Unable to find extension point configuration $configFilePath")
CoreApplicationEnvironment.registerExtensionPointAndExtensions(pluginRoot, configFilePath, Extensions.getRootArea())