Commit Graph

504 Commits

Author SHA1 Message Date
Ilya Chernikov d83027720d minor: K2 IC tests: rename incremental FirIC tests for consistency 2023-12-13 13:40:44 +00:00
Ilya Chernikov a295a34d77 K2 IC tests: reenable incremental tests with PSI
#KT-64228 fixed
2023-12-13 13:40:44 +00:00
Ilya Chernikov ed820d6b57 K2 IC: fix lookup recording for a "red" companion object
#KT-63665 fixed
2023-12-13 13:40:44 +00:00
Ilya Chernikov 6dfcc927f4 IC tests: make exceptions from compiler more visible in tests
otherwise they are easily swallowed by the reporting logic.
This commit was needed to ensure that the problem described in
KT-63665 is reproducible in IC test
But some JS IC logic relies on handling compiler exceptions as a signal
for scope expansions, and the newly introduced exception logging
broke a few tests. To mitigate it, the directive was introduced
to disable exception logging for particular test.
2023-12-13 13:40:44 +00:00
Alexander.Likhachev a19bd2ed2e [Build] Migrate most of the build logic from Project.buildDir usage
It's going to be deprecated in Gradle 8.3

There's currently no way to pass a `org.gradle.api.provider.Provider` to the JavaExec.systemProperty or Test.systemProperty. There's a workaround using `org.gradle.process.CommandLineArgumentProvider`, but I intentionally don't rework these calls as Gradle is going to allow passing providers to configure system properties: https://github.com/gradle/gradle/issues/12247#issuecomment-1568427242
^KTI-1473 In Progress
2023-12-07 18:31:06 +00:00
Ilya Goncharov 08e3cb300a [JS] Migrate tests onto IR compiler with outputDir API instead of outputFile
^KT-61117 fixed
2023-11-29 11:21:56 +00:00
Alexander.Likhachev 06c1bcdc5d [IC] Add filter on files for the CACHE_DIRECTORY_SIZE metric
Without the filter, we were walking both through subdirectories and their files, so some files might be counted twice. Moreover, the behaviour of `File.length` is unspecified for directories.
^KT-63010 In Progress
2023-11-28 15:22:43 +00:00
Alexander.Likhachev 4eccbd75c3 [IC] Measure IC size metrics after the caches are closed
Before this fix, the size metrics were measured after the compilation is finished, but before the caches are closed. In many cases it might lead to incorrect measurements. After flipping the default value of the `keepIncrementalCompilationCachesInMemory` flag for Gradle builds, it started to cause always incorrect results.
^KT-63010 In Progress
2023-11-28 15:22:43 +00:00
Pavel Kunyavskiy 021a00f4ff [IR] Avoid depending from fir2ir on ir.actualization module
^KT-62292
2023-11-20 08:31:41 +00:00
Hung Nguyen 5562c95155 [IC] Refactor IC maps to reuse code and ensure consistency - Part 2
In commit 4e89dcf, we have prepared the API for IC maps in top
interfaces and provide the implementation in abstract classes.

In this commit, we refactor IC maps so that they directly inherit/reuse
the implementation from the superclasses without having to reimplement
the APIs for a map.

Test: Existing tests (refactoring change)
^KT-63456: In progress

Authored-by: Hung Nguyen <hungnv@google.com>

Merge-request: KOTLIN-MR-801
Merged-by: Evgenii Mazhukin <evgenii.mazhukin@jetbrains.com>
2023-11-15 12:22:40 +00:00
Evgenii Mazhukin 26bac388e8 [IC] Drop useK2 from compiler/incremental-compilation-impl tests
Merge-request: KT-MR-12879
Merged-by: Evgenii Mazhukin <evgenii.mazhukin@jetbrains.com>
2023-11-08 15:49:37 +00:00
Evgenii Mazhukin 20af98c776 [Tests] Re-enable K1 IC tests for expect-actual
^KT-60831 fixed
^KT-60831 next step KT-63183


Merge-request: KT-MR-12855
Merged-by: Evgenii Mazhukin <evgenii.mazhukin@jetbrains.com>
2023-11-06 19:46:43 +00:00
Alexander Udalov 4fca52b66c FIR entrypoint: deduplicate some code and remove JVM dependency
Deduplicate Fir2IrExtensions creation and move the
convertToIrAndActualizeForJvm function to 'cli', which allows to remove
the dependency of 'fir.entrypoint' on 'backend.jvm'.

