Commit Graph

281 Commits

Author SHA1 Message Date
Dmitriy Novozhilov 1a8496757e [Compiler] Mark all entrypoints to compiler API as experimental 2022-06-29 12:00:01 +00:00
Dmitriy Novozhilov 65e240679e [FE] Move utility of parsing plugin options to :compiler:frontend.common
This is needed to be able to use this utility inside FIR part of IDE plugin
2022-06-29 12:00:00 +00:00
Dmitriy Novozhilov c979e1edcf [Plugins] Deprecate ComponentRegistrar
^KT-52665 In Progress
2022-06-29 11:59:58 +00:00
Dmitriy Novozhilov 8b42638afa [Plugins] Introduce new API for registering compiler plugins
Original `ComponentRegistrar` exposes Project to its registration method,
  so plugins should manually register extensions to it. To prepare for
  possible unbound compiler from Project API in future new  `K2ComponentRegistrar`
  introduced which provides registration method without Project at all
2022-06-29 11:59:58 +00:00
Ilya Chernikov fc5f56adc5 Scripting: restore REPL script definition
incorrectly set to default definition on switching REPL to the new infra
2022-06-28 16:21:25 +02:00
Ilya Chernikov 6e59c2e079 Scripting: fix CLI REPL error reporting behavior
discrepancy after switching to the new REPL internals was
discovered also on IJ plugin tests, so added a test emulating it.
also some test infra refactoring
2022-06-28 16:21:25 +02:00
Ilya Chernikov 8bc43917ec Scripting: switch default definition to new scheme
also correctly pass externaly provided configuration on compilation
and evaluation.
Fixes REPL evaluation with dependencies passed via compilation classpath.
2022-06-28 16:21:24 +02:00
Mikhael Bogdanov 41d6f0dca4 Remove ir.tree.impl from build 2022-06-20 11:42:52 +00:00
Ilya Chernikov c2316ca305 Scripting: avoid definitions discovery when compiling regular kotlin
If only regular kotlin .kt (and .java) files are compiled, do not
register file extensions that may come from discovered script
definitions. Since the discovery is lazy by itself, this should
skip jars processing for regular compilation scenarios without scripts.
#KT-47816 fixed
2022-06-16 21:28:07 +00:00
Ilya Chernikov 5caf2a2aca Scripting: refactor plugin command line processing
- process command line properly when plugin is autoloaded
- add and fix options to disable definitions autoloading and discovery
- cleanup unused code
(partial test is added to "avoid definitions discovery" commit)
2022-06-16 21:28:07 +00:00
Ilya Chernikov a8c4ea04c8 Scripting: add check for 'kotlin' package similar to the regular sources
#KT-52598 fixed
2022-06-16 21:28:06 +00:00
Ilya Chernikov f5950ac8f3 minor: avoid double reporting of scripting diagnostics
also fix arror reporting for scripts with location
2022-06-16 21:28:06 +00:00
Ilya Chernikov 855059b93c Scripting: update scripts in source roots handling
#KT-52525 fixed
related to #KT-52735
2022-06-16 21:28:06 +00:00
Ilya Chernikov b2b13a0247 minor: remove unused class 2022-06-16 21:28:05 +00:00
Ilya Chernikov 120ecce753 Scripting: refactor processing of JvmDependencyFromClassLoader in repl 2022-06-16 21:28:04 +00:00
Ilya Chernikov 597677dae3 Scripting: refactor history handling in legacy REPL using new infra
#KT-47187 fixed
2022-06-16 21:28:03 +00:00
Ilya Chernikov 92bf260057 Scripting: Implement conditional conversion for REPL result values
to support value types erased from runtime classes. See example
in added tests for motivation.
#KT-45065 fixed
also refactor launcher repl test and result type rendering
2022-06-16 21:28:03 +00:00
Ilya Chernikov b36d1be5f8 Scripting: switch legacy CLI REPL to the new infrastructure 2022-06-16 21:28:02 +00:00
Dmitriy Novozhilov a30216c655 [IR] Mark methods with descriptors of ReferenceSymbolTable with @ObsoleteDescriptorBasedAPI
Also remove optIn annotation from IrPluginContext.symbolTable
2022-06-16 13:43:49 +00:00
Dmitriy Novozhilov 4003ca0691 [FE] Add ability to set compatibility of plugin with K2 in ComponentRegistrar 2022-06-07 14:12:14 +00:00
Nikita Bobko 69cf454747 Drop org.jline and org.fusesource.jansi redundant dependencies
Reasons:
1. Those modules don't use this dependency
2. Unbundled JPS feature in IDE downloads all transitive dependencies of
   kotlin-dist-for-jps-meta => downloads org.jline and puts it into dist
   which is not needed
2022-05-30 17:09:28 +02:00
Ilya Muradyan 00819c421f [REPL] Report script codegen errors in advance 2022-05-18 10:02:58 +03:00
Simon Ogorodnik 58885a1b07 KT-52217 Rename 'use-fir' to 'use-k2', update message 2022-04-28 15:42:42 +00:00
Ilya Chernikov af933b9d3d Switch to FastJarFS for scripting
#KT-51731 fixed
2022-04-20 19:15:12 +00:00
Ilya Chernikov 2044754628 Backend: remove psi files from generation state
pass them explicitly to all destinations. This is a step in attempt to
abstract dependencies on PSI in the GenerationState and related places.
2022-03-30 08:33:59 +00:00
Ilya Chernikov da41fddabb Backend: remove codegen factory from generation state
use it explicitly. This is a step in attempt to abstract dependencies
on PSI in the GenerationState and related places.
2022-03-30 08:33:51 +00:00
Ilya Chernikov f89765eb33 Make JDK classpath roots configuration explicit...
instead of relying on the "configuration files" parameter.
(in the process of migration from KotlinCoreEnvironment).
2022-03-30 08:32:56 +00:00
Ilya Chernikov 9d2cadc908 [minor] scripting fixes in obsolete and test code...
relax acceptedAnnotations extraction rules for obsolete script template
handling code - the previous variant was failing on the typealias
comparison

