Commit Graph

201 Commits

Author SHA1 Message Date
Aleksei.Cherepanov dc57ccdf76 Clean up default additional compiler argument
Remove `-version` from additional compiler arguments of newly created facets

#KTIJ-22490 Fixed
2022-09-22 09:14:08 +00:00
Alexander Udalov 0569f429dd Report error on -Xuse-old-backend, remove Gradle option useOldBackend
Allow using old JVM backend only to compile kts.

 #KT-48532 Fixed
2022-09-16 00:16:31 +02:00
Alexander Udalov a76de14026 Remove obsolete compiler argument -Xsingle-module
#KT-51622
2022-08-31 20:54:50 +02:00
Nikita Bobko 0a6dadd04d 4/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
2022-08-22 15:43:53 +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
Yaroslav Chernyshev 0efca602a0 Invoke KotlinFacetSettings#updateMergedArguments after deserialization 2022-08-11 17:42:56 +02:00
Nikita Bobko 2c5bd4a065 Drop unused DefaultIdeTargetPlatformKindProvider class
KMA-455

This class was used in intellij but usages was dropped in
a55a62106e40f8545d654d5519576fa4e732d0fd (intellij repo).

DefaultIdeTargetPlatformKindProvider is useless because
`DefaultIdeTargetPlatformKindProvider.defaultPlatform` implementation
always returns `JvmPlatforms.defaultJvmPlatform`
2022-06-29 15:35:57 +02:00
Nikita Bobko 540164a691 Refactoring: Split compilerModulesForJps into "embedded" and "maven"
This small refactoring is needed for the next commit.

This commit doesn't change any semantic.
2022-05-30 17:13:56 +02:00
Nikita Bobko 3569cdda38 JPS plugin: use single source of truth for the classpath
Before this commit `jps/jps-*/build.gradle.kts` list of dependencies
were partially duplicated in the `compilerModulesForJps`

Right now, list of all JPS dependencies is the source of truth.
Actually, I wish I could it do it the other way around -- let the Gradle
do dependency management and correctly produce jars with as less as
possible other libraries being embedded, and as much as poosible
libraries being just dependencies in the pom.xml.

I tried to do so using `embedded` and self-made configurations but
desperately failed, because was getting to big
`kotlin-jps-plugin-classpath` jar. Probably, what I was getting is a
correct classpath, and currently hardcoded classpath may not be
correctly full. Well, at least current classpath is time-proven.
2022-05-30 17:13:56 +02:00
Nikita Bobko 0cb256a999 JPS plugin: Cleanup dependencies
- Some unnecessary dependencies are dropped
- `api` is replaced with `implementation` when it's more appropriate (in
  our case more appropriate everywhere). `implementation` makes it
  easier to analyze dependencies because it doesn't export the
  dependencies
- Regarding: `// Workaround for Gradle dependency resolution error`.
  Actually, it's not longer needed for the successful project import.
  Confirmed by Yahor and tested locally.
2022-05-30 17:13:56 +02:00
Nikita Bobko 74307ad434 JpsUtils.isJps: fix NoClassDefFoundError
This commit fixes:

    Caused by: java.lang.NoClassDefFoundError: com/intellij/openapi/components/ComponentManager
      at java.base/java.lang.ClassLoader.defineClass1(Native Method)
      at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
      at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
      at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:555)
      at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:458)
      at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:452)
      at java.base/java.security.AccessController.doPrivileged(Native Method)
      at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:451)
      at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
      at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
      at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
      at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3166)
      at java.base/java.lang.Class.getMethodsRecursive(Class.java:3307)
      at java.base/java.lang.Class.getMethod0(Class.java:3293)
      at java.base/java.lang.Class.getMethod(Class.java:2106)
      at org.jetbrains.kotlin.config.JpsUtilsKt$isJps$2.invoke(JpsUtils.kt:17)

In c1f2d66ed8 I replaced
`ApplicationManager.getApplication() == null` with
`Class.forName("ApplicationManager").getMethod("getApplication").invoke(null)`.
It turned out that those two are not equivalent.