Note that behavior slightly changes in IncrementalFirJvmCompilerRunner:
previously the value of linkViaSignatures was always false, now it is
taken from the compiler configuration, which seems more correct.
2023-11-06 08:49:04 +00:00
Kirill Rakhman ef78d4b95a [FIR] Fix deserialization of generic context receivers
We need to pass the local deserialization context so that generic
type parameters can be referenced.

#KT-62607 Fixed
2023-10-27 11:35:22 +00:00
Ivan Kochurkin 1827df82c4 Removed useless as casts from compiler code
It allows compiling code with K2 and enabled `-Werror`
2023-10-24 20:59:56 +00:00
Alexander.Likhachev b460c06907 [BT] Add support for in-process incremental compilation
#KT-61865 Fixed
2023-10-23 13:04:17 +00:00
Alexander Udalov 6219f7fc0d JVM IR: fix detection of enum entries in the same module
Use the new `IrClass.hasEnumEntries` flag added in the previous commit.

 #KT-61208 Fixed
2023-10-16 20:22:20 +00:00
Hung Nguyen 4e89dcf031 [IC] Refactor IC maps to reuse code and ensure consistency
The key changes include:
  - Top interface: `PersistentStorage`
  - Implementation:
      + `LazyStorage`
      + `InMemoryStorage`
  - Extended functionality:
      + `BasicMap`
      + `PersistentStorageAdapter`

 The remaining changes are small cleanups to adapt to the above key
 changes.

 Test: Existing tests (refactoring change)
 Bug: N/A (code cleanup)
2023-10-05 11:12:25 +00:00
Hung Nguyen 0d04b8783c [IC] Handle custom source set located outside project directory
To support build cache relocatability, we need to convert absolute paths
into relative paths before storing them in IC caches.

Before this commit, we computed relative paths based on the (root)
project directory and FAIL if some source files are located outside the
project directory.

With this commit, we will NOT FAIL in that case. This means relative
paths may start with "../". It's not "clean", but it can work.

Test: New test in BuildCacheRelocationIT
^KT-61852 Fixed
2023-09-21 14:39:52 +00:00
Dmitriy Novozhilov 9e5ee3afa0 [FE] Add isLocal name to ClassId constructor calls where it needed 2023-09-21 12:40:44 +00:00
Dmitriy Novozhilov a43cb721ba [FE] Convert ClassId.java to Kotlin 2023-09-21 12:40:43 +00:00
Ilya Chernikov e5ee364419 IC: Implement expect/actual tracking
fixes NewMultiplatformIT.testIncrementalCompilation
also #KT-61590 fixed
2023-09-19 15:46:30 +00:00
Mikhail Glukhikh 2dd9bdb89d Separate incremental JS legacy / standard incremental test fails 2023-09-19 15:46:29 +00:00
Aleksei.Cherepanov 39a0829f39 Fix Maven tests for K2
1) Update test data according to K2 compiler output
2) Finally switch logic of choosing compiler runner depends on language version instead of deprecated useK2 flag

