Providing plugin classpath through JPS extensions

This commit is contained in:
Yan Zhulanow
2014-10-17 19:52:39 +04:00
parent c94844f6dc
commit af9c5cc45d
4 changed files with 23 additions and 6 deletions
@@ -12,6 +12,6 @@
<orderEntry type="library" scope="PROVIDED" name="android" level="project" />
<orderEntry type="library" name="kotlin-runtime" level="project" />
<orderEntry type="module" module-name="android-compiler-plugin" />
<orderEntry type="module" module-name="util" scope="PROVIDED" />
</component>
</module>
</module>
@@ -22,8 +22,9 @@ import org.jetbrains.jps.incremental.CompileContext
import org.jetbrains.jps.model.module.JpsModule
import java.io.File
import org.jetbrains.jps.android.AndroidJpsUtil
import org.jetbrains.kotlin.android.AndroidCommandLineProcessor
import org.jetbrains.kotlin.compiler.plugin.CliOption
import org.jetbrains.kotlin.android.AndroidCommandLineProcessor
import org.jetbrains.jet.utils.PathUtil
public class KotlinAndroidJpsPlugin : KotlinJpsCompilerArgumentsProvider {
override fun getExtraArguments(moduleBuildTarget: ModuleBuildTarget, context: CompileContext): List<String> {
@@ -34,6 +35,12 @@ public class KotlinAndroidJpsPlugin : KotlinJpsCompilerArgumentsProvider {
)
}
override fun getClasspath(moduleBuildTarget: ModuleBuildTarget, context: CompileContext): List<String> {
return listOf(
File(PathUtil.getJarPathForClass(javaClass).getParentFile().getParentFile(), "android-compiler-plugin.jar").getAbsolutePath()
)
}
private fun makePluginOption(option: CliOption, value: String): String {
return "plugin:${AndroidCommandLineProcessor.ANDROID_COMPILER_PLUGIN_ID}:${option.name}=$value"
}