Commit Graph

24 Commits

Author SHA1 Message Date
Sergey Rostov b3985d2735 JPS: remove cache version from test data 2019-01-10 08:50:38 +03:00
Sergey Rostov 4cd4e230bf JPS, tests: update test data for cacheVersionChanged/withError
In this test only lookups caches are invalidated and only in first step.
module4 shouldn't be rebuilt since is compiled in step 1 and it is independent of all dirty modules.

Previously this module was rebuilt because of #KT-27044 which is fixed
by 5232f08
2018-11-26 09:29:38 +03:00
Sergey Rostov a508f53f9d JPS, tests, minor: reformat test data for cacheVersionChanged/withError 2018-11-26 09:29:38 +03:00
Sergey Rostov 06b908d48f JPS, tests: Add docs for incremental/cacheVersionChanged tests 2018-11-26 09:29:38 +03:00
Sergey Rostov 808e83a01e JPS tests: switch to new dependencies.txt parser
Order of modules changed because new parser preserve order, while previously modules are accidentally sorted by hashCode().
2018-09-13 20:30:32 +03:00
Sergey Rostov 437fc9d749 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
2018-08-31 11:13:18 +03:00
Alexey Tsvetkov 5760b8cf8b Register kotlin_module as output of all files
Previously kotlin_module was registered as output
only for files containing top-level declarations
2018-07-09 15:48:11 +03:00
Zalim Bashorov 441a442f34 Minor: update testdata 2016-04-08 13:45:37 +03:00
Zalim Bashorov f5ca949f2c IC: improve logging in tests and fix DataContainerVersionChangedTestGenerated#testWithError
Test logging improvements:
  * print which chunk building in the round for multimodule projects
  * print actions after cache changed
2016-04-08 13:45:37 +03:00
Nikolay Krasko 46a1028494 Temporary ad-hock jps-tests enable with testdata modification 2016-04-06 21:46:00 +03:00
Zalim Bashorov 4b8c9c8b39 Minor: fix testdata 2016-03-24 22:28:40 +03:00
Zalim Bashorov 45f21bc7fd Minor: drop content from touch files 2016-02-10 22:56:10 +03:00
Zalim Bashorov e33e31ad16 KotlinBuilder: don't request additional round when it's unnecessary & fix warnings 2016-02-10 21:37:12 +03:00
Zalim Bashorov f6e7f8c3c0 Introduce TestingContext to pass data between tests and KotlinBuilder; introduce BuildLogger to log build events (build finished, files marked as dirty) in KotlinBuilder 2016-02-09 23:27:25 +03:00
Zalim Bashorov d9b67ae0ef Minor: use ".touch" extension instead of ".new" in incremental compilation tests when it possible 2015-12-17 19:41:24 +03:00
Alexey Tsvetkov 6a74b1c8bf Rebuild only kotlin when cache version is changed 2015-12-10 18:03:17 +03:00
Alexey Tsvetkov 19089f8b17 Prevent processing changes if all kotlin in chunk was rebuilt 2015-12-02 20:56:37 +03:00
Alexey Tsvetkov 98e0905eb3 Minor: add java to test case 2015-12-02 20:56:37 +03:00
Alexey Tsvetkov 60a8db1c6c Do not use USER_DATA to preserve data between compilation rounds 2015-12-02 20:56:36 +03:00
Alexey Tsvetkov a447c39f69 Kotlin incremental cache version change should not affect java only modules 2015-12-02 20:56:36 +03:00
Alexey Tsvetkov a8b551e518 Test versioning of experimental incremental compilation 2015-12-02 20:56:36 +03:00
Dmitry Petrov c55106a325 Drop package facades:
- incremental cache impl should not depend on package facades
- fix trivial incremental compilation tests
TODO: inlines DO NOT WORK with incremental compilation
2015-10-19 16:03:20 +03:00
Alexey Tsvetkov a564724fa8 Fix issues with incremental cache version change
#KT-9360 fixed
2015-10-13 16:12:15 +03:00
Alexey Tsvetkov af3f7dfafc Make test generated 2015-10-13 16:12:15 +03:00