Commit Graph

446 Commits

Author SHA1 Message Date
Yahor Berdnikau 0cad069522 [Build] Pin api and language level to 1.8 in Kotlin compiler modules used by KGP
This is required to be able to compile KGP and it's dependencies which
set LV to 1.4 when repo will use LV 1.9. This caused by the change how
enums are compiled (KT-48872).
2023-02-18 13:26:54 +00:00
Ilya Chernikov ea255135a4 Scripting: avoid CME in maven resolving in IDE scenarios
combination of laziness in AetherResolveSession and possibly
async-modifiable repos collection in MavenDependenciesResolver
may lead to the CME.
#KT-54733 fixed
2023-01-15 20:11:56 +01:00
Ilya Chernikov 6c035bb5f4 Scripting: support scripts starting with UTF-8 BOM
#KT-54705 fixed
2023-01-15 20:11:56 +01:00
Ilya Chernikov 400762635a Scripting: update version of maven resolver dependencies 2023-01-15 20:11:56 +01:00
Ilya Chernikov deb2d6d024 K2 Scripting: enable K2 tests in some test projects 2022-12-21 14:34:21 +00:00
Ilya Chernikov 90a4f6002e K2 Scripting: support sam-with-receiver in scripting plugin 2022-12-21 14:34:21 +00:00
Alexander Korepanov d5e9e87538 [JS BE] Drop JS scripting support
JS scripting uses the old IR to JS transformer.
 The new IR to JS transformer can not be used for
 JS scripting out of the box. Patching the new transformer for
 JS scripting is potentially dangerous and requires a lot of effort.
 Dropping JS scripting and the old IR to JS transformer allows to
 refactor and simplify JS BE codebase.
2022-11-04 14:15:15 +00:00
Ilya Chernikov 5d968bc2f4 Fix gradle scripts detection in the sources
#KT-54325 fixed
2022-10-31 09:30:13 +00:00
Artem Kobzar 7b9aed25da [K/JS] Add the ability to turn off polyfills generating 2022-10-19 12:52:23 +00:00
Nikolay Krasko 1630386712 Move to JDK_X_Y variables 2022-09-21 22:53:19 +00:00
Ilya Chernikov 0814c0da57 Fix lowering of receiver access in IR scripting
#KT-53947 fixed
without the fix, in the presence of the implicit receiver of the same
type as the processed receive, the lowering was incorrectly substituting
the correct receiver with the accessor to the implicit one
2022-09-15 22:05:00 +02:00
Mikhael Bogdanov c168a19a58 Build compiler with -Xjvm-default=all + @JvmDefaultCompatibility when needed 2022-09-14 14:40:37 +02:00
Ilya Muradyan 551a481dc5 [Scripting] Add partial transitive resolution to Maven resolver 2022-09-12 14:11:04 +02:00
Nikita Bobko 2a4f3f41aa 2/5 Replace source dependency on kotlin-reflect with binary dependency
Review: https://jetbrains.team/p/kt/reviews/6753

Meaningful semantic change was splitted into 5 commits to simplify the
change review. Sinle commit would be too big.

Why replace source to binary: to get rid of kotlin-reflect in Kotlin
plugin artifact KTIJ-22276

Note: Kotlin Maven artifacts (./gradlew publish) changed their
dependency on kotlin-reflect
2022-08-22 15:43:49 +02:00
Nikita Bobko 0874fb71c6 Replace all kotlin-reflect-api dependencies with kotlin-reflect
Review: https://jetbrains.team/p/kt/reviews/6753

Why: I'm going to replace source dependency on kotlin-reflect with
binary dependency. Normalize reflect dependency before global
processing.
2022-08-22 15:43:11 +02:00
Nikita Bobko 8f79e833a8 Drop all redundant kotlin-reflect, kotlin-reflect-api dependencies
Review: https://jetbrains.team/p/kt/reviews/6753

All redundant I managed to find, of course.

Why: I'm going to process all reflect dependencies in the next commits.
Cleanup reflect dependency before processing.

They are redundant because:
1. if `compileOnly` then compilation didn't break after dropping the
   dependency
