Commit Graph

120 Commits

Author SHA1 Message Date
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 f8db150a2b [minor] Drop some usages of kotlin reflection in scripting compiler plugin 2019-09-17 12:43:16 +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 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 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 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 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 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
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 b7fd898bb8 Add explicit return types to helpers
also workarounds a problem (KT-30297) with new inference
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 deb74acc88 [minor] fixes after review 2019-05-25 10:10:34 +02:00
Ilya Chernikov 8cd5b11da5 Add evaluation context passing to the evaluation config refiners 2019-05-25 10:10:33 +02:00
Ilya Chernikov 7ae2054cba Add a link to hostConfiguration from compilation and evaluation ones
also add possibility to supply functional defaults for keys in PropertiesCollection
2019-05-25 10:10:31 +02:00
Ilya Chernikov 46915df56f Implement "legacy" REPL wrappers on top of the "new" scripting infrastructure 2019-05-25 10:10:29 +02:00
Ilya Chernikov 89006f16cd Prepare scripting infrastructure for REPL:
- refactor script compiler to simplify extending it for repl
- add repl snippet compilation functions to the new scripting compiler
- extract util functions into appropriate files
- extract repl part into separate class
- extract bridge definition and related definitions into separate file
2019-05-25 10:10:28 +02:00
nikita.movshin abb7d3ab46 Update copyright.
Change the copyright from "JetBrains s.r.o." to
"JetBrains s.r.o. and Kotlin Project contributors"
Update 2 lines comment
2019-04-23 20:09:27 +03:00
nikita.movshin 65244b4bea Update copyright.
Change the copyright from "JetBrains s.r.o." to
"JetBrains s.r.o. and Kotlin Project contributors"
Update only 2 lines copyright.
2019-04-23 20:09:22 +03:00
Ilya Chernikov 67ad3773de Implement main method generation in scripts and runnable jar saving
refactor necessary parts on the way
2019-04-16 11:55:23 +02:00
Ilya Chernikov a6f0bd6677 Refactor jvm evaluation to make module operations cleaner and more robust
in addition:
- hide internal configuration keys
- add keys for flags controlling evaluation
- add initial module implementation for using scripts from a classpath
2019-04-16 11:55:22 +02:00
Ilya Chernikov 90444502a6 Extend evaluation API for easier passing of evaluation configuration
refactor helpers accordingly
2019-04-16 11:55:22 +02:00
Ilya Chernikov fa58b41e43 Implement script evaluation configuration refinement 2019-04-16 11:55:21 +02:00
Vyacheslav Gerasimov 92248d609f Build: Centralize build logic for kotlin-plugin in :prepare:idea-plugin 2019-04-10 17:54:06 +03:00
Ilya Chernikov 931b1c66d8 Fix equality and serializability of scripting data, fix relevant caching behaviour 2019-03-19 17:11:52 +01:00
Vyacheslav Gerasimov a42f607ecf Build: Fix artifacts signing for maven central
With gradle > 5.0 `publish()` helper call should be done before
`noDefaultJar()` or any other artifact hacks, otherwise singing plugin doesn't sign any jars
2019-02-27 13:21:17 +03:00
Vyacheslav Gerasimov f58acbeef5 Build: implement useBootstrapStdlib flag
Excludes stdlib projects from build and uses bootstrap stdlib artifacts

 #KT-29205
2019-01-21 21:09:40 +03:00
Ilya Chernikov c7e5ad861c Allow explicit nulls for props with default, allow null as base classloader for evaluation
and use proper default evaluation configuration if not supplied explicitly;
also add reset method to the properties builder and containsKey method to
the properties collection
#KT-29296 fixed
2019-01-18 18:17:44 +01:00
Ilya Chernikov 4571e273a4 Add shared script instances support, fix and refactor evaluation accordingly
also fix arguments order in the evaluator
2019-01-10 10:59:32 +01:00
Ilya Chernikov 7bb4233e17 Add mapping function for transformations with ResultsWithDiagnostics
also improve chaining helpers
2019-01-10 10:59:32 +01:00
Ilya Chernikov 44ea2bf1d4 Introduce script names and location ids, use them in diagnostics and...
for virtual file names. Also fix compiled script serialization.
2018-12-20 17:09:23 +01:00
Ilya Chernikov 1e74ab5a62 Implement import test, fix import support in compiler and evaluator 2018-12-20 17:09:19 +01:00
Ilya Chernikov fce68102bd Implement imported scripts evaluation and construction 2018-12-20 17:09:18 +01:00
Ilya Chernikov 729ebcac9b Implement simple "add to compilation" functionality for scripts
(incomplete import - scripts added to the compilation but not yet
imported into scope)
Base functionality needed for #KT-27960
2018-12-20 17:09:16 +01:00
Ilya Chernikov 77a4505ec2 [minor] get rid of obsolete "environment" wording 2018-12-13 18:00:12 +01:00
Ilya Chernikov e0a542234f Add script config refinement before compilation into API 2018-12-13 18:00:10 +01:00
Ilya Chernikov 3fe324bbb4 Add UrlScriptSource 2018-12-13 18:00:08 +01:00
Ilya Gorbunov a64a76d5fc Remove experimental coroutines opt-in from build scripts
It has no effect in Kotlin 1.3

Only enable coroutines if '-ReleaseCoroutines' is used
2018-11-09 04:00:26 +03:00