562 Commits

Author SHA1 Message Date
nataliya.valtman a34657195b Add GC metric to build statistic 2023-03-14 20:58:45 +00:00
nataliya.valtman c16dabba1f Add Kotlin daemon memory usage into build report
#KT-56211: Fixed
2023-03-14 20:58:45 +00:00
Alexander.Likhachev 8bb0c5135b [IC] Add unit tests for InMemoryStorageWrapper
#KT-56052 Fixed
2023-03-07 16:19:25 +00:00
Alexander.Likhachev 4aedf77431 [IC] Avoid many collection allocations in InMemoryStorageWrapper
#KT-56052 In Progress
2023-03-07 16:19:25 +00:00
Alexander.Likhachev cc16ca2bf8 [IC] Add synchronization to all the DefaultInMemoryStorageWrapper public methods
#KT-56052 In Progress
2023-03-07 16:19:25 +00:00
Alexander.Likhachev 99830d7f28 [IC] Segregate LazyStorage into LazyStorage and AppendableLazyStorage
#KT-56052 In Progress
2023-03-07 16:19:24 +00:00
Alexander.Likhachev ca8d0bd100 [IC] Add unit tests for resetting in-memory caches wrappers in a transaction
#KT-56052 In Progress
2023-03-07 16:19:23 +00:00
Alexander.Likhachev 04a5c7761c [IC] Add unit tests for CachesManager closing in transaction
#KT-56052 In Progress
2023-03-07 16:19:23 +00:00
Alexander.Likhachev 2bff38dd27 [IC] Fix transaction wasn't marked as unsuccessful on execution exception
#KT-56052 In Progress
2023-03-07 16:19:22 +00:00
Alexander.Likhachev 8825cf7bf6 [IC] Fix RecoverableCompilationTransaction wasn't throwing an exception properly
#KT-56052 In Progress
2023-03-07 16:19:22 +00:00
Alexander.Likhachev 83ea1ca3cf [IC] Let CompilationTransaction to reset in-memory changes in IC caches
#KT-56052 In Progress
2023-03-07 16:19:22 +00:00
Alexander.Likhachev 493da2a8b4 [IC] Rename DummyCompilationTransaction -> NonRecoverableCompilationTransaction 2023-03-07 16:19:21 +00:00
Alexander.Likhachev 25a3dcf3d1 [IC] Make CompilationTransaction to be able to close CachesManager 2023-03-07 16:19:21 +00:00
Alexander.Likhachev 3ed651a7a6 [Gradle] Add a property to control if the IC caches in-memory wrapper is enabled
#KT-56052 In Progress
2023-03-07 16:19:20 +00:00
Alexander.Likhachev e7e5a3488b [IC] Introduce a wrapper for IC caches storage to keep changes in-memory
#KT-56052 In Progress
2023-03-07 16:19:20 +00:00
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
Aleksei.Cherepanov a0fa438735 Revert "FIR IC: fix test with behavior different from non-tight cycle variants"
This reverts commit c4a29651 as it is no longer needed after IC fix: `5ba3053e` "[IC] Do not report recompilation of non-existing files", because now fix-ic-build.log duplicates the main build.log

#KT-54991 In Progress
2023-01-30 13:45:38 +00:00
Roman Efremov 14b4cdc7c4 Write "hasEnumEntries" flag into metadata when feature enabled
^KT-53929 Fixed
2023-01-23 12:53:04 +01:00
Roman Efremov 3c5e556ba6 Add "hasEnumEntries" flag to class metadata
With this flag we can distinguish enum classes that have `entries`
property in the compiled bytecode (see `LanguageFeature.EnumEntries`).
This is needed to be able to understand in the frontend whether
`entries` can be called for that class. For Native and JS, this is
currently not possible even if the feature is enabled, but the class
was compiled with disabled feature.