2. if `test*` then tests didn't break after dropping the dependency.
3. `analysis/analysis-api-fir/analysis-api-fir-generator/build.gradle.kts`
   `compiler/fir/checkers/checkers-component-generator/build.gradle.kts`
   Drop `implementation(project(":kotlin-reflect-api"))` because the
   module already depends on
   `implementation(project(":kotlin-reflect"))`
4. `compiler/daemon/daemon-client/build.gradle.kts`. Drop `runtimeOnly`
   because after dropping `compileOnly` compilation didn't break (so
   `runtimeOnly` looks suspicious). Less safe than 1-3
2022-08-22 15:42:57 +02:00
Nikita Bobko e3bf7698a9 kotlin-scripting-dependencies-maven: fix reflect dependency
Review: https://jetbrains.team/p/kt/reviews/6753

Use the same reflect dependency as in the rest of the project.

Why: I'm going to process all reflect dependencies in the next commits.
Normalize reflect dependency before processing.

This weird reflect dependency style was introduced in
83087291df. I think it was a simple
mistake.
2022-08-22 15:42:45 +02:00
Vsevolod Tolstopyatov 14b13a2f17 [kotlin.reflect] Introduce ClassValue-based cache for KClassImpl
* Replace pcollections with ClassValue/ConcurrentHashMap-based caches
* Do not store weak references, instead cache strong references and count on ClassValue to unload the corresponding classloader if necessary
* ConcurrentHashMap does not rely on WeakReference as it's only selected on Android where classloader leaks don't exist
* Update reflect/scripting JDK requirement to Java 8 in order to proceed

#KT-53454
#KT-50705


Merge-request: KT-MR-6788
Merged-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
2022-08-05 15:35:34 +00:00
Ilya Chernikov ceea563d63 Scripting: avoid creating multiple PSIs for every imported script
#KT-53009 fixed
#KT-42810 should be possible now too, but more testing is needed
#KT-42101 can also be addressed now, but first the serialization
 of the imported scripts property should be solved
