Commit Graph

115 Commits

Author SHA1 Message Date
Ilya Muradyan 94de114894 Support selective filtering of implicits for extensions resolution in REPL 2020-06-19 13:03:23 +02:00
Ilya Chernikov 8fb41e4562 Process compiler plugins and options in scripting compiler
#KT-37766 fixed
2020-06-16 17:11:33 +02:00
Ilya Muradyan c2ede13d5a Fix importing scopes problem for scripting REPL
We don't need to add any importing scopes for a snippet if it doesn't
contain import directives. This fix optimizes performance by reducing
importing scopes count.
2020-06-11 16:16:13 +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 Muradyan 489290263f Add info about the end of range in scripting REPL compiler messages 2020-06-05 21:58:28 +02:00
Ilya Chernikov 5e33612238 Extract interface from CompilerMessageLocation to ease extension
The CompilerMessageLocation is an implicit part of the binary daemon
protocol so changing it breaks compatibility with older daemons.
This change allows to extend location for non-daemon uses without
breaking the binary protocol.
2020-06-05 21:58:27 +02:00
Roman Artemev 5eae262264 [PLUGIN API] Implement custom linkage for plugin extensions 2020-06-03 12:17:14 +03: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 f363134fbc Do not continue compilation if collected dependencies contain error
avoids additional errors reported by compilation, if configuration
refinement returned error
2020-05-21 16:49:56 +02:00
Ilya Chernikov 255ad47406 Use copied key to extract default jdkHome from host configuration 2020-05-21 16:49:55 +02:00
Ilya Chernikov fb6ef38370 Revert "Add info about the end of range in scripting REPL compiler messages"
This reverts commit af251caf, because it breaks daemon/client
compatibility, which we'd like to keep as much as possible
2020-05-15 21:15:48 +02:00
Roman Artemev 31af1e6ca7 [JS SCRIPT] Fix ScriptDependencyCompiler
- Invoke KotlinIrLinker properly
2020-05-14 17:58:33 +03:00
Roman Artemev 3c50b47333 [IR] Add new API into IrBuiltIns to access functional interfaces 2020-05-12 14:29:53 +03:00
Roman Artemev a477aa7289 [KLIB] Pass IrFunctionFactory from outside 2020-05-12 14:29:53 +03:00
Svyatoslav Kuzmich 3d5003d476 [JS_IR] Use new plugin to build Kotlin/JS stdlib with IR compiler
- Switch to building stdlib with bootstrap compiler since IR is stable
  enough
- Build stdlib with coreLibs by default
- Include JS IR stdlib to kotlin distribution
2020-05-08 10:37:48 +03:00
Georgy Bronnikov 9561cc8270 JVM_IR: JvmNameProvider 2020-04-28 18:19:46 +03:00
Georgy Bronnikov 82d55e1a67 Minor: remove unused parameters, reformat code 2020-04-28 18:19:46 +03:00
Ilya Muradyan d2fec96f38 Add new REPL API JVM implementation 2020-04-16 21:16:08 +02:00
Ilya Muradyan b240fce224 Add incompleteCode diagnostic type 2020-04-16 21:16:08 +02:00
Ilya Muradyan af251cafa4 Add info about the end of range in scripting REPL compiler messages 2020-04-16 21:16:08 +02:00
Ilya Chernikov 4ecedf2e3b Get rid of KTUsefulTestCase, improve stability of the tests 2020-04-14 14:15:11 +02:00
Roman Artemev a9788f9506 [KLIB] Create an abstract class for module deserializer
- Introduce Ir-based Functional interface factory
 - Switch from LazyIr to pure
 - Use kotlin library to access raw bytes
 - Link dirty files against IC cache and dependencies instead of LazyIr
 - Move `DescriptorByIdSignatureFinder` from K/N to common
 - Support inline-bodies only MODE
