Commit Graph

58991 Commits

Author SHA1 Message Date
Sergey Rostov a89ce4c590 BackgroundExecutor: cancel all tasks on user cancel, remove useless updateProgress call 2019-11-11 15:15:15 +03:00
Sergey Rostov 19d35d7f27 Implement Gradle specific behavior for script configuration update logic
We have plans to extract separate implementation for Gradle scripts, but it
would be better to support something at this point.
For now, we have custom listener, loader and up-to-date check for default configuration manager:
- listener will do forced reload on editor activation, even it is already up-to-date
this is required for Gradle scripts, since it's classpath may depend on other files (`.properties` for example)
- loader will force save failures before running loader. also it will skip loading if
`kotlin.gradle.scripts.useIdeaProjectImport` registry key is enabled
- loader will return inputs with overridden up-to-date checks: file will be considered
out-of-date only when `buildscript` or `plugins` blocks are changed
2019-11-11 15:15:15 +03:00
Natalia Selezneva 548e8e27dc Minor: rename parameter 2019-11-11 15:15:15 +03:00
Natalia Selezneva f0053ee34c Minor: use properties instead of string constants 2019-11-11 15:15:15 +03:00
Sergey Rostov 9d2cc484aa ide, scripting: rework script configuration caching, introduce persistent fs cache
## Simplify ScriptConfigurationManager mental model
Everything related to cache managing moved to `org.jetbrains.kotlin.idea.core.script.configuration`.
DefaultScriptConfigurationManager slitted into:
- `AbstractScriptConfigurationManager`
- `DefaultScriptConfigurationManager`
- `ScriptClassRootsCache`
The main idea is to simplify the mental model of ScriptConfigurationManager.
Concrete implementation should provide just two things:
- `createCache(): ScriptConfigurationCache` that should return cache implementation with `get` and `set` methods
- `reloadOutOfDateConfiguration(...)` will be called on [cache] miss or when [file] is changed.

Implementation should initiate loading of [file]'s script configuration and call [saveChangedConfiguration]
immediately or in some future (e.g. after user will click "apply context" or/and configuration will be
calculated by some background thread).
Everything around it is implemented in `AbstractScriptConfigurationManager`.

`ScriptClassRootsCache` is extracted from `DefaultScriptConfigurationManager`:
this simplifies `AbstractScriptConfigurationManager`
Also it simplifies ScriptClassRootsCache reset: we can just drop old `ScriptClassRootsCache`
and create new one instead of resetting all internals of `ScriptClassRootsCache`.
Please see KDoc of these classes for more details:
- AbstractScriptConfigurationManager
- DefaultScriptConfigurationManager
- ScriptClassRootsCache

## Cache and up-to-date checks
Writer should put related inputs snapshot for loaded configuration.
This allows reader make up-to-date check for existed entry to avoid starting loading
process for same inputs.
Cache entry may be marked out-of-date.
Also it can be marked up-to-date, but it means that we have up-to-date loaded configuration,
ScriptConfigurationSnapshot.configuration will still contain old applied configuration.
todo: make it more clear by splitting cache entry into loaded and applied configuration with
it's own inputs.

## Loaders
Previously both sync and background loaders may be started for same files - this was useful, but not
required anymore and at the same time greatly complicates the model. So, it was dropped
and now exactly one loader should work for given file (first applicable loader will be called).
Also `ScriptConfigurationLoadingContext` is introduced to limit access to the `ScriptConfigurationManager`
internals.

## Listeners and updating configuration
This things is introduces:
- `ScriptChangesNotifier`
- `ScriptChangeListener`
- `ScriptConfigurationUpdater`
`ScriptChangesNotifier` will call first applicable `ScriptChangeListener` when editor is activated or document changed.
(it treated as applicable if [editorActivated] or [documentChanged] will return true).
Listener may call [ScriptConfigurationUpdater] to invalidate configuration and schedule reloading.
Plugins may override default listening logic by adding it's oven `ScriptChangeListener`.
`ScriptConfigurationUpdater` was extracted from `ScriptConfigurationManagerImpl`.

## Fixed issues and implement persistent FS cache
- Script configuration was not reloaded if query for same file already in progress or ready but not yet applied
- Don't start async loaders for outsider files
- Unused imports: don't start loading script configuration if the result will be not applied automatically
- Fix cases when virtual file can be null

See `DefaultScriptConfigurationManager.reloadOutOfDateConfiguration` KDoc for more details on
dealing with concurrent operations.