^KT-53929 Fixed
2023-01-23 12:50:14 +01:00
Alexander.Likhachev 3dcf5af4b0 [IC] Add methods to write without explicit registering in a transaction
#KT-49785 In Progress
2023-01-17 22:15:57 +00:00
Alexander.Likhachev 581bc89849 [IC] Introduce ICContext to simplify configuration propagation to caches
#KT-49785 In Progress
2023-01-17 22:15:56 +00:00
Alexander.Likhachev 7171c2531c [IC] Apply IDEA suggestions to IC caches code 2023-01-17 22:15:56 +00:00
Alexander Likhachev 40a901caa1 [IC] Add unit tests for TransactionOutputsRegistrar
#KT-49785 In Progress
2023-01-17 22:15:55 +00:00
Alexander Likhachev 1f2eb4c9fe [IC] Add unit tests for CompilationTransaction
#KT-49785 In Progress
2023-01-17 22:15:54 +00:00
Alexander Likhachev d0c049cc00 [IC] Setup JUnit5 tests for :kotlin-build-common
#KT-49785 In Progress
2023-01-17 22:15:54 +00:00
Alexander Likhachev bb51522cac [IC] Fix non-existing file removal in CompilationTransaction
#KT-49785 In Progress
2023-01-17 22:15:54 +00:00
Alexander Likhachev 274c9b6294 [IC] Register JS IC header file and lookup counter in transaction
#KT-49785 In Progress
2023-01-17 22:15:53 +00:00
Alexander Likhachev 5461667421 [IC] Measure time metrics in CompilationTransaction
#KT-49785 In Progress
2023-01-17 22:15:51 +00:00
Artem Kobzar 71486a321c [K/JS] Add support of compilation with ES-classes 2023-01-17 18:14:17 +00:00
Mikhail Glukhikh 0c4a0360ac Deserialization/class reading: pass chosen JvmMetadataVersion whenever possible 2023-01-16 18:16:07 +01:00
Mikhail Glukhikh afe1150aec KotlinClassInfo: commit back an accidentally reverted fix of KTIJ-20954 2023-01-16 18:12:55 +01:00
Alexander Udalov ae6d4d268d Use short copyright from COPYRIGHT_HEADER in generated files 2023-01-02 22:52:18 +01:00
Alexander Udalov 3f2b51151f Remove -Xexclude-from-dumping
Apparently the underlying logic was removed in b07690fccf and no one
noticed.
2023-01-02 15:26:07 +00:00
Andrey Uskov 2be68065af Report lines number and LpS in build reports
#KT-55540 Fixed
2022-12-26 17:18:44 +03:00
nataliya.valtman 161d8d1cea KT-54959 Add worker execution time to task action execution time 2022-12-26 12:03:37 +03:00
Pavel Kunyavskiy 17e9a6a781 [klib] Fix serialization of missing annotations
^KT-42490
^KT-44625
2022-12-20 20:06:51 +00:00
Mikhail Mazurkevich dbddbab73c [jps] KT-55309 Inline storage initialization 2022-12-08 10:43:28 +00:00
Mikhail Mazurkevich dfead910b9 [jps] KT-55309 Remove obsolete NonCachingLazyStorage 2022-12-08 10:43:27 +00:00
Andrey Uskov 41ff283856 Don't call File.getCanonicalPath in KGP
Relates to KT-54579.
2022-12-04 18:49:30 +00:00
Hung Nguyen cdbbead157 Handle changes to inline functions/property accessors with @JvmNames
If we detect a change in an inline function `foo` with @JvmName
`fooJvmName`, we have two options:
   1. Report that function `foo` has changed
   2. Report that method `fooJvmName` has changed

Similarly, if we detect a change in an inline property accessor with
JvmName `getFoo` of property `foo`, we have two options:
   1. Report that property `foo` has changed
   2. Report that property accessor `getFoo` has changed

The compiler is guaranteed to generate `LookupSymbol`s corresponding to
option 1 when referencing inline functions/property accessors, but it is
not guaranteed to generate `LookupSymbol`s corresponding to option 2.
(Currently the compiler seems to support option 2 for *inline*
functions/property accessors, but that may change.)

Therefore, we will choose option 1 as it is cleaner and safer.

^KT-54144 In progress

Small cleanup in IncrementalCompilerRunner

 - Add comment for closing caches
 - Rename providedChangedFiles to changedFiles
 - Tiny clean up in `performWorkBeforeCompilation`
 - Count directories to delete in debug logs

^KT-53015 In progress

Extract KotlinClassInfo to a separate class

to reduce the size of IncrementalJvmCache and prepare for the next
change.

^KT-54144 In progress

Ignore inline functions that are not found in the bytecode

^KT-54144 In progress

Add unit test for handling `@JvmName`s

Test: KotlinOnlyClasspathChangesComputerTest
             #testFunctionsAndPropertyAccessorsWithJvmNames
^KT-54144 Fixed

Update unit tests for handling `@JvmName`s

In a previous commit, we made a behavior change for inline property
accessors: The existing behavior is that if the implementation of an
inline getter has changed, only usages of the getter will be impacted
but not usages of the setter (and vice versa).

After that previous commit, usages of *both* the getter and setter will
now be impacted (i.e., we might compile slightly more files). This is
because a change to either the getter or the setter will now be
considered a change to the property, which will help simplify our change
analysis.

This commit updates the relevant unit tests to reflect the new behavior.

Test: Updated Incremental*TestGenerated.PureKotlin#testInlinePropertyInClass
      and Incremental*TestGenerated.PureKotlin#testInlinePropertyOnTopLevel

^KT-54144 Fixed
2022-11-10 10:03:55 +01:00
nataliya.valtman 9b212cfa86 Revert "Extract KotlinClassInfo to a separate class"
This reverts commit ec3da62672.
2022-11-07 13:59:32 +01:00
Hung Nguyen ec3da62672 Extract KotlinClassInfo to a separate class
to reduce the size of IncrementalJvmCache and prepare for the next
change.

^KT-54144 In progress

Handle changes to inline functions/property accessors with `@JvmName`s

If we detect a change in an inline function `foo` with @JvmName
`fooJvmName`, we have two options:
   1. Report that function `foo` has changed
   2. Report that method `fooJvmName` has changed