2020-04-14 11:12:08 +03:00
Ilya Chernikov 195a90d333 Cleanup warnings in scripting code 2020-04-13 13:49:34 +02:00
Ilya Chernikov d863dc04e6 Move compiler scripting tests to scripting plugin, remove unused funs
also remove some tests that are covered in the scripting-compiler
tests now.
Part of the cleanup to rewrite scripting to the new infrastructure.
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 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
Georgy Bronnikov 166b506f63 IR: only require all type parameter references to be local with new inference 2020-04-13 14:34:57 +03:00
Pierre-Luc Carmel Biron 352a860e46 Add system classloader as a parent of ReplClassLoader. 2020-04-02 19:22:39 +02:00
Mikhail Glukhikh 26f919df03 Fix some nullable usages of not-null type parameters (KT-36770) 2020-03-18 10:24:26 +03:00
Roman Artemev 31d73c5d79 [Psi2Ir] Move to new linkage scheme based on IdSignature
Now SymbolTable operates with two types of symbols (public and private)
In case of Public symbol IdSignature is used as table key
Private one uses descriptor as the key in similar scheme as before
2020-02-14 18:22:16 +03: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 514282fb0a Use correct platform classloader on script evaluation in cli compiler
#KT-28475 fixed
also minor testing infrastruct refactoring
2020-02-13 11:33:40 +01:00
Georgy Bronnikov 8f4b4007fe JVM_IR: Add test for compiling against cross-platform Klib 2020-01-28 12:19:43 +03:00
Ilya Chernikov dca0a71d9b Add only non-jdk classpath entries from the compiler to script
remove unnecessary manifest classpath entries in the saved compiled
script jar
2020-01-21 17:42:48 +01:00
Ilya Chernikov 75441386e3 Use scripting cache earlier in the pipeline:
before initializing compiler and processing callbacks
2020-01-21 17:42:48 +01:00
Ilya Chernikov c7d9eaed40 Speed up REPL package member declaration provider
about 10-15% on specific test
also preparing test infrastructure for it
2020-01-21 17:42:48 +01:00
Ilya Chernikov cb7cc8ac6b [minor] fix typo in function name 2020-01-21 17:42:48 +01:00
Ilya Chernikov 1b65ec75ad Immplement default cache in main-kts 2020-01-21 17:42:48 +01:00
Ilya Chernikov 891914167a Switch cli expression evaluation argument syntax to -expression/-e
#KT-35414 fixed
2020-01-21 17:42:48 +01:00
Ilya Chernikov d15d62a338 Check REPL snippet syntax before calling analysis
restores the behaviour of the GenericRepl implementation and fixes
issues then invalid code is being compiled
#KT-34888 fixed
2020-01-21 17:42:48 +01:00
Mikhail Zarechenskiy 0fdebdfeba Refactoring: move SamConversionResolverImpl to core module 2020-01-17 19:36:07 +03:00
Mikhail Zarechenskiy c93c82236c Refactoring: move common parts about SAMs to frontend module 2020-01-17 19:36:06 +03:00
Ilya Chernikov 995c6a32b8 Allow only single expression eval in cli compiler and kotlin runner
#KT-35740 fixed
also add tests and drop logger usage in the cli dependencies manager:
the logger is normally unitialized in the usage scenarios, but related
warnings are annoying.
2020-01-09 10:51:25 +01:00
Svyatoslav Kuzmich 31c84e9ac4 [JS IR] Build stdlib using compiler from repo
Previously JS IR versions of stdlib and kotlin-test were build
by default using compiler previously built on a buildserver.

It had some issues:
 - This required us to advance bootstrap every time we made any
   incompatible IR changes. This happens often since IR ABI is
   not quite stable yet.

 - We never tested the exact combination of compiler and stdlib we publish

   We tested:
    - new compiler with new stdlib build by new compiler (in box tests)
    - old compiler with new stdlib build by old compiler (in stdlib tests)

   We published:
    - new compiler with new stdlib build by old compiler

After this change JS IR compiler tests, builds and publishes
single configuration:

    new compiler with new stdlib build by new compiler

JS IR stdlib and kotlin-test are now built using JavaExec of CLI instead
of Gradle plugin to avoid troubles of loading a freshly built plugin.

This also allows to have a granular dependencies: we don't rebuild klib
if we changed a lowering in a compiler backend, but we do rebuild it if
we changed IR serialization algorithm.
2019-12-25 13:44:57 +03:00
Ilya Chernikov 354be2b14f [minor] Change expression evaluation cli argument to -Xexpression 2019-12-11 12:20:49 +01:00
Alexander Udalov fd627603a0 Refactor CompilationErrorHandler
It only had one implementation THROW_EXCEPTION, inline it everywhere
with a call to a static method
2019-12-03 10:48:34 +01:00
Ilya Chernikov 3cae90dd26 [minor] fix source root creation from imported scripts:
make the usages of KotlinSourceRoot consistent everywhere
2019-12-02 16:46:55 +01:00
Ilya Chernikov f2a4a835e7 Improve script cli diagnostics 2019-12-02 16:46:55 +01:00