Commit Graph

542 Commits

Author SHA1 Message Date
Sergey Rostov c075d6a911 JPS: Test for "Cyclically dependent modules should have same compiler"
KT-27285

Original commit: c06b000e8d
2018-11-28 10:46:57 +03:00
Sergey Rostov 37185c22d0 JPS: support KotlinResourceSourceRootType
Implementation is similar to KotlinSourceRootProvider.
This workaround is required since ResourcesTarget.computeRootDescriptors
supports only JavaResourceRoots.

#KT-27622 Fixed

Original commit: dcc47fd8ef
2018-11-26 09:29:49 +03:00
Sergey Rostov cfb54fa15c JPS, tests, minor: rename test files in modules for better readability
Original commit: 1301333e37
2018-11-26 09:29:38 +03:00
Sergey Rostov 71003b4e75 JPS, tests: update removeAndRestoreCompanion[WithImplicitUsages] test data
src/A.kt is affected by removed classes

Original commit: 32bd4d5936
2018-11-26 09:29:38 +03:00
Sergey Rostov 6e977bbd86 JPS, tests, minor: reformat test data for changeIncrementalOption/incrementalOff
Original commit: 1f162cfacf
2018-11-26 09:29:38 +03:00
Sergey Rostov 2d04f3d3e3 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 fe93ea2

Original commit: 4cd4e230bf
2018-11-26 09:29:38 +03:00
Sergey Rostov 2854838709 JPS, tests, minor: reformat test data for cacheVersionChanged/withError
Original commit: a508f53f9d
2018-11-26 09:29:38 +03:00
Sergey Rostov a650f09208 JPS, tests: Add docs for incremental/cacheVersionChanged tests
Original commit: 06b908d48f
2018-11-26 09:29:38 +03:00
Sergey Rostov c09054326a JPS: Add tests for mpp complementary files tracking after build error (KT-27868)
Original commit: cc9892a27d
2018-11-22 08:40:32 +03:00
Anton Bannykh a783bf14cb JS: report inline suspend functions to IC
* Also inline suspend lambda'a
* Also use correct JsName's in exported suspend inline fun's
* Also use less unused imports

Original commit: 59009430e5
2018-11-07 12:11:01 +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 4cc52c1dff JPS, -Xcommon-sources: write tests
Original commit: c8351c3da0
2018-09-13 20:30:34 +03:00
Sergey Rostov 461df40078 JPS tests: support custom mpp multi module tests, rearrange test data files for more consistency, configure js modules with facet (not with stdlib dependency which should be deprecated), temporary mute some complex mpp tests
Original commit: 1b93f07a76
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 2b967e571c JPS tests: restore MPP tests runner, support new MPP model
Original commit: 4975ef7db5
2018-09-13 20:30:32 +03:00
Sergey Rostov 0eef15508f 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().

Original commit: 808e83a01e
2018-09-13 20:30:32 +03:00
Ilya Gorbunov 9cd0759e8d Update testData for incremental compilation tests
- enumMemberChanged, flagsAndMemberInSameClassChanged: added top level function results in a file class being generated
- companionObjectNameChanged: one more file is marked as dirty after the changes in build 1.2.70-dev-1439

Original commit: afb62ffc0c
2018-09-11 04:19:49 +03:00
Ilya Gorbunov 947a6399eb Replace hashCode usages in tests where it was supposed to fail on nullable receiver
Related to #KT-25039

Original commit: 903976d9af
2018-09-10 06:41:49 +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
Alexey Tsvetkov 1ab98f5817 Add test for KT-26064
Original commit: 3b4a49eebf
2018-08-17 15:27:00 +03:00
Alexey Tsvetkov a72d505153 Add test for KT-25540
Original commit: ff35d509e6
2018-07-23 15:43:17 +03:00
Alexey Tsvetkov 1602409341 Add multi-module JS IC tests with JPS
Original commit: 11977cc1c1
2018-07-23 15:43:17 +03:00
Alexey Tsvetkov 7f3cda4894 JS IC: track lookups from libraries
Otherwise we don't track lookups from other modules

    #KT-25540 fixed

Original commit: 8f002fdb43
2018-07-23 15:43:17 +03:00
Alexander Udalov fbe3053f88 Simplify DefaultImportProvider, introduce "low priority imports"
Previously, packages `java.lang` and `kotlin.jvm` were imported on JVM
by default on the same rights, causing problems when the same classifier
existed both in `java.lang` and `kotlin.jvm`. Since the only known case
of such conflict were type aliases to JVM classes, the corresponding
classes (expansions of those type aliases) were manually excluded from
default imports. This made the code in DefaultImportProvider complicated
and resulted in multiple problems, regarding both correctness and
performance (see d8e591f873, 930319281f, 5a048fea6b).

This change adds a new concept, a "low priority import", and treats
`java.lang` as such. Since these imports are now separated from the rest
of default imports in LazyImportScope via secondaryClassImportResolver,
conflicts between classifiers are handled naturally: the one from
`kotlin.jvm` always wins (unless the one from `java.lang` is imported
explicitly, of course). This approach is simpler, safer and does not
require any memory to cache anything.

Skip ResolveToJava.kt test for javac-based resolve; it now fails because
of a weird issue which I didn't have time to investigate (this is OK
because it's a corner case of an experimental functionality)

Original commit: 1f0fb4823f
2018-07-16 13:45:11 +02:00
Alexey Tsvetkov 3ccf89be00 Register kotlin_module as output of all files
Previously kotlin_module was registered as output
only for files containing top-level declarations

Original commit: 5760b8cf8b
2018-07-09 15:48:11 +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 88c4f73e3c Invalidate usages of removed classes before round
#KT-23165 fixed