Similarly, if we detect a change in an inline property accessor with
JvmName `getFoo` of property `foo`, we have two options:
   1. Report that property `foo` has changed
   2. Report that property accessor `getFoo` has changed

The compiler is guaranteed to generate `LookupSymbol`s corresponding to
option 1 when referencing inline functions/property accessors, but it is
not guaranteed to generate `LookupSymbol`s corresponding to option 2.
(Currently the compiler seems to support option 2 for *inline*
functions/property accessors, but that may change.)

Therefore, we will choose option 1 as it is cleaner and safer.

^KT-54144 In progress

Ignore inline functions that are not found in the bytecode

^KT-54144 In progress

Add unit test for handling `@JvmName`s

Test: KotlinOnlyClasspathChangesComputerTest
             #testFunctionsAndPropertyAccessorsWithJvmNames
^KT-54144 Fixed

Small cleanup in IncrementalCompilerRunner

 - Add comment for closing caches
 - Rename providedChangedFiles to changedFiles
 - Tiny clean up in `performWorkBeforeCompilation`
 - Count directories to delete in debug logs

^KT-53015 In progress

Small cleanup in IncrementalCompilerRunner

 - Add comment for closing caches
 - Rename providedChangedFiles to changedFiles
 - Tiny clean up in `performWorkBeforeCompilation`
 - Count directories to delete in debug logs

^KT-53015 In progress
2022-11-07 13:10:02 +01:00
Aleksei.Cherepanov fbb0d6d805 Fix serialization of arrays in compiler arguments
#KT-54791 Fixed
2022-11-05 12:01:06 +00:00
Aleksei.Cherepanov 26e7c29a91 [JPS] Rebuild module on facet change
The logic of detecting changes in Kotlin facets was changed from "Include selected fields" to "Include all compiler arguments and exclude selected". This will help to avoid multiple IC issues when new change-sensitive compiler arguments will be added

(#KTIJ-17137, #KT-51536, #KTIJ-17170, #KTIJ-17300, #KT-47983) Fixed

Merge-request: KT-MR-7455
Merged-by: Aleksei Cherepanov <aleksei.cherepanov@jetbrains.com>
2022-10-26 09:45:27 +00:00
Andrey Uskov 3832c6a520 Do not use File.canonicalPath in incremental caches
This fix improves performance of incremental compilation on Windows
machines.
When portable JPS caches are used, DirtyFilesHolder.getRemovedFiles
could return file names which are not allowed on current platform.
Previously it resulted in IOException on File.getCanonicalFile.
#KT-53735 Fixed
2022-10-20 09:04:45 +00:00
Aleksei.Cherepanov be71d8841e Use case-sensitive logic in PathStringDescriptor for all platforms
This is especially needed for portable caches. Now hash counting on mac/windows is the same as logic on linux, which allows to create caches on remote servers and use them together with incremental compilation locally.

#KT-53932 Fixed
2022-09-27 11:29:22 +00:00
nataliya.valtman 4863e5d47b Store errors into separate files 2022-09-20 14:11:25 +02:00
Hung Nguyen 03f83ff339 New IC: Include inline property accessors in class/package members
Problem: ClasspathChangesComputer (a core component of the new IC) uses
the existing inline function analysis from the old IC
(IncrementalJvmCache.InlineFunctionsMap). If an inline property accessor
has changed, the inline function analysis will report the name of the
property accessor, not the name of the property.
ClasspathChangesComputer doesn't see the property accessor's name in the
list of class/package members, so it will throw an exception.

Solution: There are 2 options:
  1. If an inline property accessor has changed, the inline function
     analysis can report the name of the property instead of the
     property accessor.
  2. ClasspathChangesComputer can include property accessors in the list
     of class/package members.

In this commit, we will choose option 2 as it is simpler.

Test: New KotlinOnlyClasspathChangesComputerTest.testPropertyAccessors

Small cleanup - PLS SQUASH INTO PREVIOUS COMMIT

  - Address review
  - Fix failed tests
  - Add some trivial changes

^KT-53871 Fixed
2022-09-19 11:50:08 +02:00
Hung Nguyen def886cd31 Clean up fall-back logic in IncrementalCompilerRunner
Make it clear that there 3 distinct cases:
   1. Incremental compilation completed with an ExitCode.
   2. Incremental compilation was not possible for some valid reason
      (e.g., for a clean build), and we will perform non-incremental
      compilation.
   3. Incremental compilation failed with an exception.
      In this case, we will:
        - Print a warning with a stack trace
        - Ask the user to file a bug
        - Collect rebuild reason enum for analytics
           + TODO: Collect the stack trace too
        - Fall back to non-incremental compilation

Test: Existing BaseIncrementalCompilationMultiProjectIT.testFailureHandling_UserError,
      Updated BaseIncrementalCompilationMultiProjectIT.testFailureHandling_ToolError

^KT-53015: In progress
2022-09-19 07:33:16 +03: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