`getMethod` tries to match queried signatures with existing signatures
=> it tries to load classes in signatures => it tries to load
`com.intellij.openapi.application.Application` (and fails because
`Application` supertype isn't in the classpath).

Contrary, `ApplicationManager.getApplication() == null` doesn't try to
load `com.intellij.openapi.application.Application` class, so it doesn't
fail.

I use MethodHandles API because it forces me to write `Class.forName`
myself (compared to implicit `Class.forName("Application")` inside
`getMethod`) which I find a nice safety feature.
2022-05-04 09:15:17 +00:00
Nikita Bobko c1f2d66ed8 Kotlin JPS plugin: drop intellij-core dependency
Drop dependency because
https://youtrack.jetbrains.com/issue/IDEA-292483/UnsupportedClassVersionError-when-trying-to-run-JUnit5-unit-test#focus=Comments-27-6034750.0-0

IDEA plans to drop `PathUtil` from JPS classpath, we should prepare to
that

`KotlinFacetSettingsProvider` isn't used in jps so it was moved into
intellij repo. It was moved to
`community/plugins/kotlin/idea/src/org/jetbrains/kotlin/config/KotlinFacetSettingsProvider.kt`
path (so you can find it git history)

Review: KT-MR-6195
2022-04-29 14:51:03 +02:00
Simon Ogorodnik 58885a1b07 KT-52217 Rename 'use-fir' to 'use-k2', update message 2022-04-28 15:42:42 +00:00
Aleksei.Cherepanov bdf229bc5c [JPS] Ignore classpath from facets to exclude jars from gradle build
Reimport after `./gradlew build` adds jars from gradle's `build/libs` to facet's classpath. That causes problems with JPS build, because it doesn't see changes in out folder, but see unchanged jar, so changes don't apply.

#KT-51873 Fixed

Merge-request: KT-MR-6018
Merged-by: Aleksei Cherepanov <aleksei.cherepanov@jetbrains.com>
2022-04-18 11:20:40 +00:00
Mikhail Glukhikh 5798320e9e Drop usages of CompilerArguments::useExperimental 2022-01-27 11:48:21 +00:00
Nikita Bobko 47ed6dcfb4 CompilerArgumentsSerializerV5.serializeTo: fix NPE
NPE was happening on `?.takeIf { it.get(arguments) != it.get(newInstance) }` line.
It was happening because `it.get` could return `null`.

But the problem was only reproducible on TeamCity and not reproducible locally.

Test example (IJ repo): `org.jetbrains.kotlin.idea.fir.completion.HighLevelJvmBasicCompletionTestGenerated$Common$FromSmart.testArrayLiteralAnnotationConstructorAsDefaultValueForArray`
stacktrace:
```
java.lang.NullPointerException
  at org.jetbrains.kotlin.arguments.CompilerArgumentsSerializerV5.serializeTo(CompilerArgumentsSerializer.kt:23)
  at org.jetbrains.kotlin.config.FacetSerializationKt.writeLatestConfig(facetSerialization.kt:379)
  at org.jetbrains.kotlin.config.FacetSerializationKt.serializeFacetSettings(facetSerialization.kt:422)
  at org.jetbrains.kotlin.idea.facet.KotlinFacetConfigurationImpl.writeExternal(KotlinFacetConfigurationImpl.kt:24)
```
2022-01-13 10:11:44 +01:00
Mikhail Zarechenskiy 0f0fa4736a [CHERRY PICKED FROM IJ] [kotlin] configuration: allow API version 1.3 with 1.6.x compiler
Starting from 1.6.0 the compiler supports three previous API versions, i.e., 1.3, 1.4, 1.5. Note that it's only about API versions, two previous language versions are supported as previously. See KT-49006 for details.

 ^KTIJ-19978 Fixed

GitOrigin-RevId: e1ba99ac25135959d8b81287850798a222643c88
Original commit: https://github.com/JetBrains/intellij-community/commit/d256c4653ab5aa730e522d282aed49a83f0c99f8
2022-01-12 15:25:21 +01:00
Nikita Bobko a8d7f91252 Temporarily ignore some tests from CompilerArgumentsContentProspectorTest
KT-50594
2022-01-12 15:25:18 +01:00
Nikita Bobko fc9000d460 Adopt Kotlin JPS plugin modules Gradle model to kotlin/master
Recenlty, Kotlin repository started using Gradle 7.1.
Deprecated `compile`/`testCompile` Gradle API were dropped in that release
2022-01-12 15:25:17 +01:00
Nikita Bobko 3b3a7f4566 Add jps-common/test source root 2022-01-12 15:25:13 +01:00
Nikita Bobko 735d46efb4 Freezable.{frozen, unfrozen} refactoring: add type safety 2022-01-12 15:25:10 +01:00
Nikita Bobko 8a289440ce Kotlin JPS plugin: add "version" setting
Part of KTIJ-11633
2022-01-12 15:25:10 +01:00
Nikita Bobko a9cdca40c3 Compilation fixes 2022-01-12 15:25:09 +01:00
Yaroslav.Chernyshev 3556853347 [CHERRY PICKED FROM IJ] [Gradle, Importing] Fix missed optimization
GitOrigin-RevId: 4839fb3bd88b135992a4bd1963b566ed77225b28
Original commit: https://github.com/JetBrains/intellij-community/commit/08fe803d3a03a0a89e67a0b24c41d7494b981a5e
2022-01-12 15:11:05 +01:00
Yaroslav.Chernyshev 6cc7566b2e [CHERRY PICKED FROM IJ] [Gradle, Importing] Attach KotlinGradleSourceSetData nodes to KotlinGradleProjectData instead GradleProjectData
It fixes issues in AS, when GradleProjectData for variants are not created

GitOrigin-RevId: dbd023d0f4fba8b14870aa8952ac0b395a2e4096
Original commit: https://github.com/JetBrains/intellij-community/commit/1c9630cf220df2b380aaf54f28497e41245d8ed6
2022-01-12 15:11:05 +01:00
Nikita Bobko b252897a01 [CHERRY PICKED FROM IJ] [cleanup] Inline VersionView.RELEASED_VERSION
The variable is redundant

GitOrigin-RevId: 99e0e06f8eda6410c41a67b88db50d4d8b5f52ca
Original commit: https://github.com/JetBrains/intellij-community/commit/8b09416812def39f15cdcd7e836129ca6ccc2094
2022-01-12 15:11:02 +01:00
Yaroslav.Chernyshev 93d569d090 [CHERRY PICKED FROM IJ] Fix KotlinFacetSettings serialization issues for compiler arguments
GitOrigin-RevId: 29d3bab972fc797fab7244c16df21763055db0c4
Original commit: https://github.com/JetBrains/intellij-community/commit/4e9f0bfaef343536930276ba27f582a95613d121
2022-01-12 15:11:01 +01:00
Nikita Bobko 779a5c40c0 [CHERRY PICKED FROM IJ] [refactoring] IdePlatformKind: remove unnecessary generic parameter
It seems that it's not used anymore after 82906a0f35ea13673a8a3b3bfaee94a568eff215

GitOrigin-RevId: 229d3b0573873c2da661712f6fce194816436ca7
Original commit: https://github.com/JetBrains/intellij-community/commit/70e4b14a5a37b8d591df2663725fd1d2c6881628
2022-01-12 15:11:00 +01:00
Yaroslav Chernyshev f6d9e53b66 [CHERRY PICKED FROM IJ] [Import] Introduce new version of KotlinFacetSettings, improve serialization of compiler arguments
^KTIJ-13451 Fixed

GitOrigin-RevId: 17ff1ea6c947b7582b445004959c42e54819d31a
Original commit: https://github.com/JetBrains/intellij-community/commit/14bd2509ad37f0c818f6753b097d4c138fba5d89
2022-01-12 15:10:59 +01:00
Vladimir Dolzhenko cb0955a82d [CHERRY PICKED FROM IJ] [kotlin] i18n
GitOrigin-RevId: 0a55f4d8b088328c83e1af233f7f34ffd51e2382
Original commit: https://github.com/JetBrains/intellij-community/commit/3b2e2d8afdaafde31d52eb32cffae9c4aae6704b
2022-01-12 15:10:58 +01:00
sebastian.sellmair 169ecabd2c [CHERRY PICKED FROM IJ] [Kotlin] Support internal visibility provided by associated compilations
^KTIJ-7662 Verification Pending

GitOrigin-RevId: c806293e3b7f2a2baf451fdb6ea8412f19777787
Original commit: https://github.com/JetBrains/intellij-community/commit/94b49d63c2f02876390e01cb9d61c7a4e6d938eb
2022-01-12 15:10:57 +01:00
Dmitry Gridin edb619a004 [CHERRY PICKED FROM IJ] [kotlin] compiler index: fix initialization issues
* move some constants to kotlin.jps-common module
* depends on kotlin.jps-common instead of kotlin.jps-plugin

^KTIJ-16709
^KTIJ-18939 Fixed
^EA-297958 Fixed

GitOrigin-RevId: 305b67aeb75a4c55f734bf2a773b36b0f0e50ac9
Original commit: https://github.com/JetBrains/intellij-community/commit/e7e6e8b26c159b828bbe015a8dc700bc7d88a673
2022-01-12 15:10:56 +01:00
Vladimir Dolzhenko 988d65c82f [CHERRY PICKED FROM IJ] Drop deprecated ServiceManager.getService
GitOrigin-RevId: 6306778c910fcb6c6c63bc38369435c3cd235db5
Original commit: https://github.com/JetBrains/intellij-community/commit/bac13e569558071e720d900add84c6c29b950ac4
2022-01-12 15:10:55 +01:00
Dmitry Gridin 8f6722a1fd [CHERRY PICKED FROM IJ] [jps] cleanup deprecated usages of KotlinFacetSettings.isHmppEnabled
GitOrigin-RevId: 6b20c99f5e96989c47ca3b921bd68916c8e14a89
Original commit: https://github.com/JetBrains/intellij-community/commit/6edf1a0fb3acc036f015c9263c5289f83385e9aa
2022-01-12 15:10:53 +01:00
Vladimir Dolzhenko f701cdcc97 [CHERRY PICKED FROM IJ] Trigger face change event to address facet change save
GitOrigin-RevId: 952c9e6f3270f75d6a293e71d33f958e24ff3c2a
Original commit: https://github.com/JetBrains/intellij-community/commit/18c931145f22fd69826e480bfe596e75ec05bab0
2022-01-12 15:10:52 +01:00
Dmitry Gridin f66b2b2899 [CHERRY PICKED FROM IJ] [jps] convert SettingConstants to Kotlin
GitOrigin-RevId: 664d09dd6abbf39624013cd1009f662efe7f4c0e
Original commit: https://github.com/JetBrains/intellij-community/commit/42811eb72492032ed25dd52cd7aa25511b4bdf90
2022-01-12 15:10:40 +01:00
Dmitry Gridin 2f67e58d64 [CHERRY PICKED FROM IJ] Rename .java to .kt
GitOrigin-RevId: 2d4e1a1b6e31f591b2ef420fe248605da4cdfd5a
Original commit: https://github.com/JetBrains/intellij-community/commit/b328bd7b76f3d73769274fadecf0e58bbe778613
2022-01-12 15:10:39 +01:00
Dmitry Gridin 5141524603 [CHERRY PICKED FROM IJ] [jps] convert KotlinCommonJpsModelSerializerExtension to Kotlin
GitOrigin-RevId: 437f6d66690434a9853d544015d93b17448f8f7c
Original commit: https://github.com/JetBrains/intellij-community/commit/2b8032aafcf561c7d834bb857eb5b3d32eff8317
2022-01-12 15:10:39 +01:00
Dmitry Gridin f62b39f0e4 [CHERRY PICKED FROM IJ] Rename .java to .kt
GitOrigin-RevId: e7d264797023a87cbbea90746bcf2959220bf046
Original commit: https://github.com/JetBrains/intellij-community/commit/f8c480074ada550f0cf4c36373218eee9fb2bfff
2022-01-12 15:10:38 +01:00
Dmitry Gridin f74f613bc1 [CHERRY PICKED FROM IJ] [jps] convert CompilerRunnerConstants to Kotlin
GitOrigin-RevId: 72575637ea72a14f25bdf9b25ae44255a9c40018
Original commit: https://github.com/JetBrains/intellij-community/commit/8ac14f4734d1c6d60f5b3874bacf54224abcf757
2022-01-12 15:10:38 +01:00
Dmitry Gridin f801bce8a9 [CHERRY PICKED FROM IJ] Rename .java to .kt
GitOrigin-RevId: 801635ed9cd9824365ee2b7969c6f822c7e37869
Original commit: https://github.com/JetBrains/intellij-community/commit/5f0b44bd74a8cc346f1536e310d84e3d70d2e73a
2022-01-12 15:10:37 +01:00
Alexander Udalov 8a0eda2ca9 Switch default JVM target to 1.8
#KT-29405 Fixed

(cherry picked from commit d022bb0248)

Original commit: bd4d9491ba28eb87e0c2f347823d419eec100ca9
2021-02-01 11:57:02 +01:00
Dmitriy Novozhilov 4652312c5e [IDE] Propagate KotlinFacetSettings version and completely drop isReleaseCoroutines flag
Also this commit removes number of tests related to support
  experimental coroutines

Original commit: af94bcebea
2021-01-12 16:47:55 +03:00
Dmitriy Novozhilov 377b78d9e6 [CLI] Drop CommonCompilerArguments.coroutinesState
Original commit: e991c9d476
2021-01-12 16:47:54 +03:00
Dmitriy Novozhilov 14d3667a8e [FE] Drop coroutinesState from build configurations plugins
Original commit: df3b12e13b
2021-01-12 16:47:51 +03:00
Dmitriy Novozhilov 19c559ff2f [IDE] Drop coroutines KotlinFacetSettings.coroutineSupport
Original commit: a8b65bc673
2021-01-12 16:47:48 +03:00
Dmitriy Dolovov 3f401214cd HMPP: Avoid NPE during Kotlin facet serialization
^KT-42029

Original commit: f0cbd6b1a5
2020-09-23 10:39:11 +03:00
Dmitriy Novozhilov c62a04d277 Move BuiltinSpecialProperties and JvmAbi to :core:compiler.common.jvm
Original commit: 64ec3fc42b
2020-09-04 11:07:41 +03:00
Nikita Bobko 0344ff9da7 Refactoring: mark const strings with const keyword
Original commit: 4e65b2fb9e
2020-07-01 11:31:23 +03:00
Dmitry Savvinov 62a9ad7218 Check for native-shared source-sets properly during facet import
Otherwise they are detected as common source-sets, thus getting
K2MetadataCompilerArguments (instead of FakeK2NativeCompilerArguments),
and the 'applyCompilerArgumentsToFacets' will fail due to check on
javaClass equality

^KT-39657 Fixed

Original commit: 5b48845dfa
2020-06-19 12:15:50 +03:00