Add script configuration dependencies to script classpath
It was missing during configuration refinement thought new scripting API and during loading script configuration on Gradle project import Do not pass additional classpath to configuration classpath: this may only affects Gradle with New scripting API (because it isn't used from other places) In additional classpath kotlin-compiler and kotlin-stdlib was passed and there is no needs for this during loading Script Definitions through new scripting API ^KT-34626 Fixed
This commit is contained in:
+17
-16
@@ -1,23 +1,24 @@
|
||||
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.*
|
||||
import kotlin.script.experimental.annotations.KotlinScript
|
||||
import kotlin.script.experimental.api.*
|
||||
|
||||
class TestDependenciesResolver : AsyncDependenciesResolver {
|
||||
override suspend fun resolveAsync(
|
||||
scriptContents: ScriptContents,
|
||||
environment: Environment
|
||||
): DependenciesResolver.ResolveResult {
|
||||
return ScriptDependencies.Empty.asSuccess()
|
||||
@KotlinScript(
|
||||
displayName = "Definition for tests",
|
||||
fileExtension = "kts",
|
||||
compilationConfiguration = TemplateDefinition::class
|
||||
)
|
||||
open class Template(val args: Array<String>)
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
object TemplateDefinition : ScriptCompilationConfiguration(
|
||||
{
|
||||
baseClass(Base::class)
|
||||
ide {
|
||||
acceptedLocations(ScriptAcceptedLocation.Everywhere)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ScriptExpectedLocations([ScriptExpectedLocation.Everywhere])
|
||||
@ScriptTemplateDefinition(TestDependenciesResolver::class, scriptFilePattern = "script.kts")
|
||||
open class Template: Base()
|
||||
)
|
||||
|
||||
open class Base {
|
||||
val i = 3
|
||||
|
||||
Reference in New Issue
Block a user