Commit Graph

73 Commits

Author SHA1 Message Date
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
Ilya Chernikov
531ff92791 Implement support for expression evaluation in jvm cli compiler 2019-12-02 16:46:54 +01:00
Ilya Chernikov
b8034567ef Change script definition lookup key from File to ScriptSource
to make it more generic and allow easier implementation fo the
non-file based scripts.
2019-12-02 16:46:54 +01:00
Ilya Chernikov
4439582d23 Remove unnecessary update of the source roots, simplify interface accordingly
The update became unnecessary after the packagePartProvider fix above.
2019-12-02 16:46:53 +01:00
Ilya Chernikov
a190ab260e Load main-kts jar automatically from scripting plugin, if available 2019-12-02 16:46:52 +01:00
Georgy Bronnikov
1ed23d7c54 IR: reorganize IrProvider handling
Make DeclarationStubGenerator a subclass of IrProvider,
anticipating deserialization of IR structures for JVM_IR backend.
2019-11-27 20:02:27 +03:00
Alexander Udalov
608449f41d IR: introduce StubGeneratorExtensions for ExternalDependenciesGenerator
This is a refactoring to simplify the API of
ExternalDependenciesGenerator and to constrain future additions of
platform-specific stub generator extensions.
2019-11-20 15:16:57 +01:00
Anatoly Nikitin
81e2e119e2 Fix propagation of dependency resolution failure reports during script compilation 2019-11-14 08:38:50 +01:00
Jordan Demeulenaere
158f7f1cd7 Avoid PsiFile searching when resolving imported scripts descriptors. 2019-10-18 13:17:28 +03:00
Ilya Chernikov
1f46e60153 Implement samWithReceiver support for scripts when ...
it configured from script compilation configuration
#KT-34294 fixed
2019-10-11 17:43:50 +02:00
Ilya Chernikov
2568804eaa Instruct platform code to use NIO2 always
since we're not always use jna (means that we can get warnings about missing jna libs)
and according to the IDEA team, NIO2 works well enough to rely on it
2019-10-11 17:43:49 +02:00
Ilya Chernikov
54caf4bf16 Add resolving from classloader to REPL pipeline 2019-10-10 17:43:30 +02:00
Ilya Chernikov
2219b950f1 Implement resolve top-level functions and props from classloader
#KT-33892 fixed
2019-10-10 17:43:29 +02:00
Roman Artemev
6f2768e774 [JS SCRIPT] Use new dependency resolver in script/js subsytem 2019-10-10 12:52:06 +03:00
Roman Artemev
c0f279811e [JS SCRIPT] refactor js script infrastructure
- Implement proper script compiler proxy to correctly handle script and its closed-world dependencies
 - Clean up zoo of JsScriptCompilers
2019-10-10 12:52:06 +03:00
Vitaliy.Tikhonov
f59e393e37 [CLI] add support running scripts in js compiler, extract common code with jvm part 2019-10-10 12:52:06 +03:00
Vitaliy.Tikhonov
50c08b25d3 [SCRIPTING] create extension for scripting in JS and extract common code with JVM part 2019-10-10 12:52:06 +03:00
Vitaliy.Tikhonov
62885ba497 [JS SCRIPTING] create compilers for scripting 2019-10-10 12:52:06 +03:00
Vitaliy.Tikhonov
d79279d8a5 [JS SCRIPTING] create CoreCompiler for scripting 2019-10-10 12:52:05 +03:00
Ilya Chernikov
b8258bfc71 Drop TestCaseWithTempDir usage from scripting compiler plugin tests
fighting with flaky tests
2019-10-03 12:24:50 +02:00
Ilya Chernikov
3fec15202f [minor] fix source root creation from imported scripts:
make the usages of KotlinSourceRoot consistent everywhere
2019-10-03 12:24:50 +02:00
Ilya Chernikov
0a1aff4f80 Do not add updated script classpath to the compilation configuration
it is added via the updateClasspath call with proper duplicates control
2019-09-26 07:16:24 +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
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
b2d2ba5811 Refactor test utils: don't add main-kts to the classpath...
by default on running scripting tests via the call to K2JVMCompiler
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
939d76fd2a Isolate script execution from compiler classloader
Since fix of KT-33554, the script execution classpath is set correctly
according to the compilation classpath, so isolation makes sense now.
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
Natalia Selezneva
961e8c2c74 Refactor the mechanism how script configurations are updated
Introduce file attributes cache, which is only applicable when no dependencies are cached in memory cache
Refactor ScriptDependenciesCache to memory cache that is able to get configuration from cache and checks if it is up to date
Move all public methods to ScriptDependenciesManager
Introduce ScriptClassRootsManager that checks if root change event should be called after script configuration update
2019-09-06 10:52:17 +03:00
Natalia Selezneva
dc46f73ecf Rewrite scripting related API to PsiFile instead of VirtualFile
There were several places where we converted virtualFile to PsiFile. This operation need a read access and may throw ProcessCanceledException,
so we want to minimize its usages in IDE
2019-09-06 10:51:26 +03:00
Ilya Chernikov
fda37eaaae [minor] Rearrange test utils for easier reuse 2019-08-28 17:59:12 +02:00
Ilya Chernikov
947867286c [minor] Fix potential problems with sequence, add a todo 2019-08-28 17:59:12 +02:00
Ilya Chernikov
c9b25cad01 Fix classpath handling when evaluating legacy scripts from kotlinc
#KT-33554 fixed
2019-08-28 17:59:12 +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
5ed6573a60 Fix testLazyScriptDefinitionProvider:
The KtUsefulTestCase functionality is not used here but seems causes
the side effects resulting in failing test, probably exactly because
the infrastructure loaded by the KtUsefulTestCase is never called
2019-07-19 16:37:50 +02:00
Ilya Chernikov
10e19bccb1 Abort script evaluation if environment is created with errors
also fixes appropriate test
2019-07-11 15:50:26 +02:00
Ilya Chernikov
9c004c3a52 Refactor scripting compiler plugin - move cli dependent parts out of the -impl jar
The kotlin-scripting-compiler-impl jar is used in the idea plugin and
therefore should not depend on the cli parts of the compiler to avoid
dependency from the plugin to the kotlin-compiler.jar.
Therefore the cli-dependent parts were moved to the scripting plugin
jar, which is used only in cli compiler based environments.
Also implement required abstractions to allow this movement and
drop some redundant dependencies to the cli parts in other projects.
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
e4d0c2cb0e Scripts: switch ScriptReportSink to new scripting API
Use ScriptDiagnostic instead of ScripReport
2019-07-10 10:10:21 +03:00
Natalia Selezneva
fbe965be9d Scripts: pass File finding script definition instead of File.name 2019-07-10 10:08:19 +03:00
Vyacheslav Gerasimov
db3b01d2d4 Build: Centralize compiler dist build logic in :kotlin-compiler project 2019-06-27 17:56:48 +03:00