Commit Graph

258 Commits

Author SHA1 Message Date
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
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 c7e9a6c5d9 Add new script dependency resolvers
Changes in new API for dependency resolvers (GenericDependenciesResolver) comparing to an old one (GenericResolver:
- Add ability to fast check whether artifact or repository is suitable for current resolver to distinguish between unsuitable resolvers and resolution failures
- Return all artifact resolution failures in ResultWithDiagnostics
- Use single string for artifact coordinates
- Add compound resolver that combines several resolvers
- Merge Direct and FlatLib resolver into single FileSystemDependencyResolver
- Mark resolve() method as suspend to indicate long operation
- Add credentials support for maven resolver (https://youtrack.jetbrains.com/issue/KT-27701)
2019-11-14 08:38:50 +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
Ilya Chernikov d97e497da0 Remove embeddable tests - they are causing conflicts...
between embeddable compiler contents and intellij sdk modules
To make it work, the dependencies to the intellij sdk should
be eliminated
2019-10-19 11:22:55 +03:00
Ilya Chernikov 08b77bc916 Implement tests to sam-with-receiver support in new scripting API
plus minor tests refactoring
2019-10-19 11:22:55 +03:00
Ilya Chernikov cf3bf5a9b9 [minor] Fix files and jars pattern matching on windows 2019-10-19 11:22:54 +03:00
Nikolay Krasko db913e519f Avoid using specific version because they may differ in different platforms 2019-10-17 11:19:13 +03:00
Yan Zhulanow d31f234311 Pill: Add kotlin-scripting-js module to Pill 2019-10-15 22:06:45 +09:00
Ilya Chernikov d51291b187 [minor] Fix file pattern matching test and converting paths to universal separator on calling the walking function 2019-10-11 17:43:48 +02:00
Ilya Chernikov 9bf46cf435 Fix filename pattern building under Windows 2019-10-11 08:13:05 +02:00
Ilya Chernikov 8b750bfdc7 Add a property for resolving via classloader in JSR-223 2019-10-10 17:43:31 +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 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 c6c3d2de9e [JS SCRIPTING] create tests for repl 2019-10-10 12:52:06 +03:00
Vitaliy.Tikhonov 9b4d92cc07 [JS SCRIPTING] create evaluators for repl and scripting 2019-10-10 12:52:05 +03:00
Vitaliy.Tikhonov d79279d8a5 [JS SCRIPTING] create CoreCompiler for scripting 2019-10-10 12:52:05 +03:00
Ilya Chernikov cb5622fc8b [minor] Fix URL conversion to the file
possibly fixes the exception from https://stackoverflow.com/questions/57727150/kotlin-script-engine-with-spring-boot-self-running-war
2019-10-03 12:24:50 +02:00
Ilya Chernikov 4d19299e95 [minor] Fix scripting classpath test on windows 2019-09-27 19:44:49 +02:00
Ilya Chernikov c53a805696 [minor} Refactor scripting host tests:
- move definitions into one place
- reduce script/repl compilation classpath - spedd-ups tests (~10%)
2019-09-26 07:16:24 +02:00
Ilya Chernikov 256d3a79e4 [minor] refactor and extend script dependencies resolving tests 2019-09-26 07:16:23 +02:00
Ilya Chernikov bda2e46697 [minor] Fix classpath from class calculation utility for classes dir 2019-09-26 07:16:23 +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 dd953e0f66 Deduplicating classloaders and classpath entries on constructing script classloader 2019-09-17 16:05:37 +02:00
Ilya Chernikov 5426071102 Add dependency classloader to the evaluation classloader:
allows to use dependencies from classloader in the scenario with
evaluation in the isolated environment
2019-09-17 12:43:18 +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 a12ea37ae8 [minor] Fix non-fatal exception during the embeddable test 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 92778cc5b5 Set contextClassLoader for the script evaluation
#KT-31661
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
Ilya Chernikov 0fe137d75c Fix script arguments order for imports with implicit receivers
#KT-33572 fixed
2019-09-13 13:19:25 +02:00
Ilya Chernikov c5f9e0a399 Fix host configuration replacements 2019-09-13 13:19:25 +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 947867286c [minor] Fix potential problems with sequence, add a todo 2019-08-28 17:59:12 +02:00
Ilya Chernikov 0f41dc814f Switch many common tasks defined in buildSrc to lazy creation
also refactor some locally defined tasks to the creation avoidance API
2019-08-21 20:20:08 +02:00
Ilya Chernikov 8219d9853c Implement configuration for describing only published runtime dependencies...
and fix runtime dependencies for published scripting artifacts
2019-08-20 21:17:56 +02:00
Ilya Chernikov cddabf140b Implement proper expression generation for the last script line
fixes problem with result fields
#KT-33127 fixed
2019-08-07 11:26:37 +02:00
Yan Zhulanow 086b151e1f Pill: Fix project build, add kotlin-scripting-jvm-host module 2019-08-07 01:15:32 +09:00
Ilya Chernikov aed9b13455 Fix jvm-host-embeddable artefact generation 2019-07-26 16:29:45 +02:00
Ilya Chernikov 333c7ff688 Filter out local classes on JSR-223 properties mapping
fixes e.g. Spring framework usages of the JSR-223 engine
2019-07-26 16:28:56 +02:00
Ilya Chernikov a858607fac Fix script classpath utility functions that use classpath filtering by "keys"
The problem was that only the first matching classpath entry were used.
The problem was reported by @lion7 on github (https://github.com/JetBrains/kotlin/commit/67ad3773de2b12f7e1d29e00151b997a4f6373ba#commitcomment-34443927)
2019-07-26 08:55:16 +02: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 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 e41bbe9328 Introducing transient properties in scripting API 2019-07-26 08:55:16 +02:00