#KT-60859 Fixed
2023-09-19 15:46:27 +00:00
Evgenii Mazhukin 30e49c0879 [IC] Refactoring - Remove obsolete forceExhaustiveWhen util 2023-09-15 12:03:40 +00:00
Alexander Udalov fd68b9f49c CLI: add -Xuse-ir-fake-override-builder
To be able to test IR fake override builder (KT-61514) outside of
compiler tests.
2023-09-13 15:01:52 +02:00
Mikhail Glukhikh b0b6a6a05a K1/K2: deduplicate/simplify the code around JVM CLI
Related to KT-61510, KT-61745
2023-09-08 13:20:47 +00:00
Alexander.Likhachev 53fde520d5 [Build] Add jUnit dependencies in testApiJUnit5 to the implementation configuration
Adding these dependencies to the `api` configuration pollutes classpath for each dependant modules even if it doesn't need them. Instead, the dependencies should be declared more granularly if they're required
#KTI-1349 In Progress
2023-09-06 22:47:34 +00:00
Alexander.Likhachev 357d12fc8e [Build] Move JUnit dependencies into the version catalog
The `kotlin-test` dependencies are left untouched as changing them affects publications, thus these versions are independent from the used inside our build
#KTI-1349 In Progress
2023-09-06 22:47:33 +00:00
Anton Bannykh 387898056a [JS] Report K2 diagnostics before Fir2IR
^KT-60531 fixed
2023-08-31 12:15:08 +00:00
Anton Bannykh c09fa093fc [JS] set LV=1.9 in a K1 IC test 2023-08-24 16:00:54 +00:00
Kirill Rakhman 43180597fe [FIR] Fix generic sam conversion in call completion
#KT-60903 Fixed
2023-08-21 10:35:42 +00:00
Hung Nguyen 894ba9ab80 [IC] Relocatable IC caches for projects with custom buildDir
IC caches often contain file paths. To make them relocatable, we need
to convert these file paths into relative paths, relative to a base
directory.
  - If the file paths are source files, we can use the root project
    directory as base.
  - If the file paths are class files, we should use the classes
    directory as base (before this commit, we used the root project
    directory in both cases, that's why we hit KT-58547).

The key changes in this commit include:
  - RelocatableFileToPathConverter: converts paths to relative paths
  - IncrementalCompilationContext: contains 2 different path converters,
    one for source files and one for class files
  - SourceToOutputFilesMap: maps source files to class files using the
    above path converters
  - IncrementalCompilerRunner: creates the path converters based on file
    locations

Test: RelocatableFileToPathConverterTest unit test
      SourceToOutputFilesMapTest unit test
      BuildCacheRelocationIT.testCustomBuildDirectory integration test
^KT-58547 Fixed
2023-08-16 13:40:19 +00:00
Anton Bannykh 6a886e4c32 [JS] rename IC tests to easier distinguish between the K1/K2 variants 2023-08-11 15:46:51 +00:00
Anton Bannykh 962bfaca9c [JS] Support multimodule IC tests with K2
Includes supporting klib file generation.
2023-08-11 15:46:51 +00:00
Anton Bannykh d78f7bde6a [JS] set LV=1.9 for K1-specific IC tests
Otherwise they will actully run K2 after
the LV=2.0 migration.

^KT-60829 fixed
2023-08-10 22:37:16 +00:00
Ilya Gorbunov 69a87efdd9 js.tests: change paths to kotlin-stdlib-js.klib
Change the expected klib name of stdlib

KT-56106
2023-08-03 14:47:20 +00:00
Alexander.Likhachev 329fd6be45 [BT] Move ClassSnapshotGranularity to the Build Tools API module
#KT-57565 In Progress
2023-08-03 08:55:32 +00:00
Alexander.Likhachev 442d1cf711 [BT] Move ClassSnapshotGranularity to the Build Tools API package 2023-08-03 08:55:32 +00:00
Alexander.Likhachev b3677fa0ca [IC] Allow to not specify the modules info 2023-08-01 16:24:37 +00:00
Alexander.Likhachev e33611a88a [IC] Allow to not specify the build history file 2023-08-01 16:24:37 +00:00
Yan Zhulanow 7d88ade005 [fir2ir] Allow non-cached type parameters
In the IDE, there might come declarations from other files/modules
that we link against, but not compile. Type parameters are one of such
declaration kinds.
2023-07-28 16:05:34 +00:00
Ivan Kylchik 84159596bd [FIR] Pass diagnosticReporter in Fir2IrConfiguration
This parameter will be used to report diagnostics from constant
evaluator, in addition to report diagnostic from actualizer.
2023-07-27 22:50:21 +00:00
Nataliya.Valtman ed2dd4b2ae Split Gradle and JPS metrics
#KT-58026 In progress
2023-07-27 11:18:54 +00:00
Mikhail Glukhikh 66bbb9582c K1/K2: split incremental compilation tests properly (relates to KT-59171) 2023-07-19 09:34:58 +00:00
Ilya Goncharov e7e6fba81f [JS] Fix JS legacy incremental 2023-06-22 12:25:24 +00:00
Hung Nguyen 078356164b IC: Fix regression in detecting constants in KotlinClassInfo.kt
A constant is a static final field with non-null value. In a previous
commit (0b09be7), we accidentally removed the *non-null value*
filter when looking for constants in the bytecode.

This commit re-adds that filter to make sure the detection is correct.

Test: Added KotlinOnlyClasspathChangesComputerTest.testDelegatedProperties

^KT-58986: Fixed
2023-06-16 18:40:01 +00:00
Hung Nguyen ff612f15cf IC: Small cleanup in KotlinClassInfo.kt
This is to address the not-yet-resolved comments in
https://github.com/JetBrains/kotlin/pull/5127, plus a few other small
(non-functional) changes.

^KT-58986: In progress
2023-06-16 18:40:00 +00:00
Ivan Kylchik 0021a5f655 [K2] Save inlined java field into special InlineConstTracker 2023-06-14 19:02:39 +00:00
Alexander Udalov 60016d3e5b Remove obsolete compiler flag -Xuse-ir 2023-05-30 14:46:09 +00:00