Commit Graph

159 Commits

Author SHA1 Message Date
Ilya Gorbunov a18770fbbb Remove projectDist dependency helper usages
Use default configuration dependencies instead of projectDist ones.
2018-09-12 06:05:05 +03:00
Sergey Rostov cdcc588a55 IC: Fix CacheVersionsManager IC flag set.
Previously flag was set before the IncrementalCompilation.isEnabledForJvm() system property was set.
This cases that the cache versions was not saved.
2018-08-31 14:55:35 +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
Alexander Udalov 0f003802fe Introduce -Xcommon-sources and pass it correctly from build tool plugins
#KT-25196 In Progress
2018-08-21 12:49:10 +02:00
Alexey Tsvetkov 30f3622b27 Implement inter-project JS IC with Gradle
#KT-25025 fixed
2018-08-21 04:32:31 +03:00
Alexey Tsvetkov 7ff7c71b96 Refactoring: extract function for getting classpath changes 2018-08-21 03:53:56 +03:00
Alexey Tsvetkov aeaf1d6633 Refactoring: introduce DirtyFilesContainer for better code reuse in IC 2018-08-21 03:53:56 +03:00
Alexey Tsvetkov 3b4a49eebf Add test for KT-26064 2018-08-17 15:27:00 +03:00
Sergey Igushkin 456edf3bbd Fix NPE due to classpath delegate change 2018-08-11 23:16:04 +03:00
Alexey Tsvetkov 3227300f18 Minor: rename setIsEnabled->setIsEnabledForJvm 2018-07-23 15:43:17 +03:00
Alexey Tsvetkov 0b18380770 Use separate system properties to control IC for JVM and JS
Also this commit effectively disables JS IC by default

     #KT-25563 fixed
2018-07-23 15:43:16 +03:00
Alexey Tsvetkov 89f0b11765 Avoid exception when inspectClassesForKotlinIC produces empty file
Empty file should not happen, but we should process it correctly anyway.
2018-06-22 19:15:45 +03:00
Alexey Tsvetkov 2065f8e6fe Fix inter-project IC for android->non-android dependency
#KT-24832 fixed
2018-06-22 19:15:45 +03:00
Sergey Rostov c24aa13f12 jps: fixes for KOTLIN-CR-2028 2018-06-08 09:46:44 +03:00
Sergey Rostov 0eee2729cd 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
2018-06-08 09:46:37 +03:00
Ivan Gavrilovic 44482dbe90 Revert access modifier change in android history 2018-06-07 19:10:09 +03:00
Ivan Gavrilovic 728508e0ae Return an error when build history for dir does not exist 2018-06-07 19:10:04 +03:00
Ivan Gavrilovic 6bb54fd9a3 Support fetching build history files from directories for Android
Android Gradle plugin will start publishing clases in directories.
This commit adds support to find build history files when changed
files come from directories. It is similar to existing implementation
for jars i.e. it looks for .kotlin_module file under META-INF.

Test: ModulesApiHistoryAndroidTest
2018-06-07 19:10:00 +03:00
Yan Zhulanow 662b79780d Kapt: Remove kapt1 support from Gradle and incremental compilation 2018-05-24 01:01:51 +03:00
Alexey Tsvetkov ea255ac854 Rebuild when dependency was built non-incrementally 2018-05-17 20:55:27 +03:00
Alexey Tsvetkov 53266300d4 Implement module detection for Gradle IC with Android
#KT-22431 fixed
2018-05-17 20:55:26 +03:00
Alexey Tsvetkov e5cdc64f4f Track changes for jar files for non-Android Gradle projects 2018-05-17 20:55:26 +03:00
Alexey Tsvetkov 6a45310830 Remove global artifact history cache in Gradle
Each Kotlin task now writes build history to separate file.
A map of output directories to history files is used to get changes for
modified files.

    #KT-22623 fixed
2018-05-17 20:46:52 +03:00
Alexey Tsvetkov 1778cc6a39 Fix incremental compilation with Java 9+
#KT-23901 fixed
2018-04-25 16:05:48 +03:00
Alexey Tsvetkov 2b4aa74c0b Add test cases for FQ-name parsing in IC 2018-04-23 15:03:42 +03:00
Zalim Bashorov ab03ab84bb Regenerate tests 2018-04-19 13:17:27 +03:00
Alexey Tsvetkov dee8b403e3 Turn sourcemap generation on 2018-04-19 05:18:54 +03:00
Alexey Tsvetkov ea8f2b5cd8 Clear MockApplication in ClassesFqNamesTest 2018-04-12 18:26:50 +03:00
Alexey Tsvetkov bd50ad87ba Use KotlinCoreEnvironment for parsing Kotlin in IC
Creating and disposing CoreApplicationEnvironment on each call leads to
problems with parallel builds, while KotlinCoreEnvironment
avoids disposing application environment in case of parallel builds.

    #KT-23694 fixed