## Background executor and progress indicator
This things changed and fixed:
- progress displayed not only when we have more then 3 loading tasks, but also
after 1sec of loading (including case with 1 loading task for example)
- current file is displayed under the progress bar
- progress indication added: it works similar to indexing indicator. When
progress bar is displayed, max is fixed. When all work done for this max,
progress will be started from zero and new max is fixed, and so on
- cancel will drop all loading operation, not just current
- concurrency issues fixed: EA-5244265 and other related to switching between silent and
under progress worker
See `BackgroundExecutor` for more details.

## Gradle specific behavior
We have plans to extract separate implementation for Gradle scripts, but it
would be better to support something at this point.
For now, we have custom listener, loader and up-to-date check for default configuration manager:
- listener will do forced reload on editor activation, even it is already up-to-date
this is required for Gradle scripts, since it's classpath may depend on other files (`.properties` for example)
- loader will force save fails before running loader. also it will skip loading if
`kotlin.gradle.scripts.useIdeaProjectImport` registry key is enabled
- loader will return inputs with overridden up-to-date checks: file will be considered
out-of-date only when `buildscript` or `plugins` blocks are changed
2019-11-11 15:15:15 +03:00
Natalia Selezneva 915c9c367c Minor: rename script related classes 2019-11-11 15:15:15 +03:00
Natalia Selezneva 33475f30bc Minor: move files 2019-11-11 15:15:15 +03:00
Sergey Rostov 9f3c2d0292 build.gradle.kts: import script dependencies on Gradle Project sync 2019-11-11 15:15:14 +03:00
Alexander Udalov de54e549af Refactor CHECK_BYTECODE_LISTING directive for JVM IR tests
Create a separate _ir.txt bytecode listing file for JVM IR, to avoid
duplicate tests and to fix "Codegent tests on different JDKs"
configuration where this test is muted but passes because only execution
is checked there, not bytecode listing.
2019-11-11 12:10:31 +01:00
Alexander Udalov ce09be3f59 Add TargetBackend.isIR, simplify JVM IR test configuration 2019-11-11 12:10:29 +01:00
Vladimir Ilmov ab65a6bc6c Build fix, tests regenerated 2019-11-11 12:34:58 +03:00
Sergey Bogolepov 608885d118 [Linker] Extend KotlinIrLinker infrastructure to support libraries that
doesn't contain IR. Also bump ABI version because of addition of `ir_provider` property
2019-11-11 15:55:36 +07:00
Kirill Shmakov 5629627cca Mobile MPP: Initialize Mobile MPP plugin 2019-11-11 11:20:37 +03:00
Yan Zhulanow f3770314c5 Pill: Fix reflect dependency in compiler/fir.resolve module 2019-11-11 17:13:58 +09:00
Yan Zhulanow ef8b3cb72a Prefer Kotlin Junit test run configurations when possible (KT-33787) 2019-11-11 17:13:58 +09:00
Yan Zhulanow 987307cf92 Prefer Kotlin Gradle test run configurations when possible (KT-33787) 2019-11-11 17:13:58 +09:00
Vladimir Ilmov 214810ca01 Suspend test removed. Will be added later as part of appropriate ticket. 2019-11-11 00:57:52 +03:00
Dmitriy Novozhilov 0c190f6040 Enable -Xuse-mixed-named-arguments feature for compiler project 2019-11-10 11:46:22 +03:00
Dmitriy Novozhilov be4ae5d7ba Upgrade kotlin version in gradle configuration testdata 2019-11-10 11:46:22 +03:00
Dmitriy Novozhilov d485ea44e8 Update bootstrap version 2019-11-10 11:45:59 +03:00
Vadim Brilyantov ba77e5eba8 #KT-29622: Fix bunches for 191 and earlier idea versions 2019-11-09 16:44:12 +03:00
Vadim Brilyantov 66eeeb4705 Add Focus Mode support to kotlin language 2019-11-09 16:44:10 +03:00
Alexander Udalov f7ef16d2d5 Regenerate tests
This fixes project compilation after incorrect merge of
da4097f4/e89a87b2 and 4ed64b02
2019-11-09 00:42:10 +01:00
Alexander Udalov f9b66d57cf Fix test data for -Xuse-mixed-named-arguments
Remove incorrect jar clash warning and avoid unrelated unused parameter
warnings
2019-11-08 20:52:22 +01:00
Alexander Udalov 228fdb4436 Don't optimize null checks for unsafe primitive type boxes as well
#KT-34829 Fixed
2019-11-08 18:54:33 +01:00
Steven Schäfer b80e157381 JVM, JVM IR: Don't optimize null-checks based on nullability information
Since Java interop allows us to circumvent the Kotlin type system we
cannot rely on nullability information.
2019-11-08 18:28:07 +01:00
Alexander Udalov de082543f1 Minor, ignore another test with java.util.function on JDK 6 2019-11-08 17:50:10 +01:00
Alexander Udalov 9b3e64257f Minor, ignore test with java.util.function on JDK 6 2019-11-08 17:46:43 +01:00
Roman Golyshev e89a87b2e3 KT-29926: Support completion of suspend lambda body and parameters
- ^KT-29926 Fixed
2019-11-08 19:24:05 +03:00
Roman Golyshev da4097f488 KT-29926: Support completion of suspend lambda parameters in the body
- `suspendLambdaSignature` directory is just a copy of `lambdaSignature`
2019-11-08 19:24:05 +03:00
Roman Golyshev 84b9044187 KT-29926: Get rid of filterFunctionExpected
- `filterFunctionExpected` does not provide meaningful concept, and will be a problem in the next steps on this issue.
- Refactor `SmartCompletionSession::descriptorKindFilter` to more precisely tell why we include references to constructors if we are completion functions
2019-11-08 19:24:05 +03:00
Vladimir Ilmov e2b91cfec7 Properties with custom property declarations highlighting rule.
Added support for package and class-level properties with custom PD.
Java syntethic extensions are ignored from this rule.

 #KT-30806 Fixed
