Do not store external dependencies in ScriptModuleInfo
There is a cache from ScriptModuleInfo to ScriptDependenciesInfo. In case when only script dependencies are changed we won't recreate the facade for them and will obtain external dependencies for ScriptModuleInfo stored in ScriptDependenciesInfo. So we cannot store external dependencies inside ScriptModuleInfo. The same problem is with relatedModuleSourceInfo.
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
package test
|
||||
|
||||
object KObject {
|
||||
fun foo() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
/*
|
||||
TestDependenciesResolver returns empty dependencies on first request,
|
||||
so ComparasionFailure should fail because 'test' is unresolved
|
||||
Than TestDependenciesResolver returns classpath with classes from 'lib' folder
|
||||
so no errors expected
|
||||
*/
|
||||
test.KObject.foo()
|
||||
@@ -0,0 +1,27 @@
|
||||
package custom.scriptDefinition
|
||||
|
||||
import java.io.File
|
||||
import kotlin.script.dependencies.*
|
||||
import kotlin.script.experimental.dependencies.*
|
||||
import kotlin.script.templates.ScriptTemplateDefinition
|
||||
import kotlin.script.experimental.location.ScriptExpectedLocation
|
||||
import kotlin.script.experimental.location.ScriptExpectedLocations
|
||||
|
||||
var count = 0
|
||||
|
||||
class TestDependenciesResolver : DependenciesResolver {
|
||||
override fun resolve(
|
||||
scriptContents: ScriptContents,
|
||||
environment: Environment
|
||||
): DependenciesResolver.ResolveResult {
|
||||
if (count == 0) {
|
||||
count++
|
||||
return ScriptDependencies.Empty.asSuccess()
|
||||
}
|
||||
return ScriptDependencies(classpath = listOf(environment["lib-classes"] as File)).asSuccess()
|
||||
}
|
||||
}
|
||||
|
||||
@ScriptExpectedLocations([ScriptExpectedLocation.Everywhere])
|
||||
@ScriptTemplateDefinition(TestDependenciesResolver::class, scriptFilePattern = "script.kts")
|
||||
open class Template
|
||||
Reference in New Issue
Block a user