Commit Graph

136 Commits

Author SHA1 Message Date
Ilya Muradyan 6da22414dc [minor] Fix typo in comment 2020-06-11 16:16:12 +02:00
Mathias Quintero 83087291df Add API to get locations of collected script annotations
#KT-38404 fixed

also:
- Add wrapper class for the location combined with the location id
- Add source code location parameters to external dependency resolvers
- Add tests for locations in annotations
- Add tests for order of annotation resolution for dependencies resolvers
2020-06-10 16:28:41 +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 20bbcd5d5a Implement copied key with ability to take default from source config 2020-05-21 16:49:55 +02:00
Ilya Muradyan 8a1b44cc2b Add snippet result type to analysis output of REPL IDE services 2020-05-11 10:45:49 +02:00
Ilya Chernikov c496b93218 [minor] refactor repl API file layout 2020-05-11 10:45:48 +02:00
Ilya Muradyan 4c2c44b106 Add new REPL API 2020-04-16 21:16:08 +02:00
Ilya Muradyan b240fce224 Add incompleteCode diagnostic type 2020-04-16 21:16:08 +02:00
Ilya Chernikov 195a90d333 Cleanup warnings in scripting code 2020-04-13 13:49:34 +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 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
Natalia Selezneva 2f35d6d868 Scripting: save inputs stamp and diagnostics to file attributes
Check if they are up to date and initiate configuration update only in case they are out of date

^KT-35205
2019-12-16 14:55:45 +03:00
Ilya Chernikov b73625ad9e Switch main-kts to the updated resolvers infrastructure 2019-11-25 14:46:32 +01:00
Anatoly Nikitin 81e2e119e2 Fix propagation of dependency resolution failure reports during script compilation 2019-11-14 08:38:50 +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
Vitaliy.Tikhonov 9b4d92cc07 [JS SCRIPTING] create evaluators for repl and scripting 2019-10-10 12:52:05 +03: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 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