Rick Fast
01/26/2020, 11:16 PM@KotlinScript
:Rick Fast
01/26/2020, 11:16 PM@KotlinScript
, and am having classpath issues in the consuming moduleRick Fast
01/26/2020, 11:17 PMclass FnScriptDefinition : ScriptCompilationConfiguration({
ide {
acceptedLocations(ScriptAcceptedLocation.Everywhere)
}
jvm {
baseClass(FnScriptTemplate::class)
dependenciesFromClassloader(wholeClasspath = true)
}
defaultImports(FnScriptTemplate::class)
})
Rick Fast
01/26/2020, 11:17 PMRick Fast
01/26/2020, 11:17 PMRick Fast
01/26/2020, 11:18 PM@KotlinScript(
fileExtension = "fn.kts",
compilationConfiguration = FnScriptDefinition::class
)
abstract class FnScriptTemplate
Rick Fast
01/26/2020, 11:18 PMRick Fast
01/26/2020, 11:18 PMFnScriptDefinition
to allow the scripts to use host project's classpath?Rick Fast
01/26/2020, 11:31 PMbuild
directoryilya.chernikov
01/28/2020, 7:07 AMefemoney
01/28/2020, 2:31 PMRick Fast
01/28/2020, 4:12 PMRick Fast
01/28/2020, 4:13 PMilya.chernikov
01/29/2020, 7:34 AMdependenciesFromClassloader
may cause such problems with IDE support, because the context classloader that will be used in IDE is not the one that is supplied from the host.
To make it work properly in IDE and in host, it makes sense to extract classpath creation/collection logic into a function that is called directly from compilation configuration DSL, instead of dependenciesFromClassloader
. You can do it dynamic too by using refineConfiguration
calls. See kotlin-main-kts
as an example.Rick Fast
01/29/2020, 1:49 PM