Commit Graph

238 Commits

Author SHA1 Message Date
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 4d19299e95 [minor] Fix scripting classpath test on windows 2019-09-27 19:44:49 +02:00
Ilya Chernikov c53a805696 [minor} Refactor scripting host tests:
- move definitions into one place
- reduce script/repl compilation classpath - spedd-ups tests (~10%)
2019-09-26 07:16:24 +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 d3b826c71d Improve class name generation for scripts and REPL snippets
- allow to override default name/scheme
- implement host/engine specific names for jsr223 to avoid classloading
  clashes (also fix "eval in eval" test)
2019-09-17 16:05:38 +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 f8db150a2b [minor] Drop some usages of kotlin reflection in scripting compiler plugin 2019-09-17 12:43:16 +02:00
Ilya Chernikov a12ea37ae8 [minor] Fix non-fatal exception during the embeddable test 2019-09-13 13:19:26 +02:00
Ilya Chernikov 45f5c42a53 Add appropriate script extension to the source name, if not provided
#KT-31704 fixed
2019-09-13 13:19:26 +02:00
Ilya Chernikov 92778cc5b5 Set contextClassLoader for the script evaluation
#KT-31661
2019-09-13 13:19:26 +02:00
Ilya Chernikov 771f5c13dd Fix imported script functionality in JSR-223/REPL:
- setup compilation properly to take imported scripts into account
- add compiled imported scripts into generated results
= calculate ScriptLightVirtualFile path as relative - simplifies imported scripts location
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 f350c24846 Implement more general "apply defaults" functionality for host configurations 2019-09-13 13:19:25 +02:00
Sergey Rostov 5b48dcca4f ResultWithDiagnostics: remove unused equals and hashCode
They are overridden by sealed data classes
2019-09-06 09:33:33 +03:00
Ilya Chernikov 947867286c [minor] Fix potential problems with sequence, add a todo 2019-08-28 17:59:12 +02:00
Ilya Chernikov 0f41dc814f Switch many common tasks defined in buildSrc to lazy creation
also refactor some locally defined tasks to the creation avoidance API
2019-08-21 20:20:08 +02:00
Ilya Chernikov 8219d9853c Implement configuration for describing only published runtime dependencies...
and fix runtime dependencies for published scripting artifacts
2019-08-20 21:17:56 +02:00
Ilya Chernikov cddabf140b Implement proper expression generation for the last script line
fixes problem with result fields
#KT-33127 fixed
2019-08-07 11:26:37 +02:00
Yan Zhulanow 086b151e1f Pill: Fix project build, add kotlin-scripting-jvm-host module 2019-08-07 01:15:32 +09:00
Ilya Chernikov aed9b13455 Fix jvm-host-embeddable artefact generation 2019-07-26 16:29:45 +02:00
Ilya Chernikov 333c7ff688 Filter out local classes on JSR-223 properties mapping
fixes e.g. Spring framework usages of the JSR-223 engine
2019-07-26 16:28:56 +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 288fdc0952 Add a handler for providing evaluation context for scripts
use it on refinement.
also some refactoring on context class and around
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 42dde50b6b Implement base zip cache with tests...
plus some relevant fixes and refactorings
2019-07-26 08:55:15 +02:00
Ilya Chernikov c7eb9e9520 Move caching tests into a dedicated class
plus some tests refactorings
2019-07-26 08:55:15 +02:00
Ilya Chernikov cefd4a35c5 Fix and test evaluation of scripts with default configurations 2019-07-26 08:55:15 +02:00
Ilya Chernikov 961607673d [minor] Refactor properties collection builder:
add a helper to replace the value only if it is absent or default
rearrange some functions
2019-07-26 08:55:15 +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 65e6d3b0ff [minor] Add a small diagnostics handling utility fun 2019-07-26 08:55:14 +02:00
Ilya Chernikov b68ab0d968 Add test on repl with implicit receiver 2019-07-26 08:55:14 +02:00
Ilya Chernikov a13d452cd8 Implement JSR223 host in the main-kts jar
also improve diagnostics on configuration instantiation
2019-07-26 08:55:14 +02:00
Ilya Chernikov 0108a76e99 Extract arguments calculation for base JSR223 engine into an argument 2019-07-26 08:55:13 +02:00
Ilya Chernikov e8fa139dc8 Move direct properties configuration code into public functions in scripting host jar 2019-07-26 08:55:13 +02:00
Ilya Chernikov 747c488a78 Fix entries closing on saving compiled script to jar:
also adding a short sleep in tests, otherwise in some cases the
classloader was not able to find class in the jar.
Fixes script to jar saving tests on windows
2019-07-19 16:37:49 +02:00
Ilya Chernikov bd50454a73 Change default for script displayName parameter to empty, generate name from base class in definition 2019-07-12 13:44:09 +03:00
Ilya Chernikov 0cc40440fb Implement filePathPattern in the script configuration with handling
also
- tests
- extending kdoc for the definitions
2019-07-12 13:44:09 +03:00
Ilya Chernikov c08b88281c Remove accidetial usages of the internal jdk classes 2019-07-11 15:50:27 +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 dc4370ff08 Implement support for new script customizations in command line compiler
refactor and fix internals in many places to make it work
add appropriate tests for main-kts case
2019-07-11 15:50:25 +02:00
Natalia Selezneva 923e89db69 Provide toString method for ScriptCompilationConfigurationWrapper
This is needed for debug and logging proposes
2019-07-10 10:10:20 +03: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