811 Commits

Author SHA1 Message Date
Sergey Rostov 2fedf572f9 JPS: Don't catch BuildDataCorruptedException as internal error.
BuildDataCorruptedException should be thrown up to `IncProjectBuilder`
to be handled by TeamCity.

#KT-27037 Fixed

Original commit: cce125b982
2018-10-27 16:08:38 +03:00
Sergey Rostov 12822fd468 JPS: Fix initialization order for case when all kotlin rebuild.
#KT-27792 Fixed

Original commit: 0b8d94a6b1
2018-10-27 16:08:16 +03:00
Vyacheslav Gerasimov 65de209e6f as34: Apply changes from AS 3.3
Original commit: 4076923a26
2018-10-26 18:25:20 +03:00
Sergey Rostov 84ec60ba3e JPS, CacheAttributesManager: remove unused methods
Original commit: 0d1f7965d4
2018-10-16 12:29:58 +03:00
Sergey Rostov 085dbb537a IC: move CacheVersionManager from build_common to jps plugin
Original commit: d91f6f8c43
2018-10-16 12:29:58 +03:00
Sergey Rostov fe93ea2132 JPS: Fix updating cache format version for rebuilt targets by removing i/o optimization
Problem: previously, format-version.txt file was deleted while cleaning
target output on rebuild. Since directory was deleted, cache
attributesDiff stored in memory was not updated. This causes that on
saveExpectedStateIfNeeded does nothing.

The right way to fix it is move cache version format diff into
AbstractIncrementalCache, and override `clean()` method. But this is
hard to do for lookup storage, since used compilers set (jvm/js) will
known only after context init. This can be done by moving `expected`
attributes out of manager, but this is huge change for small benefit.

So, the optimal way for now is to write version for each build, even if
it is not changed.

#KT-27044 Fixed

Original commit: 5232f080d6
2018-10-16 12:29:58 +03:00
Nikolay Krasko f6530a4811 Update dictionary: +infos, -kompiler
Original commit: 07e305e5f4
2018-09-25 15:52:21 +03:00
Sergey Rostov 1424bd16d0 JPS: fix daemon RPC serialization
#KT-26809 Fixed

Original commit: 39c76c7b11
2018-09-14 10:34:30 +03:00
Sergey Rostov 3a7f2ff5c5 JPS, minor: rename KotlinModuleBuildTarget.updateSourcesList to computeSourcesList
Original commit: 81cf3fbc28
2018-09-13 20:30:35 +03:00
Sergey Rostov e47d796bd7 JPS, native: skip and report native modules as not supported
#KT-26648 Fixed

Original commit: 9e6d6ad9da
2018-09-13 20:30:35 +03:00
Sergey Rostov c85464d2ae JPS, -Xcommon-sources: don't iterate on all sources, use root info from DirtySourceFilesHolder. Cleanup code.
Also:
- Pass `-Xcommon-sources` argument to JS compiler.
- Calculate all sources list only when needed (after change it is not required to calculate common-sources)
- Remove `chunk: ModuleChunk` parameter from some `KotlinModuleBuildTarget` functions.

Original commit: 8cd3b46f05
2018-09-13 20:30:33 +03:00
Sergey Rostov d015b8b8a1 JPS MPP tests: Don't do anything for common modules, enable js ic, fix test data
Original commit: 359909dcff
2018-09-13 20:30:33 +03:00
Sergey Rostov 22b71e0b8e JPS: support -Xcommon-sources for multiplatform projects
#KT-26489 Fixed

Original commit: b8c982bb72
2018-09-13 20:30:31 +03:00
Alexey Sedunov 8a5d392e8d MPP: Implement isTestModule flag (as required by JPS)
Original commit: 6206f1e419
2018-09-10 17:27:41 +03:00
Sergey Rostov aa1eb9795d JPS: Refactor cache compatibility checking and build targets loading/dependency analysis.
CacheVersion class refactoring:

Responsibilities of class CacheVersion are splitted into:
	- interface CacheAttributesManager<Attrs>, that should:
	    - load actual cache attribute values from FS
	    - provide expected attribute values (that is required for current build)
	    - checks when the existed cache (with actual attributes) values is suitable for current build (expected atribute values)
	    - write new values to FS for next build
	- CacheAttributesDiff is created by calling CacheAttributesManager.loadDiff extension method. This is just pair of actual and expected cache attributes values, with reference to manager. Result of loadDiff can be saved.

CacheAttributesDiff are designed to be used as facade of attributes operations: CacheAttributesDiff.status are calculated based on actual and expected attribute values. Based on that status system may perform required actions (i.e. rebuild something, clearing caches, etc...).

Methods of CacheAttributesManager other then loadDiff should be used only through CacheAttributesDiff.
Build system should work in this order:
    - get implementation of CacheAttributesManager for particular compiler and cache
    - call loadDiff __once__ and save it result
    - perform actions based on `diff.status`
    - save new cache attribute values by calling `diff.saveExpectedIfNeeded()`