also reduce warnings and possible exceptions on some test execution
paths
2022-03-30 08:32:48 +00:00
Dmitriy Novozhilov faba9c4272 [CLI] Don't register classpath roots twice
There are two ways how content roots are registered in compiler configuration
  in JVM CLI compiler:
1. Directly from arguments
2. From Module, which build from arguments

And there was a problem that both ways used at the same time in some
  circumstances (regular compilation without .xml module file) which
  caused duplication of all content roots.

Ideal solution for this problem is removal of Module usages at all,
  because it looks like redundant abstraction which just complicate
  things, but it's too scary to remove it, because it hove some none
  trivial usages inside compiler. So to fix problem with duplicated
  roots this commit just removes registration of roots from arguments
  if Module is used
2022-02-23 19:33:51 +03:00
Dmitriy Novozhilov aab66bd623 [FIR] Support rendering diagnostic names in CLI FIR compiler 2022-01-28 16:12:12 +03:00
Dmitriy Novozhilov dd953908df [FE 1.0] Add compiler flag for rendering internal diagnostic names in error messages 2022-01-23 11:14:56 +03:00
Stanislav Erokhin 61526c9700 Move AbstractJsScriptlikeCodeAnalyser to the kotlin-scripting-compiler-js module 2021-12-23 20:10:19 +03:00
Roman Artemev e17f121b23 [JS REPL] Extract JS script/repl parts into separate module
- don't load js evaluation plugin in CLI compiler
2021-12-21 04:15:11 +03:00
Vyacheslav Gerasimov f7a9065b75 Build: Use intellij maven repo instead of downloaded IDEA
#KTI-82
2021-12-16 21:48:23 +03:00
Vyacheslav Gerasimov bc2f0936bd Build: Rename commonDep -> commonDependency 2021-12-16 21:48:19 +03:00
Ilya Chernikov 1450f4d890 Implement property for explicit jvmTarget for script definition...
Apply the property to the default JSR-223 script taking the value from
java.specification.version property, so effectively implementing
jvmTarget detection from current VM.
Also drop enforcing of target 1.8, using common default.
#KT-49329 fixed
#KT-40497 fixed
2021-12-14 13:39:21 +03:00
Ilya Chernikov f0316cde54 [minor] test infrastructure: fix default handling in proc launcher 2021-12-14 13:39:21 +03:00
Ilya Chernikov ec2d6ea5f1 Restore script testing on both backends, fix some tests 2021-12-14 13:39:19 +03:00
Ilya Chernikov 670575696f Remove forced old backend for script compilation, using common default 2021-12-14 13:39:19 +03:00
Ilya Chernikov 6d6de9dd76 Implement tests for script instance capturing in the host tests 2021-12-14 13:39:18 +03:00
Ilya Chernikov 10c5071eda Implement backend error reporting on unsupported script capturing
#KT-30616 fixed
#KT-43995 fixed
#KT-19424 fixed
#KT-49443 fixed
2021-12-14 13:39:17 +03:00
Anastasiya Shadrina 37495bcba0 [FE] Change resolution scheme 2021-12-02 20:23:57 +03:00
Anastasiya Shadrina d923c95671 [FE] Add context receivers to scope 2021-12-02 20:23:22 +03:00
Ilya Muradyan 6917ff7d2a [scripting] Move earlierScripts to the frontend descriptor
^KT-20488 fixed
2021-11-30 09:11:59 +03:00
Mads Ager 6622846bc1 [JVM IR] Do not put destructuring params or underscores in LVT.
Putting them in the local variable table means that the debugger
needs to have special handling for parameters with specific names.
That forces us to generate mangled names for these.

Instead of also implementing the name mangling for FIR, this
change gets rid of the parameters from the LVT instead.
2021-11-02 15:13:14 +03:00
Aleksei.Cherepanov 276fb77155 Fix incremental build after changing Java const used as class property
Report Java static final constant with InlineConstantTracker, used as class property in Kotlin for further registration in JPS

#KT-49177 Fixed
2021-10-20 15:06:19 +03:00
Alexey Subach ca2f37f6eb Add possibility to get location of the script.main.kts file
#KT-48414 fixed
2021-10-11 15:45:57 +02:00
Ilya Muradyan 58831eacca [scripting] Make properties from destructing declarations available with reflection 2021-10-07 18:17:21 +03:00
Vyacheslav Gerasimov ab146bd6d4 Build: Fix deprecated Gradle configurations usages
for migration to Gradle 7+ #KTI-559
2021-09-26 18:28:44 +03:00
Alexander Udalov 5d6ca27c93 JVM IR: introduce CodegenFactory.convertToIr
The steps of psi2ir and JVM backend need to be separated in the API
because in case of cyclic module dependencies (which are allowed in JPS)
psi2ir should be run first on all sources, and then JVM backend on each
module separately. `CodegenFactory.convertToIr` does nothing in the old
backend.

Also, move the ignoreErrors to GenerationState for simplicity.
2021-09-17 17:39:48 +02:00