Introduced bare kotlin compiler plugin for IntelliJ IDEA developers.

This commit is contained in:
Evgeny Gerashchenko
2014-08-26 17:05:41 +04:00
parent b728f47947
commit 822f02e23a
5 changed files with 125 additions and 0 deletions
@@ -0,0 +1,22 @@
<idea-plugin version="2" url="http://kotlin.jetbrains.org">
<id>org.jetbrains.kotlin.bare</id>
<name>Kotlin Bare Compiler for IntelliJ IDEA</name>
<description>
This plugin is intended for IntelliJ IDEA developers only. It should be installed along with main Kotlin plugin.
When main Kotlin plugin is disabled due to incompatibility with bleeding edge IntelliJ IDEA,
this plugin will still compile Kotlin sources.
<br />
This plugin is only capable of compiling Kotlin code. All highlighting, inspections, refactorings are disabled.
</description>
<version>@snapshot@</version>
<vendor url="http://www.jetbrains.com">JetBrains Inc.</vendor>
<idea-version since-build="138.977" until-build="999.9999"/>
<application-components>
<component>
<implementation-class>org.jetbrains.jet.plugin.bare.BareJpsPluginRegistrar</implementation-class>
</component>
</application-components>
</idea-plugin>
@@ -0,0 +1,50 @@
/*
* Copyright 2010-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.jet.plugin.bare
import com.intellij.compiler.server.CompileServerPlugin
import com.intellij.ide.plugins.IdeaPluginDescriptor
import com.intellij.ide.plugins.PluginManager
import com.intellij.openapi.components.ApplicationComponent
import com.intellij.openapi.extensions.Extensions
import com.intellij.openapi.extensions.PluginId
public class BareJpsPluginRegistrar : ApplicationComponent {
override fun initComponent() {
val mainKotlinPlugin = PluginManager.getPlugin(PluginId.getId("org.jetbrains.kotlin"))
if (mainKotlinPlugin != null && mainKotlinPlugin.isEnabled()) {
// do nothing
}
else {
val compileServerPlugin = CompileServerPlugin()
compileServerPlugin.setClasspath("jps/kotlin-jps-plugin.jar;kotlin-runtime.jar;kotlin-bare-plugin.jar")
compileServerPlugin.setPluginDescriptor(PluginManager.getPlugin(PluginId.getId("org.jetbrains.kotlin.bare")))
Extensions.getRootArea()
.getExtensionPoint(CompileServerPlugin.EP_NAME)
.registerExtension(compileServerPlugin)
}
}
override fun disposeComponent() {
}
override fun getComponentName(): String {
return javaClass.getName()
}
}