There are 2 implementation of CacheAttributesManager:
    - CacheVersionManager that simple checks cache version number.
    - CompositeLookupsCacheAttributesManager - manager for global lookups cache that may contain lookups for several compilers (jvm, js).

Gradle:

Usages of CacheVersion in gradle are kept as is. For compatibility this methods are added: CacheAttributesManager.saveIfNeeded, CacheAttributesManager.clean. This methods should not be used in new code.

JPS:

All JPS logic that was responsible for cache version checking completely rewritten.

To write proper implementation for version checking, this things also changed:
	- KotlinCompileContext introduced. This context lives between first calling build of kotlin target until build finish. As of now all kotlin targets are loaded on KotlinCompileContext initialization. This is required to collect kotlin target types used in this build (jvm/js). Also all build-wide logic are moved from KotlinBuilder to KotlinCompileContext. Chunk dependency calculation also moved to build start which improves performance for big projects #KT-26113
	- Kotlin bindings to JPS build targets also stored in KotlinCompileContext, and binding is fixed. Previously it is stored in local Context and reacreated for each chunk, now they stored in KotlinCompileContext which is binded by GlobalContextKey with this exception: source roots are calculated for each round, since temporary source roots with groovy stubs are created at build time and visible only in local compile context.
	- KotlinChunk introduced. All chunk-wide logic are moved from KotlinModuleBuildTarget (i.e compiler, language, cache version checking and dependent cache loading)
	- Fix legacy MPP common dependent modules

Cache version checking logic now works as following:
- At first chunk building all targets are loaded and used platforms are collected. Lookups cache manger is created based on this set. Actual cache attributes are loaded from FS. Based on CacheAttributesDiff.status this actions are performed: if cache is invalid all kotlin will be rebuilt. If cache is not required anymore it will be cleaned.
- Before build of each chunk local chunk cache attributes will be checked. If cache is invalid, chunk will be rebuilt. If cache is not required anymore it will be cleaned.

#KT-26113 Fixed
#KT-26072 Fixed

Original commit: 437fc9d749
2018-08-31 11:13:18 +03:00
Yan Zhulanow dc022aef69 MPP: Refactoring, extract IDE platform kinds, allow to add custom platforms
Original commit: d00f5b335a
2018-08-31 05:14:15 +05:00
Dmitry Savvinov fd8083bb4b Always pass languageVersion explicitly to JPS compiler
When 'languageVersion' isn't passed explicitly, compiler will choose
'LATEST_STABLE'.

This may lead to spurious migration of a project to the next major
version after plugin update (e.g. when user had project of major
version X and then installed plugin of version X+1 -- in such case,
meaning of "no language version" suddenly changes).

So, we set it to RELEASED_VERSION, which is exactly the version
that is safe to use as the fallback.

Original commit: b23bf371cf
2018-08-30 16:21:43 +03:00
Alexander Podkhalyuzin f88c703b93 When version is not defined we need to fallback to released
There are few more such places. Better fix would be to avoid
situation, when we need to fallback. So in every project these
settings are defined. It means "Latest stable" setting is not good.

#KT-26364 Fixed

Original commit: 69a0fedd9f
2018-08-30 16:21:40 +03:00
Alexander Udalov 9c21dae5e2 Introduce -Xcommon-sources and pass it correctly from build tool plugins
#KT-25196 In Progress

Original commit: 0f003802fe
2018-08-21 12:49:10 +02:00
Alexey Tsvetkov bf4565259b Use same system property to avoid deleting module file in JPS and Gradle
Original commit: d09629972a
2018-08-20 23:41:11 +03:00
Sergey Rostov c475e35489 JPS: Support new MPP model.
Original commit: 839a6b5e60
2018-08-07 15:59:43 +03:00
Alexey Tsvetkov 35c62ecaec Report info message when JS IC is enabled in JPS
Original commit: c8c0c773fb
2018-07-23 15:43:17 +03:00
Alexey Tsvetkov ad7f554208 Use separate system properties to control IC for JVM and JS
Also this commit effectively disables JS IC by default

     #KT-25563 fixed

Original commit: 0b18380770
2018-07-23 15:43:16 +03:00
Ilya Chernikov 7b039f10c5 Add kts to supported file extensions to the DirtySourceFilesHolder as well
allows jps to compile scripts along with sources,
finally fixes #KT-22611

Original commit: 563e4c9e57
2018-07-10 08:43:51 +02:00
Ilya Chernikov e5e591fbc8 Create proper constructor in script descriptor
allows to resolve calls to scripts in compiler (but not in the IDE yet)
Some refactorings on the way

Original commit: 9453834fb1
2018-07-10 08:43:50 +02:00
Alexey Tsvetkov 20a147e476 Fix compilation of plugin projects in JPS
#KT-25218 fixed

Original commit: f438b7501c
2018-07-04 14:54:07 +03:00
Alexey Tsvetkov 94f8210340 Minor: reword progress message
#KT-24936 fixed

