Build: Workaround scripting dependencies on full Idea
This commit is contained in:
@@ -20,6 +20,9 @@ dependencies {
|
|||||||
compileOnly(intellijCoreDep()) { includeJars("intellij-core") }
|
compileOnly(intellijCoreDep()) { includeJars("intellij-core") }
|
||||||
compileOnly(intellijDep()) { includeJars("asm-all", rootProject = rootProject) }
|
compileOnly(intellijDep()) { includeJars("asm-all", rootProject = rootProject) }
|
||||||
|
|
||||||
|
// FIXME: drop after removing references to LocalFileSystem they don't exist in intellij-core
|
||||||
|
compileOnly(intellijDep()) { includeJars("platform-api") }
|
||||||
|
|
||||||
testCompile(project(":compiler:frontend"))
|
testCompile(project(":compiler:frontend"))
|
||||||
testCompile(project(":compiler:plugin-api"))
|
testCompile(project(":compiler:plugin-api"))
|
||||||
testCompile(project(":compiler:util"))
|
testCompile(project(":compiler:util"))
|
||||||
|
|||||||
+6
-1
@@ -6,15 +6,20 @@
|
|||||||
package org.jetbrains.kotlin.scripting.definitions
|
package org.jetbrains.kotlin.scripting.definitions
|
||||||
|
|
||||||
import com.intellij.ide.highlighter.JavaClassFileType
|
import com.intellij.ide.highlighter.JavaClassFileType
|
||||||
import com.intellij.openapi.application.runReadAction
|
import com.intellij.openapi.application.ApplicationManager
|
||||||
import com.intellij.openapi.fileTypes.FileTypeRegistry
|
import com.intellij.openapi.fileTypes.FileTypeRegistry
|
||||||
import com.intellij.openapi.project.Project
|
import com.intellij.openapi.project.Project
|
||||||
|
import com.intellij.openapi.util.Computable
|
||||||
import com.intellij.openapi.vfs.VirtualFile
|
import com.intellij.openapi.vfs.VirtualFile
|
||||||
import com.intellij.psi.PsiFile
|
import com.intellij.psi.PsiFile
|
||||||
import com.intellij.psi.PsiManager
|
import com.intellij.psi.PsiManager
|
||||||
import org.jetbrains.kotlin.idea.KotlinFileType
|
import org.jetbrains.kotlin.idea.KotlinFileType
|
||||||
import org.jetbrains.kotlin.psi.KtFile
|
import org.jetbrains.kotlin.psi.KtFile
|
||||||
|
|
||||||
|
inline fun <T> runReadAction(crossinline runnable: () -> T): T {
|
||||||
|
return ApplicationManager.getApplication().runReadAction(Computable { runnable() })
|
||||||
|
}
|
||||||
|
|
||||||
fun PsiFile.findScriptDefinition(): ScriptDefinition? {
|
fun PsiFile.findScriptDefinition(): ScriptDefinition? {
|
||||||
// Do not use psiFile.script, see comments in findScriptDefinition
|
// Do not use psiFile.script, see comments in findScriptDefinition
|
||||||
if (this !is KtFile/* || this.script == null*/) return null
|
if (this !is KtFile/* || this.script == null*/) return null
|
||||||
|
|||||||
Reference in New Issue
Block a user