2022-07-21 13:53:41 +00:00
Dmitriy Novozhilov 1a8496757e [Compiler] Mark all entrypoints to compiler API as experimental 2022-06-29 12:00:01 +00:00
Dmitriy Novozhilov c979e1edcf [Plugins] Deprecate ComponentRegistrar
^KT-52665 In Progress
2022-06-29 11:59:58 +00:00
Mikhael Bogdanov 41d6f0dca4 Remove ir.tree.impl from build 2022-06-20 11:42:52 +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 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 9912df0daf minor: remove a warning in scripting tests 2022-06-16 21:28:04 +00:00
Ilya Chernikov da782fbfe8 Scripting: extend JSR-223 compilable with bindings test
proofs that #KT-47191 describes a misuse rather than a bug
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 b36d1be5f8 Scripting: switch legacy CLI REPL to the new infrastructure 2022-06-16 21:28:02 +00:00
Ilya Chernikov 6784cb63aa Scripting: implement support for user-defined execution wrapper 2022-06-16 21:28:02 +00:00
Yahor Berdnikau af6f17c243 Unify kotlinCompilerClasspath for all projects
This will prevent spawning second Kotlin daemon during compilation
except 'buildSrc' compilation. Original change was introduced in
2e515f3945 commit.
2022-05-24 07:58:38 +00:00
Yahor Berdnikau e25778a719 Fix ConcurrentModificationException
This exception is happening on build configuration trying to remove
default jar task artifacts from published one. I've set 'jar' task
to be always disabled instead and just add shadow jar to artifacts.
2022-05-24 07:58:36 +00:00
Ilya Muradyan 00819c421f [REPL] Report script codegen errors in advance 2022-05-18 10:02:58 +03:00
Ilya Muradyan edacd90a6c [Scripting] Take local repository path from settings if it exists 2022-05-16 12:29:25 +00:00
Ilya Muradyan 46563e93ea [Scripting] Allow transitive resolution of non-JAR artifacts
It allows to resolve libraries sources which is crucial for
Kotlin Notebook plugin.
2022-05-16 11:45:47 +00:00
Ilya Muradyan 537ae662d7 [Scripting] Pass exception when constructing ScriptDiagnostic 2022-05-06 13:01:32 +00:00
Ilya Muradyan 0ea9c1fbce [Scripting] Remove obsolete Aether dependencies and add new maven.resolver ones instead
scripting-dependencies-maven actually depended on both maven.resolver
and Aether dependencies, it caused an issue in KScript
(https://github.com/holgerbrandl/kscript/issues/345) and caused some
issues in the past. These problems were partially solved with exclude()
which is now removed.
2022-05-04 10:31:02 +00:00
Ilya Muradyan cfd11f2075 [Scripting] Provide better errors reporting for authentication issues
^KT-50357
2022-05-03 03:42:47 +00:00
Ilya Chernikov 3e19e9d190 Scripting: fix loadDependencies property use with cached scripts
#KT-50902 fixed
2022-04-29 11:03:12 +00:00
Ilya Chernikov f7fb586ee5 Scripting: fix JSR-223 invocable handling of receivers 2022-04-29 11:03:12 +00:00
Ilya Chernikov 49902bb851 IR Scripting: allow to specify nullable types for provided props...
but only explicitly. This does not fix a breaking change described in
#KT-52120, because it seems the correct behavior, but it allows
to "workaround" the problem by specifying nullability explicitly.
Also improve handling of nullable bindings in JSR-223.
#KT-49173 fixed
#KT-51213 fixed
2022-04-29 11:03:11 +00:00
Alexander Udalov 2e515f3945 Prohibit JVM target 1.6
But still compile stdlib, reflect, kotlin.test and scripting runtimes
with JVM target 1.6 to simplify migration from Kotlin 1.6 to 1.7.

 #KT-45165 Fixed
2022-04-19 22:54:40 +02:00
Alexander Udalov ef6d30dd51 Remove usages of JVM target 1.6 from compiler tests
#KT-45165
2022-04-19 22:54:40 +02:00
Alexander Likhachev aa3b653847 [Build] dependencies-maven-all: use ArchiveOperations service
`normalizeComponentsXmlEndings` task was using `zipTree` method of `project`. The `ArchiveOperations` method should be used to work properly with configuration cache.
#KT-44611 In Progress
2022-04-19 00:33:34 +03:00
Ilya Goncharov 002d62de89 rra/ilgonmic/revert-signatures-changes
[JS IR] Fix line number test

[JS IR] Ignore isInstance repl test

[JS IR] Ignore isInstance repl test

[JS IR] Add test with unsafe variance

Revert "[JS IR] Optimize away upcasts"

This reverts commit 8149189585.

Get rid of duplicated signatures

Revert "[JS IR] Consider erasing type parameters in return type in js signatures"

This reverts commit 6adcbe081e.

Revert "rra/ilgonmic/exported-bridges-2 [JS IR] Use js name for signature"

This reverts commit 00289d35

[JS IR] Leave as is

[JS IR] Add test with overloading by generic

[JS IR] Add test from master

[JS IR] Add tests from master

Merge-request: KT-MR-5987
Merged-by: Ilya Goncharov <Ilya.Goncharov@jetbrains.com>

^KT-51700 fixed
^KT-51523 fixed
^KT-51685 fixed
2022-04-05 15:35:12 +00:00
Ilya Chernikov 35f80c04ca IR Scripting: update capturing logic for the REPL, imported scripts,
as well as all other implicit receivers.
2022-04-04 14:55:53 +00:00
Ilya Chernikov 4ec639cafd Scripting: relocate 3-party libs in dependencies-maven-all
#KT-50378 fixes, and will prevent similar cases for now
2022-04-04 14:55:52 +00:00
Egor 6d1fe3a962 Fixing merge of script fragments + UT 2022-02-23 18:58:29 +03:00
Vyacheslav Gerasimov 649f246cef Build: Normalize line separators in components.xml
of kotlin-scripting-dependencies-maven-all jar to produce same binaries
on linux and windows

 #KTI-782
2022-02-14 18:59:06 +03:00
Mikhail Glukhikh ad0d0ca47f Drop redundant Suppress("RemoveExplicitTypeArguments") 2022-01-26 12:19:55 +00: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