This repository was archived by the owner on Oct 3, 2021. It is now read-only.
File tree 3 files changed +8
-6
lines changed
src/main/kotlin/com/neva/slinkt/script
3 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,6 @@ class KotlinEngine(
54
54
55
55
private fun makeCompilerConfiguration () = CompilerConfiguration ().apply {
56
56
addJvmSdkRoots(PathUtil .getJdkClassesRootsFromCurrentJre())
57
- classLoader
58
57
addJvmClasspathRoots(templateClasspath)
59
58
put(CLIConfigurationKeys .INTELLIJ_PLUGIN_ROOT , System .getProperty(" user.dir" )) // TODO tmp
60
59
add(ComponentRegistrar .PLUGIN_COMPONENT_REGISTRARS , ScriptingCompilerConfigurationComponentRegistrar ())
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ class KotlinScriptEvaluator {
31
31
wholeClasspath = true ,
32
32
classLoader = classLoader
33
33
)
34
- compilerOptions.append(" -Xintellij-plugin-root" , System .getProperty(" user.dir" ))
34
+ compilerOptions.append(" -Xintellij-plugin-root= ${ System .getProperty(" user.dir" )} " )
35
35
}
36
36
compilationOptions()
37
37
}
Original file line number Diff line number Diff line change @@ -18,20 +18,23 @@ import kotlin.script.experimental.host.StringScriptSource
18
18
ServletResolverConstants .SLING_SERVLET_METHODS + " =GET" ,
19
19
]
20
20
)
21
- class SimpleServlet : SlingSafeMethodsServlet () {
21
+ class KotlinScriptServlet : SlingSafeMethodsServlet () {
22
22
23
23
@Reference
24
24
private lateinit var evaluator: KotlinScriptEvaluator
25
25
26
26
override fun doGet (request : SlingHttpServletRequest , response : SlingHttpServletResponse ) {
27
27
val scriptSource = StringScriptSource ("""
28
- println("Hello World!")
29
- "abecadlo!"
28
+ import org.osgi.framework.FrameworkUtil
29
+ FrameworkUtil.getBundle(com.neva.slinkt.script.host.KotlinScriptServlet).symbolicName
30
30
""" .trimIndent())
31
31
32
32
val result = evaluator.eval(scriptSource)
33
33
34
34
response.contentType = " text/plain"
35
- response.writer.write(result.valueOrNull().toString())
35
+ response.writer.apply {
36
+ write(" ${result.valueOrNull().toString()} \n " )
37
+ result.reports.forEach { write(" $it \n " ) }
38
+ }
36
39
}
37
40
}
You can’t perform that action at this time.
0 commit comments