2019-11-08 17:58:49 +03:00
Dmitriy Dolovov bf37572b93 Offload heavy part of KotlinNativeABICompatibilityChecker to non-EDT thread pool
Issue #KT-34814
2019-11-08 17:12:57 +03:00
Dmitriy Dolovov d97aeb9fe0 Build KotlinNativeABICompatibilityChecker notifications in a separate function
Issue #KT-34814
2019-11-08 17:12:52 +03:00
Nikolay Krasko 526e7e463b Mute flaky failure in KotlinGotoImplementationMultiModuleTestGenerated in 193 2019-11-08 16:34:20 +03:00
Nikolay Krasko ce1e57d798 Mute IdeReplCompletionTestGenerated tests in 193 (KT-34825) 2019-11-08 16:34:19 +03:00
Mikhail Glukhikh 93aba85f51 Fix FIR built-ins test 2019-11-08 15:54:21 +03:00
Dmitriy Novozhilov 5313c964c6 [FIR] Fix SOF in fir consistency checker 2019-11-08 15:30:55 +03:00
Dmitriy Novozhilov bc453e5917 [FIR] Fix testdata forgotten in e910653d 2019-11-08 15:30:55 +03:00
Dmitriy Novozhilov e6b005a7dc Disable -Xuse-mixed-named-arguments feature for compiler project 2019-11-08 15:30:50 +03:00
Dmitriy Novozhilov 45523a5767 Fix -Xuse-mixed-named-arguments compiler arg 2019-11-08 15:30:04 +03:00
Kristoffer Andersen 8561f08f06 [JVM_IR] Reintroduce non-IEEE comparisons
- Ieee754Equality and PrimitiveComparisons intrinsics
  respects absence of -Xproper-ieee754-comparisons, unmuted tests to
  show.
2019-11-08 12:58:31 +01:00
Alexander Udalov 0675b54e11 Minor, add regression test for KT-34766 2019-11-08 12:29:08 +01:00
Roman Artemev ea543eac13 [IC KLIB] Fix after rebase 2019-11-08 14:14:59 +03:00
Roman Artemev 3e3cb8734b [IC] Unmute IC klib tests 2019-11-08 14:14:59 +03:00
Roman Artemev b11d69b719 [IC] Temporary restore removed method to fix proto comparison tests 2019-11-08 14:14:59 +03:00
Roman Artemev a91ed694bf [IC KLIB] Use new klib argument 2019-11-08 14:14:59 +03:00
Alexey Tsvetkov eb5e954e2a Minor: adjust formatting 2019-11-08 14:14:58 +03:00
Alexey Tsvetkov d776e92111 Use Klib JS serializer protocol for IC 2019-11-08 14:14:58 +03:00
Alexey Tsvetkov 6e9cd85b54 Exclude some proto messages from proto comparison in IC 2019-11-08 14:14:58 +03:00