diff --git a/.idea/artifacts/KotlinPlugin.xml b/.idea/artifacts/KotlinPlugin.xml
index d8b8d2eac98..76190390b88 100644
--- a/.idea/artifacts/KotlinPlugin.xml
+++ b/.idea/artifacts/KotlinPlugin.xml
@@ -60,6 +60,7 @@
+
diff --git a/.idea/modules.xml b/.idea/modules.xml
index 9bd6182e30c..4fbb42c66d3 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -41,6 +41,7 @@
+
diff --git a/build.xml b/build.xml
index 70847c6f596..8531bb18254 100644
--- a/build.xml
+++ b/build.xml
@@ -96,6 +96,7 @@
+
@@ -130,6 +131,7 @@
+
@@ -245,6 +247,7 @@
+
diff --git a/compiler/cli/cli.iml b/compiler/cli/cli.iml
index d057c66da4d..ddc2e2618d0 100644
--- a/compiler/cli/cli.iml
+++ b/compiler/cli/cli.iml
@@ -23,5 +23,6 @@
+
\ No newline at end of file
diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt
index 2b0b451f7bf..c40735b6fd6 100644
--- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt
+++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt
@@ -1,5 +1,5 @@
/*
- * Copyright 2010-2016 JetBrains s.r.o.
+ * Copyright 2010-2017 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.
@@ -104,6 +104,7 @@ import org.jetbrains.kotlin.resolve.lazy.declarations.CliDeclarationProviderFact
import org.jetbrains.kotlin.resolve.lazy.declarations.DeclarationProviderFactoryService
import org.jetbrains.kotlin.script.KotlinScriptDefinitionProvider
import org.jetbrains.kotlin.script.KotlinScriptExternalImportsProvider
+import org.jetbrains.kotlin.script.KotlinScriptExternalImportsProviderImpl
import org.jetbrains.kotlin.utils.PathUtil
import java.io.File
@@ -481,7 +482,7 @@ class KotlinCoreEnvironment private constructor(
with (projectEnvironment.project) {
val kotlinScriptDefinitionProvider = KotlinScriptDefinitionProvider()
registerService(KotlinScriptDefinitionProvider::class.java, kotlinScriptDefinitionProvider)
- registerService(KotlinScriptExternalImportsProvider::class.java, KotlinScriptExternalImportsProvider(projectEnvironment.project, kotlinScriptDefinitionProvider))
+ registerService(KotlinScriptExternalImportsProvider::class.java, KotlinScriptExternalImportsProviderImpl(projectEnvironment.project, kotlinScriptDefinitionProvider))
registerService(KotlinJavaPsiFacade::class.java, KotlinJavaPsiFacade(this))
registerService(KtLightClassForFacade.FacadeStubCache::class.java, KtLightClassForFacade.FacadeStubCache(this))
}
diff --git a/compiler/daemon/daemon.iml b/compiler/daemon/daemon.iml
index 8d3fad96acf..021cc32fca4 100644
--- a/compiler/daemon/daemon.iml
+++ b/compiler/daemon/daemon.iml
@@ -15,5 +15,6 @@
+
\ No newline at end of file
diff --git a/compiler/frontend.script/frontend.script.iml b/compiler/frontend.script/frontend.script.iml
new file mode 100644
index 00000000000..2ab5a4ba725
--- /dev/null
+++ b/compiler/frontend.script/frontend.script.iml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/compiler/frontend/src/org/jetbrains/kotlin/script/KotlinScriptDefinitionFromAnnotatedTemplate.kt b/compiler/frontend.script/src/org/jetbrains/kotlin/script/KotlinScriptDefinitionFromAnnotatedTemplate.kt
similarity index 99%
rename from compiler/frontend/src/org/jetbrains/kotlin/script/KotlinScriptDefinitionFromAnnotatedTemplate.kt
rename to compiler/frontend.script/src/org/jetbrains/kotlin/script/KotlinScriptDefinitionFromAnnotatedTemplate.kt
index 05552fec9f8..4b8fd34e48e 100644
--- a/compiler/frontend/src/org/jetbrains/kotlin/script/KotlinScriptDefinitionFromAnnotatedTemplate.kt
+++ b/compiler/frontend.script/src/org/jetbrains/kotlin/script/KotlinScriptDefinitionFromAnnotatedTemplate.kt
@@ -1,5 +1,5 @@
/*
- * Copyright 2010-2016 JetBrains s.r.o.
+ * Copyright 2010-2017 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.
diff --git a/compiler/frontend/src/org/jetbrains/kotlin/script/KotlinScriptExternalImportsProvider.kt b/compiler/frontend.script/src/org/jetbrains/kotlin/script/KotlinScriptExternalImportsProviderImpl.kt
similarity index 84%
rename from compiler/frontend/src/org/jetbrains/kotlin/script/KotlinScriptExternalImportsProvider.kt
rename to compiler/frontend.script/src/org/jetbrains/kotlin/script/KotlinScriptExternalImportsProviderImpl.kt
index e7e1c5256fd..d40395bd2ee 100644
--- a/compiler/frontend/src/org/jetbrains/kotlin/script/KotlinScriptExternalImportsProvider.kt
+++ b/compiler/frontend.script/src/org/jetbrains/kotlin/script/KotlinScriptExternalImportsProviderImpl.kt
@@ -1,5 +1,5 @@
/*
- * Copyright 2010-2016 JetBrains s.r.o.
+ * Copyright 2010-2017 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.
@@ -19,19 +19,23 @@ package org.jetbrains.kotlin.script
import com.intellij.openapi.components.ServiceManager
import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.project.Project
-import com.intellij.openapi.vfs.VirtualFile
import java.io.File
import java.util.concurrent.locks.ReentrantReadWriteLock
import kotlin.concurrent.read
import kotlin.concurrent.write
import kotlin.script.dependencies.KotlinScriptExternalDependencies
-class KotlinScriptExternalImportsProvider(val project: Project, private val scriptDefinitionProvider: KotlinScriptDefinitionProvider) {
+class KotlinScriptExternalImportsProviderImpl(
+ val project: Project,
+ private val scriptDefinitionProvider: KotlinScriptDefinitionProvider
+) : KotlinScriptExternalImportsProvider {
private val cacheLock = ReentrantReadWriteLock()
private val cache = hashMapOf()
- fun getExternalImports(file: TF): KotlinScriptExternalDependencies? = cacheLock.read { calculateExternalDependencies(file) }
+ override fun getExternalImports(file: TF): KotlinScriptExternalDependencies? = cacheLock.read {
+ calculateExternalDependencies(file)
+ }
fun getExternalImports(files: Iterable): List = cacheLock.read {
files.mapNotNull { calculateExternalDependencies(it) }
@@ -58,7 +62,7 @@ class KotlinScriptExternalImportsProvider(val project: Project, private val scri
// optimized for initial caching, additional handling of possible duplicates to save a call to distinct
// returns list of cached files
- fun cacheExternalImports(files: Iterable): Iterable = cacheLock.write {
+ override fun cacheExternalImports(files: Iterable): Iterable = cacheLock.write {
val uncached = hashSetOf()
files.mapNotNull { file ->
val path = getFilePath(file)
@@ -84,7 +88,7 @@ class KotlinScriptExternalImportsProvider(val project: Project, private val scri
// optimized for update, no special duplicates handling
// returns files with valid script definition (or deleted from cache - which in fact should have script def too)
// TODO: this is the badly designed contract, since it mixes the entities, but these files are needed on the calling site now. Find out other solution
- fun updateExternalImportsCache(files: Iterable): Iterable = cacheLock.write {
+ override fun updateExternalImportsCache(files: Iterable): Iterable = cacheLock.write {
files.mapNotNull { file ->
val path = getFilePath(file)
if (!isValidFile(file)) {
@@ -124,19 +128,19 @@ class KotlinScriptExternalImportsProvider(val project: Project, private val scri
}
}
- fun invalidateCaches() {
+ override fun invalidateCaches() {
cacheLock.write(cache::clear)
}
- fun getKnownCombinedClasspath(): List = cacheLock.read {
+ override fun getKnownCombinedClasspath(): List = cacheLock.read {
cache.values.flatMap { it?.classpath ?: emptyList() }
}.distinct()
- fun getKnownSourceRoots(): List = cacheLock.read {
+ override fun getKnownSourceRoots(): List = cacheLock.read {
cache.values.flatMap { it?.sources ?: emptyList() }
}.distinct()
- fun getCombinedClasspathFor(files: Iterable): List =
+ override fun getCombinedClasspathFor(files: Iterable): List =
getExternalImports(files)
.flatMap { it.classpath }
.distinct()
@@ -149,13 +153,10 @@ class KotlinScriptExternalImportsProvider(val project: Project, private val scri
}
}
-internal fun Iterable.isSamePathListAs(other: Iterable): Boolean =
+private fun Iterable.isSamePathListAs(other: Iterable): Boolean =
with (Pair(iterator(), other.iterator())) {
while (first.hasNext() && second.hasNext()) {
if (first.next().canonicalPath != second.next().canonicalPath) return false
}
!(first.hasNext() || second.hasNext())
}
-
-fun getScriptExternalDependencies(file: VirtualFile, project: Project): KotlinScriptExternalDependencies? =
- KotlinScriptExternalImportsProvider.getInstance(project)?.getExternalImports(file)
diff --git a/compiler/frontend.script/src/org/jetbrains/kotlin/script/ScriptHelperImpl.kt b/compiler/frontend.script/src/org/jetbrains/kotlin/script/ScriptHelperImpl.kt
new file mode 100644
index 00000000000..3b311453818
--- /dev/null
+++ b/compiler/frontend.script/src/org/jetbrains/kotlin/script/ScriptHelperImpl.kt
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2010-2017 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.kotlin.script
+
+import org.jetbrains.kotlin.descriptors.ScriptDescriptor
+import kotlin.reflect.KClass
+
+class ScriptHelperImpl : ScriptHelper {
+ override fun getScriptParameters(kotlinScriptDefinition: KotlinScriptDefinition, scriptDefinition: ScriptDescriptor) =
+ kotlinScriptDefinition.getScriptParameters(scriptDefinition)
+
+ override fun getKotlinType(scriptDescriptor: ScriptDescriptor, kClass: KClass) =
+ getKotlinTypeByKClass(scriptDescriptor, kClass)
+}
\ No newline at end of file
diff --git a/compiler/frontend/src/org/jetbrains/kotlin/script/scriptAnnotationsPreprocessing.kt b/compiler/frontend.script/src/org/jetbrains/kotlin/script/scriptAnnotationsPreprocessing.kt
similarity index 98%
rename from compiler/frontend/src/org/jetbrains/kotlin/script/scriptAnnotationsPreprocessing.kt
rename to compiler/frontend.script/src/org/jetbrains/kotlin/script/scriptAnnotationsPreprocessing.kt
index d55d16e805e..41d445a76eb 100644
--- a/compiler/frontend/src/org/jetbrains/kotlin/script/scriptAnnotationsPreprocessing.kt
+++ b/compiler/frontend.script/src/org/jetbrains/kotlin/script/scriptAnnotationsPreprocessing.kt
@@ -1,5 +1,5 @@
/*
- * Copyright 2010-2016 JetBrains s.r.o.
+ * Copyright 2010-2017 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.
diff --git a/compiler/frontend/src/org/jetbrains/kotlin/script/scriptTemplate.kt b/compiler/frontend.script/src/org/jetbrains/kotlin/script/scriptTemplate.kt
similarity index 100%
rename from compiler/frontend/src/org/jetbrains/kotlin/script/scriptTemplate.kt
rename to compiler/frontend.script/src/org/jetbrains/kotlin/script/scriptTemplate.kt
diff --git a/compiler/frontend/src/org/jetbrains/kotlin/script/scriptTemplateProviderExtensionPoint.kt b/compiler/frontend.script/src/org/jetbrains/kotlin/script/scriptTemplateProviderExtensionPoint.kt
similarity index 98%
rename from compiler/frontend/src/org/jetbrains/kotlin/script/scriptTemplateProviderExtensionPoint.kt
rename to compiler/frontend.script/src/org/jetbrains/kotlin/script/scriptTemplateProviderExtensionPoint.kt
index 4b8d9644d3a..e28d1e066e4 100644
--- a/compiler/frontend/src/org/jetbrains/kotlin/script/scriptTemplateProviderExtensionPoint.kt
+++ b/compiler/frontend.script/src/org/jetbrains/kotlin/script/scriptTemplateProviderExtensionPoint.kt
@@ -1,5 +1,5 @@
/*
- * Copyright 2010-2016 JetBrains s.r.o.
+ * Copyright 2010-2017 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.
diff --git a/compiler/frontend/src/org/jetbrains/kotlin/script/scriptTypeUtil.kt b/compiler/frontend.script/src/org/jetbrains/kotlin/script/scriptTypeUtil.kt
similarity index 85%
rename from compiler/frontend/src/org/jetbrains/kotlin/script/scriptTypeUtil.kt
rename to compiler/frontend.script/src/org/jetbrains/kotlin/script/scriptTypeUtil.kt
index 3ce8caa938a..91bd4a4d3c4 100644
--- a/compiler/frontend/src/org/jetbrains/kotlin/script/scriptTypeUtil.kt
+++ b/compiler/frontend.script/src/org/jetbrains/kotlin/script/scriptTypeUtil.kt
@@ -1,5 +1,5 @@
/*
- * Copyright 2010-2016 JetBrains s.r.o.
+ * Copyright 2010-2017 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.
@@ -26,21 +26,22 @@ import org.jetbrains.kotlin.serialization.deserialization.NotFoundClasses
import org.jetbrains.kotlin.serialization.deserialization.findNonGenericClassAcrossDependencies
import org.jetbrains.kotlin.storage.LockBasedStorageManager
import org.jetbrains.kotlin.types.*
-import kotlin.reflect.*
+import kotlin.reflect.KClass
+import kotlin.reflect.KType
+import kotlin.reflect.KTypeProjection
+import kotlin.reflect.KVariance
import kotlin.reflect.full.primaryConstructor
-data class ScriptParameter(val name: Name, val type: KotlinType)
-
fun KotlinScriptDefinition.getScriptParameters(scriptDescriptor: ScriptDescriptor): List =
template.primaryConstructor?.parameters
?.map { ScriptParameter(Name.identifier(it.name!!), getKotlinTypeByKType(scriptDescriptor, it.type)) }
?: emptyList()
-fun getKotlinType(scriptDescriptor: ScriptDescriptor, kClass: KClass): KotlinType =
+fun getKotlinTypeByKClass(scriptDescriptor: ScriptDescriptor, kClass: KClass): KotlinType =
getKotlinTypeByFqName(scriptDescriptor,
kClass.qualifiedName ?: throw RuntimeException("Cannot get FQN from $kClass"))
-fun getKotlinTypeByFqName(scriptDescriptor: ScriptDescriptor, fqName: String): KotlinType =
+private fun getKotlinTypeByFqName(scriptDescriptor: ScriptDescriptor, fqName: String): KotlinType =
scriptDescriptor.module.findNonGenericClassAcrossDependencies(
ClassId.topLevel(FqName(fqName)),
NotFoundClasses(LockBasedStorageManager.NO_LOCKS, scriptDescriptor.module)
@@ -49,12 +50,12 @@ fun getKotlinTypeByFqName(scriptDescriptor: ScriptDescriptor, fqName: String): K
// TODO: support star projections
// TODO: support annotations on types and type parameters
// TODO: support type parameters on types and type projections
-fun getKotlinTypeByKType(scriptDescriptor: ScriptDescriptor, kType: KType): KotlinType {
+private fun getKotlinTypeByKType(scriptDescriptor: ScriptDescriptor, kType: KType): KotlinType {
val classifier = kType.classifier
if (classifier !is KClass<*>)
throw java.lang.UnsupportedOperationException("Only classes are supported as parameters in script template: $classifier")
- val type = getKotlinType(scriptDescriptor, classifier)
+ val type = getKotlinTypeByKClass(scriptDescriptor, classifier)
val typeProjections = kType.arguments.map { getTypeProjection(scriptDescriptor, it) }
val isNullable = kType.isMarkedNullable
diff --git a/compiler/frontend/frontend.iml b/compiler/frontend/frontend.iml
index 38bac040012..80953adda4f 100644
--- a/compiler/frontend/frontend.iml
+++ b/compiler/frontend/frontend.iml
@@ -18,6 +18,5 @@
-
\ No newline at end of file
diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyScriptClassMemberScope.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyScriptClassMemberScope.kt
index f794b3d962e..c8ab86e7591 100644
--- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyScriptClassMemberScope.kt
+++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyScriptClassMemberScope.kt
@@ -1,5 +1,5 @@
/*
- * Copyright 2010-2016 JetBrains s.r.o.
+ * Copyright 2010-2017 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.
@@ -24,7 +24,7 @@ import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.resolve.BindingTrace
import org.jetbrains.kotlin.resolve.lazy.ResolveSession
import org.jetbrains.kotlin.resolve.lazy.declarations.ClassMemberDeclarationProvider
-import org.jetbrains.kotlin.script.getScriptParameters
+import org.jetbrains.kotlin.script.ScriptHelper
class LazyScriptClassMemberScope(
resolveSession: ResolveSession,
@@ -49,7 +49,7 @@ class LazyScriptClassMemberScope(
}
private fun createScriptParameters(constructor: ClassConstructorDescriptorImpl): List {
- return scriptDescriptor.scriptDefinition.getScriptParameters(scriptDescriptor).mapIndexed { index, (name, type) ->
+ return ScriptHelper.getInstance()!!.getScriptParameters(scriptDescriptor.scriptDefinition, scriptDescriptor).mapIndexed { index, (name, type) ->
ValueParameterDescriptorImpl(
constructor, null, index, Annotations.EMPTY, name, type,
/* declaresDefaultValue = */ false,
diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyScriptDescriptor.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyScriptDescriptor.kt
index 59e526c6fa7..dec8828688b 100644
--- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyScriptDescriptor.kt
+++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyScriptDescriptor.kt
@@ -1,5 +1,5 @@
/*
- * Copyright 2010-2016 JetBrains s.r.o.
+ * Copyright 2010-2017 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.
@@ -28,8 +28,8 @@ import org.jetbrains.kotlin.resolve.lazy.data.KtScriptInfo
import org.jetbrains.kotlin.resolve.lazy.declarations.ClassMemberDeclarationProvider
import org.jetbrains.kotlin.resolve.source.toSourceElement
import org.jetbrains.kotlin.script.KotlinScriptDefinition
+import org.jetbrains.kotlin.script.ScriptHelper
import org.jetbrains.kotlin.script.ScriptPriorities
-import org.jetbrains.kotlin.script.getKotlinTypeByFqName
import org.jetbrains.kotlin.script.getScriptDefinition
import org.jetbrains.kotlin.types.TypeSubstitutor
import org.jetbrains.kotlin.utils.ifEmpty
@@ -80,5 +80,5 @@ class LazyScriptDescriptor(
override fun getUnsubstitutedPrimaryConstructor() = super.getUnsubstitutedPrimaryConstructor()!!
- override fun computeSupertypes() = listOf(getKotlinTypeByFqName(this, scriptDefinition.template.qualifiedName!!)).ifEmpty { listOf(builtIns.anyType) }
+ override fun computeSupertypes() = listOf(ScriptHelper.getInstance()!!.getKotlinType(this, scriptDefinition.template)).ifEmpty { listOf(builtIns.anyType) }
}
diff --git a/compiler/frontend/src/org/jetbrains/kotlin/script/IKotlinScriptExternalImportsProvider.kt b/compiler/frontend/src/org/jetbrains/kotlin/script/IKotlinScriptExternalImportsProvider.kt
new file mode 100644
index 00000000000..c736996dc59
--- /dev/null
+++ b/compiler/frontend/src/org/jetbrains/kotlin/script/IKotlinScriptExternalImportsProvider.kt
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2010-2017 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.kotlin.script
+
+import com.intellij.openapi.components.ServiceManager
+import com.intellij.openapi.project.Project
+import com.intellij.openapi.vfs.VirtualFile
+import java.io.File
+import kotlin.script.dependencies.KotlinScriptExternalDependencies
+
+interface KotlinScriptExternalImportsProvider {
+ fun getExternalImports(file: TF): KotlinScriptExternalDependencies?
+ fun cacheExternalImports(files: Iterable): Iterable
+ fun updateExternalImportsCache(files: Iterable): Iterable
+ fun invalidateCaches()
+ fun getKnownCombinedClasspath(): List
+ fun getKnownSourceRoots(): List
+ fun getCombinedClasspathFor(files: Iterable): List
+
+ companion object {
+ fun getInstance(project: Project): KotlinScriptExternalImportsProvider? =
+ ServiceManager.getService(project, KotlinScriptExternalImportsProvider::class.java)
+ }
+}
+
+fun getScriptExternalDependencies(file: VirtualFile, project: Project): KotlinScriptExternalDependencies? =
+ KotlinScriptExternalImportsProvider.getInstance(project)?.getExternalImports(file)
diff --git a/compiler/frontend/src/org/jetbrains/kotlin/script/ScriptHelper.kt b/compiler/frontend/src/org/jetbrains/kotlin/script/ScriptHelper.kt
new file mode 100644
index 00000000000..4b7876e07c7
--- /dev/null
+++ b/compiler/frontend/src/org/jetbrains/kotlin/script/ScriptHelper.kt
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2010-2017 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.kotlin.script
+
+import com.intellij.openapi.extensions.ExtensionPointName
+import org.jetbrains.kotlin.descriptors.ScriptDescriptor
+import org.jetbrains.kotlin.name.Name
+import org.jetbrains.kotlin.types.KotlinType
+import kotlin.reflect.KClass
+
+data class ScriptParameter(val name: Name, val type: KotlinType)
+
+interface ScriptHelper {
+ fun getScriptParameters(kotlinScriptDefinition: KotlinScriptDefinition, scriptDefinition: ScriptDescriptor): List
+ fun getKotlinType(scriptDescriptor: ScriptDescriptor, kClass: KClass): KotlinType
+
+ companion object {
+ private val EP_NAME = ExtensionPointName.create("org.jetbrains.kotlin.scriptHelper")
+
+ fun getInstance(): ScriptHelper? = EP_NAME.extensions.firstOrNull()
+ }
+}
diff --git a/compiler/tests/compiler-tests.iml b/compiler/tests/compiler-tests.iml
index 035255ef407..4a834f8f64c 100644
--- a/compiler/tests/compiler-tests.iml
+++ b/compiler/tests/compiler-tests.iml
@@ -37,5 +37,6 @@
+
\ No newline at end of file
diff --git a/idea/idea-core/idea-core.iml b/idea/idea-core/idea-core.iml
index cd781279a31..0e237f1916c 100644
--- a/idea/idea-core/idea-core.iml
+++ b/idea/idea-core/idea-core.iml
@@ -17,5 +17,6 @@
+
\ No newline at end of file
diff --git a/idea/idea.iml b/idea/idea.iml
index 6a7fef6a1d6..ab364068060 100644
--- a/idea/idea.iml
+++ b/idea/idea.iml
@@ -64,5 +64,6 @@
+
\ No newline at end of file
diff --git a/idea/src/META-INF/extensions/common.xml b/idea/src/META-INF/extensions/common.xml
index 569e7713a2d..9fd11a78718 100644
--- a/idea/src/META-INF/extensions/common.xml
+++ b/idea/src/META-INF/extensions/common.xml
@@ -43,5 +43,7 @@
interface="org.jetbrains.kotlin.idea.facet.KotlinVersionInfoProvider"/>
+
diff --git a/idea/src/META-INF/extensions/kotlin2jvm.xml b/idea/src/META-INF/extensions/kotlin2jvm.xml
index c1ee2532bac..e03bba00011 100644
--- a/idea/src/META-INF/extensions/kotlin2jvm.xml
+++ b/idea/src/META-INF/extensions/kotlin2jvm.xml
@@ -9,5 +9,7 @@
+
+
diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml
index 41587bccdf6..750227a4d44 100644
--- a/idea/src/META-INF/plugin.xml
+++ b/idea/src/META-INF/plugin.xml
@@ -251,7 +251,7 @@
serviceImplementation="org.jetbrains.kotlin.script.KotlinScriptDefinitionProvider"/>
+ serviceImplementation="org.jetbrains.kotlin.script.KotlinScriptExternalImportsProviderImpl"/>
diff --git a/plugins/plugins-tests/plugins-tests.iml b/plugins/plugins-tests/plugins-tests.iml
index 55abb67c09a..febe57d3853 100755
--- a/plugins/plugins-tests/plugins-tests.iml
+++ b/plugins/plugins-tests/plugins-tests.iml
@@ -40,5 +40,6 @@
+
\ No newline at end of file
diff --git a/ultimate/.idea/libraries/main_project_production.xml b/ultimate/.idea/libraries/main_project_production.xml
index ab42582923f..b92de1e4e63 100644
--- a/ultimate/.idea/libraries/main_project_production.xml
+++ b/ultimate/.idea/libraries/main_project_production.xml
@@ -71,6 +71,7 @@
+
@@ -104,6 +105,7 @@
+
\ No newline at end of file