Commit Graph

537 Commits

Author SHA1 Message Date
Alexander.Likhachev ef0fb557a5 [Build] Split junit-jupiter into api and engine
#KTI-1349 In Progress
2023-09-06 22:47:33 +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
Aleksei.Cherepanov 68af705664 Add import tracker
This tracker reports import directives to IJ's JPS to track changes and detectwehen it is needed to adjust compilation scope.

#KT-44835 Fixed
2023-08-30 12:42:39 +00:00
Alexander.Likhachev 51a43a02f7 [IC] Restore old IncrementalCompilationContext constructor for KSP compatibility 2023-08-18 14:20:57 +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
Artem Kobzar a29fa428b3 [K/JS] Add warning for ES-modules on the klibgen stage on the uniqueness of the exported names from the module 2023-08-08 15:45:02 +00:00
Alexander.Likhachev b3677fa0ca [IC] Allow to not specify the modules info 2023-08-01 16:24:37 +00:00
Nataliya.Valtman ed2dd4b2ae Split Gradle and JPS metrics
#KT-58026 In progress
2023-07-27 11:18:54 +00:00
Troels Bjerre Lund 111bb461a9 CLI: Change kotlin reflection to java reflection
The command line argument parser is using between 0.25s and 0.5s
(depending on platform) on finding annotated properties. This fix
replaces the slow kotlin reflection with java reflection, which is an
order of magnitude faster.

 #KT-58183 Fixed
2023-06-27 08:34:40 +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
Aleksei.Cherepanov e11f7daae4 Disable JvmTargetDefaultSubstitutor
Disable JvmTargetDefaultSubstitutor as far as minimal supported jvmTarget version is 1.8

#KTIJ-25445 Fixed
2023-05-17 21:47:21 +00:00
Hung Nguyen 0b09be73c6 New IC: Detect changes to class annotations
Both the new and old incremental compilation (IC) analysis rely on
Kotlin class metadata to detect a change.

However, Kotlin metadata currently doesn't contain info about
annotations (KT-57919), so the IC will not be able to detect a change
to them.

With this commit, we'll fix the new IC such that it can detect a change
to class annotations by not relying only on metadata.

We currently scope this fix to the new IC (cross-module analysis) first.
We'll fix this issue for within-module analysis later.

Performance: There seems to be no performance impact from this change.
Snapshotting the 400MB ideaIC-2022.1.4/app.jar takes 4.1s before and
after this change.

Test: Added ClasspathChangesComputerTest.testChangedAnnotations
^KT-58289: Fixed
2023-05-11 15:24:05 +00:00
Nataliya.Valtman 2a391f7330 Move kotlin-build-statistic project to :compiler 2023-04-25 11:29:09 +00:00
nataliya.valtman e34dd043da Add minimal statistic report for JPS build
Fix build stat for gradle 8

#KT-56438 Fixed
2023-04-25 11:29:09 +00:00
Aleksei.Cherepanov 2e453051f9 Add cache comparator for incremental gradle tests
Add logic that rebuilds all sources after the last incremental round of each Gradle IC test and compares caches. The same was already implemented for JPS, but not for Gradle. After all rounds of incremental compilation are completed, another clean build from scratch is produced. All caches after the rebuild are compared with the caches of the last round of incremental compilation. This check is necessary because incremental compilation artifacts should depend on the state of the project, source files, and configuration, and not the chain of changes and incremental builds that led to this state. After the launch, there were several tests that did not satisfy the above conditions, and were muted  (KT-56681, KT-55195, KT-56242, KT-56698)

#KT-54991 In Progress
2023-04-24 14:54:45 +00:00
Yahor Berdnikau eb4e96a113 Add kotlin-build-tools-enum-compat workaround
It acts as a workaround for the case when build tools or dependencies
are compiled with latest 'kotlin-stdlib' version, but at a runtime older
 'kotlin-stdlib' is provided, which does not know about new
 `EnumEntries`.

 ^KT-57317 Fixed
2023-04-21 14:57:17 +00:00
Roman Golyshev d4cffb8a5a [213] Switch to 213 platform
KTI-1114
2023-04-21 13:19:04 +00:00
Sebastian Sellmair b6ca62f330 [CLI][Minor] toArgumentStrings: Use List Builder (like) style
KTIJ-24976
2023-04-06 16:03:04 +00:00
Sebastian Sellmair 082a38216d [CLI] argumentsToStrings: Add 'compactArgumentValues' option
Passing 'false' will pass Array or List based arguments multiple times
instead of using the Delimiter.

eg:
compactArgumentValues = true:
"-cp", "library1;library2;library3"

compactArgumentValues = false:
"-cp", "library1", "-cp", -"library2", "-cp", "library3"

Using compactArgumentValues = false can be beneficial
when the many compiler arguments are held in memory.
In this case the raw arguments can intern individual string values, which
is highly effective when the arguments refer to files on disk.

KTIJ-24976
2023-04-06 16:03:04 +00:00
Sebastian Sellmair 7f91e94e7a [CLI] Arguments: Implement raw vs resolved delimiters
KTIJ-24976
2023-04-06 16:03:03 +00:00
Sebastian Sellmair d07b1b6502 [CLI] Implement CommonToolArguments.toStringList (to replace convertArgumentsToStringList`)
KTIJ-24976
2023-04-06 16:03:02 +00:00
Ivan Kylchik 5d5582d201 Move ignoreConstOptimizationErrors compiler key from jvm to common
#KT-56023
2023-03-24 15:55:03 +00:00
hungvietnguyen 4f3244fb78 IC: Compute symbols impacted by classpath changes (#5111)
IC: Compute symbols impacted by classpath changes

Incremental compilation has 4 key steps:
  1. Compile changed/impacted files
  2. Detect symbols that have changed after compiling
  3. Detect symbols that are impacted by the changed symbols
  4. Based on the changed-or-impacted symbols, identify files that need
     to be recompiled. Go back to step 1.

Normally, step 2 and 3 are done together when the changed symbols
and impacted symbols are in the same module.

However, if the changed symbols and impacted symbols are in different
modules (e.g., a `Subclass` in lib1 extends a `Superclass` in lib2),
we currently do not compute symbols in the current module that are
impacted by changes in another module (step 3 above).

This is the case for both the new IC and the old IC.

In this commit, we will compute impacted symbols for the new IC. We can
fix the old IC later if necessary (they can't be fixed together easily).

Test: Added BaseIncrementalCompilationMultiProjectIT.testChangeInterfaceInLib
^KT-56197 Fixed
2023-03-21 13:12:15 +01:00
nataliya.valtman 79fff92dc1 Don't use aggregated GC metric for build reports 2023-03-14 20:58:45 +00:00
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