Original commit: cdfcedb897
2018-06-19 15:43:24 +03:00
Sergey Rostov fe9eb0310f jps: add common source roots to the final platform modules as a workaround for absence of incremental k2metadata compiler
Original commit: 5455b6c0c0
2018-06-08 09:46:56 +03:00
Sergey Rostov 6b7f0f3c6e jps, daemon: pass incremental compilation flag from jps process to daemon
Original commit: e831964871
2018-06-08 09:46:52 +03:00
Sergey Rostov 661f974e99 jps: checkCachesVersions for js and common (BuildMetaInfo save/check)
Original commit: 5a2ed364fe
2018-06-08 09:46:49 +03:00
Sergey Rostov c01e0935ba jps: improve KotlinDirtySourceFilesHolder
Original commit: 3cfb200e07
2018-06-08 09:46:48 +03:00
Sergey Rostov 60de938f22 jps: (minor) fix java module detection
Original commit: b5acb83325
2018-06-08 09:46:47 +03:00
Sergey Rostov 3a5610bb21 jps, js: Fix exception on rebuild js module
Original commit: 5478a552ed
2018-06-08 09:46:46 +03:00
Sergey Rostov 8b4813c014 jps: Don't create cache for common modules (KOTLIN-CR-2028)
Original commit: d75a2be31b
2018-06-08 09:46:45 +03:00
Sergey Rostov 304a537c68 jps: fixes for KOTLIN-CR-2028
Original commit: c24aa13f12
2018-06-08 09:46:44 +03:00
Sergey Rostov 53f04d0d19 jps: fix mergedCompilerArguments getter (mergedCompilerArguments)
Original commit: 40b9fa88b7
2018-06-08 09:46:42 +03:00
Sergey Rostov a1fa9ffdbb jps: implement mpp and js daemon compiler services
#KT-24635 fixed

Original commit: 1cbef873ec
2018-06-08 09:46:41 +03:00
Sergey Rostov e302f27635 jps, mpp: fix marking expect/actual complementary files as dirty
This files should be marked as dirty for current round, not next

Original commit: b2fedd7b1e
2018-06-08 09:46:40 +03:00
Sergey Rostov 1ce29e2a73 jps: support KotlinSourceRootType
KotlinSourceRootType will added with KotlinSourceRootProvider (ex KotlinMppCommonSourceRootProvider).
New target type (with computeAllTargets) is not possible because ModuleBuildTarget is final.

#KT-24506 fixed

Original commit: 65bdfa72c1
2018-06-08 09:46:39 +03:00
Sergey Rostov 60494f27c6 jps, mpp: temporary disable mpp tests
Original commit: b2f58ad9c3
2018-06-08 09:46:38 +03:00
Sergey Rostov 5f818789cf jps: support multiplatform incremental compilation for jvm and js
- support common modules metadata compilation under flag (it is not required since all common source roots are included transitively for now)
- introduce expect actual tracker in jps: move implementation from gradle to build-common
- support js incremental compilation: move implementation from gradle to build-common

Original commit: 0eee2729cd
2018-06-08 09:46:37 +03:00
Sergey Rostov 79bf8f7c98 jps: support dev kit module types (and all other ModuleBasedBuildTargetType)
#KT-24500 fixed

Original commit: ec5110e1f4
2018-05-24 11:12:01 +03:00
Alexey Tsvetkov bc37e46187 Improve JPS progress messages
#KT-9218 fixed

Original commit: 7f865565a6
2018-05-18 23:50:08 +03:00
Alexey Sedunov 21772d2a14 Configuration: Introduce special source roots for non-JVM Kotlin modules
#KT-5948 Fixed
 #KT-23672 Fixed

Original commit: 9fa26c83b6
2018-05-18 12:09:40 +03:00
Sergey Rostov e4d51df269 jps (refactor): reimplement KotlinModuleBuildTarget data binding using CompileContext
Original commit: 9fafe0473c
2018-05-04 11:14:45 +03:00
Sergey Rostov 96725b1e36 jps: common modules metadata compiler
(cherry picked from commit cde333d)

Original commit: 91b703d529
2018-05-04 11:05:13 +03:00
Sergey Rostov ffd77601ca jps: minor: refine kotlin.jps.model package
(cherry picked from commit 2a31e78)

Original commit: 41dcc9ad4d
2018-05-04 11:05:12 +03:00
Sergey Rostov 64afafe65e jps: Refactor module/project settings getters/setters
(cherry picked from commit d29ffa0)

Original commit: a390fc36e2
2018-05-04 11:05:12 +03:00
Sergey Rostov ef5d8435b6 jps(refactor): Extract platform related code
#KT-23656 Fixed

(cherry picked from commit 18a751d)

Original commit: 75e6be7802
2018-05-04 11:05:12 +03:00
Nikolay Krasko c7fe4c10bf Remove files introduced in 181 from 173 branch
Original commit: c83ff5e75f
2018-04-27 19:45:23 +03:00