Commit Graph

129 Commits

Author SHA1 Message Date
Ilya Chernikov 8fb41e4562 Process compiler plugins and options in scripting compiler
#KT-37766 fixed
2020-06-16 17:11:33 +02:00
Ilya Chernikov dec8eb7899 Revert renaming scripting plugin jar:
it conflicts with the compilation on daemon, so transistion should
be planned accordingly, and now it is not a good time for it.
The most important part of the renaming remains intact.

Partially reverts commit "Rename scripting libs and plugin - invert embeddable suffix"
2020-05-27 13:15:50 +02:00
Ilya Chernikov 2509dfb287 Rename scripting libs and plugin - invert embeddable suffix
now regular, unshaded libs, are named with suffix `-unshaded`, while
former `-embeddable` ones named without any suffix. This will encoursge
use of the shaded libs by default, avoiding conflicts with 3-party
libs packed into the `kotlin-compiler`.
Note, that only the "frontline" libs are renamed to avoid switching
problems, the ones that not normally used directly are left as is,
including the `kotlin-compiler` itself.
2020-05-26 15:58:25 +02:00
Ilya Chernikov 4b032a14af Refactor host configuration handling and script definition creation
so it is possible now to create custom host configuration with template
and all configurations are handled consistenly.
Also introduce and use new ScriptDefinition class wrapping compilation
and evaluation configurations, that could be consistenly created from a
template.
2020-05-21 16:49:55 +02:00
Ilya Chernikov 255ad47406 Use copied key to extract default jdkHome from host configuration 2020-05-21 16:49:55 +02:00
Ilya Muradyan ea1a6fbee7 Add history consistency check 2020-04-22 11:07:32 +02:00
Ilya Muradyan e5ca572b91 Forward diagnostics to the evaluation result 2020-04-22 11:07:32 +02:00
Ilya Muradyan d2fec96f38 Add new REPL API JVM implementation 2020-04-16 21:16:08 +02:00
Ilya Chernikov f84fd810f0 Simplify and fix classloaders handling on script evaluation
#KT-37558 fixed
2020-04-13 13:49:33 +02:00
Ilya Chernikov 138efda19f Refactor scripting - get rid of unused type parameter in CompiledScript 2020-04-13 13:49:33 +02:00
Ilya Chernikov c64ba50655 Abstract script compiled module implementation used in saving/caching
removes classloading problem when main-kts is loaded from a CL
without scripting compiler.
Also relax dependencies collection on saving to a jar and hide redundant
logging.
Running main.kts script via a run configuration works now.
#KT-37765 fixed
2020-04-13 13:49:32 +02:00
Ilya Chernikov 278f77713d Fix default base classloader initialization for scripting hosts
also refactor runner functions
#KT-37823 fixed
2020-04-13 13:49:32 +02:00
Ilya Chernikov b96109f23f Add diagnostic code to the ScriptDiagnostic
to allow checking for specific errors, e.g. incomplete statements in
the REPL
2020-02-13 11:33:40 +01:00
Ilya Chernikov a4752087db Get rid of kotlinx.coroutines usage in saved script runner
to reduce dpendencies for the save dscipt running
2020-01-21 17:42:48 +01:00
Ilya Gorbunov 59482f6827 Do not blank opt in for allowing kotlin package in all subprojects
-Xallow-kotlin-package must be specified explicitly to prevent
unintended declarations in kotlin package.
2019-10-24 16:05:48 +03:00
Ilya Chernikov cf3bf5a9b9 [minor] Fix files and jars pattern matching on windows 2019-10-19 11:22:54 +03:00
Ilya Chernikov d51291b187 [minor] Fix file pattern matching test and converting paths to universal separator on calling the walking function 2019-10-11 17:43:48 +02:00
Ilya Chernikov 9bf46cf435 Fix filename pattern building under Windows 2019-10-11 08:13:05 +02:00
Ilya Chernikov 2219b950f1 Implement resolve top-level functions and props from classloader
#KT-33892 fixed
2019-10-10 17:43:29 +02:00
Vitaliy.Tikhonov d79279d8a5 [JS SCRIPTING] create CoreCompiler for scripting 2019-10-10 12:52:05 +03:00
Ilya Chernikov cb5622fc8b [minor] Fix URL conversion to the file
possibly fixes the exception from https://stackoverflow.com/questions/57727150/kotlin-script-engine-with-spring-boot-self-running-war
2019-10-03 12:24:50 +02:00
Ilya Chernikov 256d3a79e4 [minor] refactor and extend script dependencies resolving tests 2019-09-26 07:16:23 +02:00
Ilya Chernikov bda2e46697 [minor] Fix classpath from class calculation utility for classes dir 2019-09-26 07:16:23 +02:00
Ilya Chernikov dd953e0f66 Deduplicating classloaders and classpath entries on constructing script classloader 2019-09-17 16:05:37 +02:00
Ilya Chernikov 5426071102 Add dependency classloader to the evaluation classloader:
allows to use dependencies from classloader in the scenario with
evaluation in the isolated environment
2019-09-17 12:43:18 +02:00
Ilya Chernikov 61d517fb31 Implement script dependencies resolution directly from classloader
#KT-27956 fixed
2019-09-17 12:43:18 +02:00
Ilya Chernikov 92778cc5b5 Set contextClassLoader for the script evaluation
#KT-31661
2019-09-13 13:19:26 +02:00
Ilya Chernikov 0fe137d75c Fix script arguments order for imports with implicit receivers
#KT-33572 fixed
2019-09-13 13:19:25 +02:00
Ilya Chernikov c5f9e0a399 Fix host configuration replacements 2019-09-13 13:19:25 +02:00
Ilya Chernikov 947867286c [minor] Fix potential problems with sequence, add a todo 2019-08-28 17:59:12 +02:00
Ilya Chernikov a858607fac Fix script classpath utility functions that use classpath filtering by "keys"
The problem was that only the first matching classpath entry were used.
The problem was reported by @lion7 on github (https://github.com/JetBrains/kotlin/commit/67ad3773de2b12f7e1d29e00151b997a4f6373ba#commitcomment-34443927)
2019-07-26 08:55:16 +02:00
Ilya Chernikov ec3ccf1ba8 Properly handle REPL snippets with exceptions ...
so the REPL remain operational after exception in one of the snippets:
- separately return script class and script instance on evaluation (
  because in case of an exception the class is valid, while the instance
  is not).
- store both the class and the instance in the history
- handle this data accordingly
2019-07-26 08:55:16 +02:00
Ilya Chernikov 2a5c4a2409 Move caching to after all configuration refinements and ...
move compilation cache setting to the scripting host configuration
The cache implementation can now take into account all external
dependencies that may appear during refinement.
Also change initial refinement location accordingly and rearrange
caching interfaces to make it available in scripting plugin.
2019-07-26 08:55:16 +02:00
Ilya Chernikov e41bbe9328 Introducing transient properties in scripting API 2019-07-26 08:55:16 +02:00
Ilya Chernikov 0af52f2fa6 Implement composable refinement handlers...
for compilation and evaluation configurations.
Add utilities to apply refinements uniformly.
Also fix one invoke for list values - it was not consistent with
other builders
2019-07-26 08:55:14 +02:00
Ilya Chernikov c9a4328feb Fix compiled scripts saving tests:
The tests were broken some time ago by applying script isolation, so
it was necessary to add base libraries into the classpath.
Also refactored some classpath building utilities.
2019-07-11 15:50:26 +02:00
Ilya Chernikov 9ae0ff03fa Improve script and REPL result handling:
- implement error result
- refactor other result classes
- implement handling in the script evaluation extension - also restores
  previous script error reporting functionality
- add possibility to customize result fileds in script and REPL
- refactor result calculation in the backend: cleanup, rename (since
  it is not only about REPL now)
2019-07-11 15:50:26 +02:00
Ilya Chernikov a96a938f87 Fix creating of the script definition from legacy template
adding classpath needed to load template and related class to the
appropriate host configuration
fixes tests
2019-07-08 13:20:06 +02:00
Ilya Chernikov cfceeb1e8c Implement direct bindings to script properties mapping in the JSR-223 implementation
fix infrastructure and codegen parts
2019-07-05 17:02:10 +02:00
Vyacheslav Gerasimov db3b01d2d4 Build: Centralize compiler dist build logic in :kotlin-compiler project 2019-06-27 17:56:48 +03:00
Ilya Chernikov e542c9ea84 Refactor script definitions and resolving/refining infrastructure:
- implement wrappers to wrap old and new API providers and resolvers
- make old API deprecated (with error where possible)
- drop old internal classes related to the old API
- refactor usages accordingly
- fix and add missing features to the scripting API where necessary
2019-06-06 17:21:00 +02:00
Ilya Chernikov e5054f9648 Refactoring scripting infrastructure:
- add a helper for new constructing Compilation Configuration only when necessary
- add more converters for legacy diagnostics
- add helpers for simpler creating of failure results
2019-06-06 17:21:00 +02:00
Ilya Chernikov 4fb2f81134 Refactor scripting - prepare utilities for refactoring of the script definitions handling 2019-06-06 17:20:59 +02:00
Ilya Chernikov 0a6ade88cc Fix classpath detection from classloader resources 2019-06-03 13:57:20 +02:00
Ilya Chernikov f986856d03 Improve classpath extraction from classloader:
- implement opt-in unpacking/caching of the jar collection archives,
  such as spring boot fat jars and WARs, to the temp dir, and creating
  a valid classpath from extracted archive
- turning it on for the new default jsr223 engine
- fallback to extracting classpath from resource URLs if the classloader
  is not known url-based one
- refactor and optimize extraction
- cache the last retrieved classpath in the default JSR-223 script engine
  factory
2019-05-31 14:06:25 +02:00
Ilya Chernikov e7c99cd494 Fix scripting-compiler tests, add them to the global scriptingTest task 2019-05-25 10:10:34 +02:00
Ilya Chernikov 59dc546a54 Convert JvmGetScriptingClass to object to simplify (de)serialization 2019-05-25 10:10:31 +02:00
Ilya Chernikov 8c7460451e [minor] fix some warnings 2019-05-25 10:10:30 +02:00
Ilya Chernikov 46915df56f Implement "legacy" REPL wrappers on top of the "new" scripting infrastructure 2019-05-25 10:10:29 +02:00
Dmitry Gridin 37c856290f Fix minor compile warnings 2019-04-25 19:47:39 +07:00