2018-04-11 19:56:15 +03:00
Alexey Tsvetkov 13ac64b84a Move parseFileUtils to incremental-compilation-impl 2018-04-11 19:56:15 +03:00
Alexey Tsvetkov 650e97f200 Temporarily turn off source map generation in JS IC tests
Until IncrementalJsCompilerRunnerTestGenerated$ClassHierarchyAffected.testEnumEntryRemoved 
is fixed
2018-04-03 21:11:12 +03:00
Alexey Tsvetkov 3eb968807e Invalidate usages of removed classes before round
#KT-23165 fixed
2018-04-03 21:11:12 +03:00
Nikolay Krasko 70d236cb8d Always configure "idea.home.path" system variable
When TestLoggerFactory is initialized in tests it checks that variable
and it it's not present uses classpath to search for logger configuration.

If this search is unsuccessful a lot of exceptions are written to log:

java.lang.RuntimeException: Could not find installation home path. Please make sure bin/idea.properties is present in the installation directory.
     	at com.intellij.openapi.application.PathManager.getHomePath(PathManager.java:96)
     	at com.intellij.testFramework.TestLoggerFactory.reconfigure(TestLoggerFactory.java:67)
2018-03-29 19:49:00 +03:00
Alexey Tsvetkov 8a82c1618c Use Plugins DSL in Kotlin Gradle scripts
When plugins DSL is used, there is no need to
manually generate typesafe accessors for extensions and
conventions (by running `./gradlew kotlinDslAccessorsSnapshot`).
2018-03-26 16:09:29 +03:00
Alexey Tsvetkov 605bcc66a1 IC: add destination dir to start of classpath instead of end
Otherwise IC fails when a project declares a class with the same name
as in one of its dependencies.
The issue is relevant only for non-JPS IC (Gradle, Maven, etc.),
but I added the test for JPS too.

  #KT-20516 fixed
2018-03-21 18:44:42 +03:00
Alexey Tsvetkov 6ab96c1d7d Set up idea.home.path in :incremental-compilation-impl
To avoid warnings in stderr
2018-03-19 18:04:33 +03:00
Alexey Tsvetkov 1cd2abf76f Fix comparing directories after IC test
A directory-after-rebuild should correspond to expectedDir parameter,
a directory-after-IC should correspond to actualDir parameter.
Also we should not forgive extra directories.
2018-03-19 18:04:33 +03:00
Alexey Tsvetkov d95abf2234 Generate meta info in JS IC tests 2018-03-19 18:04:33 +03:00
Alexey Tsvetkov 30d0cc3a34 Ensure all output directories are cleared on IC rebuild
In some cases IC needs to perform a rebuild.
Before this change IC was not clearing output directories
besides destination dir for classes, so for example
kapt stubs were not cleared.

Stalled stubs might lead to compile errors.
For example:
1. foo/XGen.java is generated from annotated class foo/X (XGen also
references X).
2. foo/X is moved to bar/X and some other change forces IC to rebuild.
3. kapt generates bar/X stub, but foo/X stub
was not removed because stubs dir is not cleared.
4. kapt runs annotation processors, foo/XGen.java is generated from
foo/X stub, bar/XGen.java is generated from bar/X stub.
5. kotlinc rebuilds. Since destination dir is cleared properly,
only bar/X.class exists.
6. javac tries to compile foo/XGen and fails, because it
compiles against actual Kotlin classes, not stubs.

This commit fixes the issue by passing all output directories
of a task from Gradle to Kotlin IC.

   #KT-21735 fixed
2018-03-19 17:39:47 +03:00
Zalim Bashorov 9970dd051f Fix copyright's start year in generated tests 2018-03-14 15:04:58 +03:00
Yan Zhulanow 34d1611ed4 Add Pill support to compiler and IDE modules 2018-03-02 03:15:17 +03:00
Nikolay Krasko f05e926670 Update idea to 173.3.4 (173.4548.28) 2018-02-03 00:15:45 +03:00
Vyacheslav Gerasimov 89a07ded1c Extract versions and remove unnecessary '.jar' extensions 2018-01-30 17:06:18 +03:00
Ilya Chernikov 5dc094d290 Implement correct and fast ultimate/community sdks handling 2018-01-30 17:06:15 +03:00
Ilya Chernikov 4eb557724c Convert compiler projects to the new intellij deps 2018-01-30 17:06:13 +03:00
Ilya Chernikov a4f28cd94f Make all dependencies to idea sdk intransitive 2018-01-30 17:06:11 +03:00
Alexey Tsvetkov 21f2b68357 Fix BuildLogParserParametrizedTest on Windows: normalize line separators 2018-01-22 18:34:17 +03:00
Alexey Tsvetkov 6fc5c3325c Minor: rename file to match class name 2018-01-22 18:34:17 +03:00
Dmitry Jemerov e80dae1802 Update copyright in generated tests 2018-01-10 11:55:28 +01:00
Alexey Tsvetkov d7edbb8dfc Track changes in inline function when friend paths are disabled in JS 2017-12-22 16:12:20 +03:00