Original commit: 3eb968807e
2018-04-03 21:11:12 +03:00
Alexey Sedunov 78ee6ba693 JS: Use the same output paths for JPS and Maven-based builds
#KT-22586 Fixed

Original commit: ae37cc30a1
2018-04-02 15:28:35 +03:00
Anton Bannykh a4fd51a823 Merge kotlin-experimental into kotlin standard library (KT-23055 fixed)
* kotlin-experimental.js has been already merged into kotlin.js
* change library name to kotlin in kotlin-experimental.meta.js in order to produce correct require calls
* concatenate kotlin-experimental.meta.js with kotlin.meta.js
* suppress multiple module declaration warning for such use case

Original commit: 7b860eab36
2018-03-26 23:13:28 +03:00
Mikhail Zarechenskiy f7d30600a1 Refactoring: rename parameter to argument for annotation diagnostics
Original commit: 4ebd11a7ae
2018-03-22 03:59:55 +03:00
Alexey Tsvetkov 9a0b91ef31 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

Original commit: 605bcc66a1
2018-03-21 18:44:42 +03:00
Alexey Tsvetkov 2454ee30bb Compare JS output files against file instead of hardcoded set
A difference is not obvious when two sets are compared:
there might be just one different element, but
sets would be printed in one line in iteration order
(which is non-fixed for hashsets).

Also the properties:
  EXPECTED_JS_FILES_IN_OUTPUT_FOR_STDLIB_ONLY,
  EXPECTED_JS_FILES_IN_OUTPUT_FOR_MODULE_STDLIB_ONLY,
  EXPECTED_JS_FILES_IN_OUTPUT_NO_COPY,
  EXPECTED_JS_FILES_IN_OUTPUT_WITH_ADDITIONAL_LIB_AND_DEFAULT_DIR,
  EXPECTED_JS_FILES_IN_OUTPUT_WITH_ADDITIONAL_LIB_AND_CUSTOM_DIR
are hard to distinguish in code and are not convenient to edit.

Original commit: 7881a305d9
2018-02-22 01:13:09 +03:00
Alexey Tsvetkov f1a78a7037 Fix IC test data
Test data was broken starting from 994fc1cc5e44322ed671e60530474781c35a7e7b

Original commit: 67a5cab343
2018-02-14 16:09:07 +03:00
Nikolay Krasko 45f3911ebc Update idea to 173.3.4 (173.4548.28)
Original commit: f05e926670
2018-02-03 00:15:45 +03:00
Alexey Tsvetkov 28a2d4727a Test JPS with Daemon and IC
Original commit: 220fab0d3f
2018-01-16 21:09:57 +03:00
Alexey Tsvetkov e5147e3000 Track changes in inline function when friend paths are disabled in JS
Original commit: d7edbb8dfc
2017-12-22 16:12:20 +03:00
Alexey Tsvetkov f3e8e3e591 Replace testCancelLongKotlinCompilation with less flaky test
Original commit: a4d122478b
2017-12-22 16:12:20 +03:00
Alexey Tsvetkov 2845ea857a Explicitly request rebuild when untracked java file is removed
Previously a rebuild was happenning because FileNotFoundException
was thrown when getting psiFile of removed file.

Original commit: ee94a64718
2017-12-22 16:12:20 +03:00
Alexey Tsvetkov 8683fce476 Turn off class redeclaration test for JS IC temporarily
So the tests could be run on TC.
Turn on after KT-19846 is fixed.

Original commit: 50bf74b909
2017-12-22 16:12:20 +03:00
Alexey Tsvetkov 09c1299c84 Recompile only files from last iteration after compile error
Original commit: 0fee7883ed
2017-12-22 16:12:20 +03:00
Alexey Tsvetkov 8e790fe091 Add JS specific IC build log in test
JS IC compares proto using a source file path as a key,
so moving file causes recompilation of its usages
unlike JVM IC that uses a class file path as a key.

Original commit: ff2e3ecfc4
2017-12-22 16:12:20 +03:00
Alexey Tsvetkov c58c65caea Fix IC test build log diverged from JPS
JPS marks dirty direct usages of removed classes since 172.* before a build.
Generic IC also marks dirty all subclasses and their usages.
That is necessary because a method from a removed class could be used
through a subclass.
JPS and generic IC logs diverged in 172 branch, but non-JPS tests
were not run on CI.

Original commit: 7712044146
2017-12-22 16:12:20 +03:00
Alexey Tsvetkov 084def4ffc Recompile all subclasses of removed classes
Original commit: a31f503fa5
2017-12-22 16:12:19 +03:00
Alexey Tsvetkov 090063b4d8 Compile actual and expected declarations together
#KT-20840 fixed

Original commit: fec2d08d22
2017-12-22 16:12:19 +03:00
Alexey Tsvetkov 453d38b0f7 Do not set api version to language version when language version is null
#KT-21852 fixed
    #KT-21574 fixed

Original commit: 3f082346ae
2017-12-18 16:22:07 +03:00
Denis Zharkov c3ea422125 Record special name lookup when trying use interface as a SAM
It was already working in JPS, because it see our synthetic classes
as subclasses for SAM's, but with non-JPS build we have to manually
tracking places that should be recompiled after SAM members are changed

Original commit: df533053f9
2017-12-12 16:17:58 +03:00
Denis Zharkov 30eec21d1d Refine dirty files computation in case of Java source changes
#KT-17621 In Progress

Original commit: ae6421476d
2017-12-12 16:17:58 +03:00
Nikolay Krasko 7769227cf6 Restore iml files for jps tests
Original commit: f46a8e0b16
2017-11-30 13:24:08 +03:00