Compare commits

..

660 Commits

Author SHA1 Message Date
Lilia
8f668bcbbe Add changelog for 1.4.10 2020-09-04 15:26:08 +03:00
Stanislav Erokhin
d8d783181b Update Kotlin/Native: 1.4.10 2020-09-03 19:35:46 +03:00
Leonid Startsev
28535aa625 Use correct return type for constructor call when creating EnumDescriptor
Previous one was converted using obsolete API, which caused unbound symbols to appear.

#KT-41321 Fixed

(cherry picked from commit c881347110)
2020-09-03 12:39:49 +03:00
Nikolay Krasko
303902401f Register additional repository id
(cherry picked from commit d8b76f5b26)
2020-09-02 20:18:47 +03:00
Sergey Bogolepov
a0197d9e2f Update Kotlin/Native: 1.4.10-rc1-19 2020-09-02 21:31:33 +07:00
Sergey Bogolepov
2cb77fd40c Update Kotlin/Native: 1.4.10-rc1-16 2020-09-02 17:16:06 +07:00
Ivan Gavrilovic
f1e2def771 KT-41313: Only load .jar files when locating annotation processors
Previously, we'd only check if file exists and try to load it. However,
some compile classpaths may contain .tar.gz files.

Test: ProcessorLoaderTest
(cherry picked from commit 91b99da7a0)
2020-09-02 00:54:32 +09:00
Pavel Kirpichenkov
fdb5b27f6b [NI] Fix resolution status for UnstableSmartCastDiagnostic
RESOLVED_WITH_ERROR was initially added for reproducing OI behavior.
The intention was to preserve resolution into unstable smart cast and to keep failing candidate.
However, this idea was abandoned after OI behavior proved inconsistent in cases involving generics.

This commit restores RUNTIME_ERROR status of UnstableSmartCastDiagnostic.

^KT-41357 Fixed
2020-09-01 18:23:23 +03:00
Nikolay Krasko
0c5be1f820 as42: Additional fixes for AS42 and 202 platform 2020-09-01 17:43:31 +03:00
Nikolay Krasko
32e21cf7a0 as42: Apply 201 <-> AS41 diff 2020-09-01 17:43:31 +03:00
Nikolay Krasko
1c3af648f5 Introduce AS42 bunch 2020-09-01 17:43:31 +03:00
Mikhail Zarechenskiy
8aebba1d27 Reuse revised variables during lambda analysis against type variables
#KT-41400 Fixed
2020-09-01 15:56:03 +03:00
Sergey Bogolepov
5f37f9b065 Update Kotlin/Native: 1.4.10-rc1-12 2020-09-01 19:00:27 +07:00
Pavel Kirpichenkov
7147340779 [FIR-TEST] Fix diagnostic test data
Update due to different FIR behavior in release branch
^KT-41386
2020-09-01 10:49:35 +03:00
Pavel Kirpichenkov
fbcb4384db [NI] Use new type substitutor for known type parameters
Use known type parameters substitutor after substitutor for fresh variables.
The old logic of substituions had the following order:
- replace known type parameters
- replace type parameters with type variables
- complete inference
- replace type variables with inferred types

According to the updated logic, replacement goes as follows:
- replace type parameters with type variables
- replace known type parameters; if they were variables, this will effectively remove them from inference
- complete inference
- replace remaining type variables with inferred types

Support projection substitution in new type substitutor.
It is needed for correct interaction with old type substitutor.
Old type substitutors can contain mappings constructor -> projection
which couldn't be expressed correctly with existing substitutor API in some cases.

^KT-41386 Fixed
2020-09-01 10:49:35 +03:00
Ilya Kirillov
63a50dc1d5 Wizard: use compileKotlin for groovy instead of direct KotlinCompile task access
#KT-38921 fixed

(cherry picked from commit fa847d758d)
2020-08-31 23:13:22 +03:00
Sergey Igushkin
0c403f7303 Fix transitive deps on MPP with host-specific source sets (KT-41083)
A consumer could not resolve the host-specific metadata artifact
of the transitive dependency because the transitive dependency's parent
in the platform dependencies graph did not include the dependency on it
in the variant that is chosen for host-specific source sets metadata:
the dependencies of that variant were empty.

Export the dependencies of the Kotlin/Native target in the host-specific
metadata variant as well.

Issue #KT-41083 Fixed

(cherry picked from commit 5c88eb722d)
2020-08-31 22:17:40 +04:00
Ilya Gorbunov
ff5ef4651b Export kotlin.test packages with annotations and underlying frameworks
- Add exports for jvm package names used in kotlin.test annotations;

- Export transitively underlying test framework modules
Otherwise "This class does not have a constructor" happens when using
an aliased annotation, e.g. kotlin.test.Test aliased to org.junit.test

KT-41320

(cherry picked from commit 9c3ff6828a)
2020-08-31 19:52:20 +03:00
Igor Yakovlev
9e179141f0 [ULC] Add recursion guard to getLightClass
Fixed KT-41325
2020-08-31 19:27:19 +03:00
Igor Yakovlev
239996c2a5 Fix SOE on library source based lightclass lookup
Fixed KT-41325
2020-08-31 19:26:45 +03:00
Ilya Gorbunov
e63a8417ea Pack jvm builtins into kotlin-stdlib shipped with idea plugin
This lessens the possibility that kotlin plugin will get different
variants of builtins in the classpath, thus making builtins resources
loading less order-dependent.
2020-08-31 15:19:45 +03:00
Alexander Udalov
82a34a3cc5 Add a fallback flag -Xno-unified-null-checks for KT-22275
#KT-41482 Fixed

(cherry picked from commit 5e48be3d11)
2020-08-31 13:05:02 +02:00
Vladimir Ilmov
86b544a2a7 (CoroutineDebugger) Disable agent for MPP projects
#KT-39412 fixed
2020-08-31 11:22:41 +02:00
Vladimir Ilmov
4a49038845 (CoroutineDebugger) Top node added to prevent dumpCoroutine() call
Panel gather information from the agent on each breakpoint hit.
2020-08-31 11:22:41 +02:00
Vladimir Ilmov
9dfc305999 (CoroutineDebugger) embed agent into gradle JavaExec task
#KT-40417 fixed
2020-08-31 11:22:41 +02:00
Mikhail Zarechenskiy
9b8e76b561 Use initial system for completion if common one is effectively empty
Otherwise we can get unsubstituted type variables as expected types and
 then write wrong information for assertions

 #KT-41470 Fixed
2020-08-28 21:05:29 +03:00
Roman Artemev
431b5b61aa [KLIB] Fix SOE in K/N
- fixes KT-41324
2020-08-28 20:20:32 +03:00
Zalim Bashorov
273eb53d47 [JS BE] Support passing an array as argument of vararg in named form
#KT-38059 fixed

(cherry picked from commit 9097d0918c)
2020-08-28 19:14:17 +03:00
Zalim Bashorov
779e7bb90e [JS IR] Don't generate "import" statements for external interfaces
#KT-40964 fixed

(cherry picked from commit 606232a584)
2020-08-28 19:14:17 +03:00
Zalim Bashorov
94b1e1ecd2 [JS IR] Support nativeGetter, nativeSetter and nativeInvoke
#KT-41081 fixed

(cherry picked from commit ba846830c9)
2020-08-28 19:14:17 +03:00
Mikhail Zarechenskiy
daea32664c Regenerate tests 2020-08-28 17:51:50 +03:00
Mikhail Zarechenskiy
cf9921dd77 Take into account captured types with variables during fixation
#KT-41202 Fixed

(cherry picked from commit cba13c3c35)
2020-08-28 17:51:48 +03:00
Mikhail Zarechenskiy
7a8660fb37 Fix SOE when recursive type argument is used with star projection
#KT-41043 Fixed

(cherry picked from commit 06a592c018)
2020-08-28 17:51:47 +03:00
Mikhail Zarechenskiy
61d12d931d Fold lower constraints like (T!!..T) and (T..T?) into the latter one
#KT-41149 Fixed

(cherry picked from commit 674e9e455f)
2020-08-28 17:51:47 +03:00
Mikhail Zarechenskiy
f3d9588e99 Don't perform unnecessary SAM conversions
#KT-41149 In Progress

(cherry picked from commit e91b378b7d)
2020-08-28 17:51:46 +03:00
Mikhail Zarechenskiy
9d5dbf0e35 Consider T <: Nothing! as trivial during constraint incorporation
#KT-41149 In Progress

(cherry picked from commit 6a7ed96be5)
2020-08-28 17:51:46 +03:00
Mikhail Zarechenskiy
203c13c91e Fix OOM when there are several lambdas with extension function types
#KT-41335 Fixed

(cherry picked from commit 567e6ca9ca)
2020-08-28 17:51:46 +03:00
Mikhail Zarechenskiy
c8068625c2 Fix unresolved reference to catch parameter from lambda expression
#KT-41140 Fixed

(cherry picked from commit 6ed13ef1b6)
2020-08-28 17:51:46 +03:00
Mikhail Zarechenskiy
1bf83da70f Fix delegated property resolve when provideDelegate has this as argument
#KT-41135 Fixed

(cherry picked from commit f2fba8a469)
2020-08-28 17:51:45 +03:00
Mikhail Zarechenskiy
a6b5fb38ac Do not force coercion to Unit for nullable lambda return type
#KT-41005 Fixed

(cherry picked from commit aafe41cf7a)
2020-08-28 17:51:44 +03:00
Alexander Udalov
b9f2433e55 Do not generate non-standard compareTo as primitive comparison in all backends
Previous changes related to this in the old JVM backend were in
582b1c5e66 and
0482f7e9c5, but they did not affect the
`ProperIeee754Comparisons` mode which became the default in 1.4.0. As a
result, we had a regression here.

Since the `PRIMITIVE_NUMERIC_COMPARISON_INFO` slice is used in psi2ir to
determine how to generate the comparison, this fixes the regression both
in the old JVM backend, and in all IR backends.

 #KT-41426 Fixed

(cherry picked from commit 74c6d2b951)
2020-08-28 14:25:06 +02:00
Dmitriy Novozhilov
0b54bf9540 [NI] Properly detecting suitability of candidate for builder inference
#KT-41430 Fixed
2020-08-28 13:10:57 +03:00
Dmitriy Novozhilov
d5cfa2c440 [NI] Fix shouldRunCompletion for builder inference session
#KT-41308 Fixed
#KT-41363
2020-08-28 13:10:57 +03:00
Dmitriy Novozhilov
99bfb5558d [NI] Don't always complete builder inference lambda in FULL mode
#KT-41164 Fixed
2020-08-28 13:10:56 +03:00
Dmitry Savvinov
806012dd77 Wire KotlinTypeRefiner in areCallableDescriptorsEquivalent
See the issue for details

^KT-41218 Fixed
2020-08-28 11:56:50 +03:00
Dmitry Savvinov
b7e233d92f Add test for overload resoultion ambiguity in HMPP
The behaviour is undesired, see the next commit for fix

^KT-41218 In Progress
2020-08-28 11:56:45 +03:00
Dmitry Gridin
83c1616f79 [formatter] fix performance issue
^KT-41314 Fixed

(cherry picked from commit 0c0b394cc2)
2020-08-27 19:04:27 +07:00
Dmitry Gridin
8eac2dfb8a [inspections] NamingConversion: add missing space in description
^KT-41395 Fixed

(cherry picked from commit 5dbb6fdf50)
2020-08-27 17:25:12 +07:00
Vladimir Dolzhenko
3c846b4c85 Pick up script language level from used stdlib in a gradle's classpath
^KT-41283 Fixed

(cherry picked from commit 54d3c5fb0a)
2020-08-26 20:58:56 +02:00
Vladimir Dolzhenko
ffda5ef648 Fix Typo: equals() & hashCode(), toString() are written with the first uppercase letter
^KT-41390 Fixed

(cherry picked from commit 99924ea5e4)
2020-08-26 20:56:31 +02:00
Ilya Matveev
77ca0d3890 Tests, Gradle: Fix broken test for KT-40834
(cherry picked from commit 30d24ed943)
2020-08-26 12:50:16 +07:00
Ilya Matveev
117fb8f309 CocoaPods: Skip synthetic task on non-mac hosts
This patch performs the following changes:

1. Create synthetic tasks even if synthetic projects are
not supported on the current host. This change simplifies
configuring dependencies between these tasks and custom user
tasks at the user side.

2. Disable synthetic tasks if synthetic projects are not supported
on the current host

Issue #KT-40834 Fixed

(cherry picked from commit ce02982226)
2020-08-26 12:49:26 +07:00
Sergey Igushkin
e5b0bf0ea2 Add a link to docs in MPP stability warning; add a flag that hides it
(cherry picked from commit 413d02621b)
2020-08-26 03:01:01 +04:00
Ilya Chernikov
356c5b4639 Build: Remove exclusion of kotlinx-coroutines-core in scripting-compiler
The previous fix was insufficient to fix gradle substitution in MPP
projects (https://github.com/gradle/gradle/issues/14017)
2020-08-25 11:39:58 +02:00
Alexander Udalov
782778b6c5 Fix loading of builtins resources in kotlin-reflect in Java modular mode
The main change here is that when kotlin-reflect is being run under Java
9+, we use another implementation of BuiltInsResourceLoader (see
libraries/reflect/api/src/java9) which loads .kotlin_builtins files from
the java.lang.Module instance of kotlin-stdlib, instead of the class
loader of kotlin-reflect, which may not have access to those resources.

If the application is being run in the old (classpath) mode, that Module
represents the unnamed module, which contains everything on the
classpath, and everything works as before. But if it's being run in the
modular mode, that Module instance is an encapsulated module for
kotlin-stdlib classes and resources, exactly where .kotlin_builtins
files are located.

This fixes a regression in 1.4.0. Prior to 1.4, kotlin-reflect and
kotlin-stdlib were not named modules (see KT-21266) and were loaded as
_automatic_ modules even if the application was run in the modular mode.
Apparently, they shared the same class loader in that case and looking
up .kotlin_builtins resources worked.

This change was supposed to go alongside
828cc6dbf3, but was overlooked because
adding module-info to standard libraries was postponed at that point.

Also slightly refactor Java9ModulesIntegrationTest to simplify running
compiled code, and add a smoke test on using kotlin-reflect in modular
mode.

 #KT-40842 Fixed

(cherry picked from commit b10cc6657e)
2020-08-24 18:32:12 +02:00
Dmitry Petrov
98d5f566d0 JVM KT-41150: Fix backward compatibility for inline vals in inline class
In 1.3.x, for inline class member inline vals 'getFoo-impl' method was
generated in corresponding inline class.
Since 1.4.0, getters for properties returning inline class values are
mangled (so corresponding getters are named 'getFoo-<mangling_hash>'.
However, to maintain backward compatibility with libraries compiled with
1.3.x, inliner should be able to find 'getFoo-impl' method in the
bytecode.

(cherry picked from commit a2dabe11c5)
2020-08-24 17:43:13 +03:00
Dmitry Gridin
1e361c71be [inspections] disable "Redundant inner modifier" inspection
^KT-41264 Fixed

(cherry picked from commit 5f584691a6)
2020-08-21 15:10:27 +07:00
Anton Yalyshev
9dc7279bb9 Fix a broken hyperlink to Whatsnew at the plugin change-notes 2020-08-19 19:16:03 +03:00
Ilya Chernikov
1ec40cd40c Set correct base classloader for REPL evaluation
the contributed partial fix of KT-35925 set it to the system classloader
which brought in many cases the compiler CP into the evaluation and lead
to the problems like KT-40898. This fix set it to the extension/platform
classloader, which preserves (partial) fix of the KT-35925 and do not
bring the compiler jar into the REPL evaluation classpath.

#KT-40898 fixed
2020-08-19 16:31:10 +02:00
Stanislav Erokhin
a7e5ae878f Mute tests in csv 2020-08-19 11:57:48 +03:00
Ilya Goncharov
4dbf2656f6 [Gradle, JS] Fix public package json test 2020-08-19 11:57:48 +03:00
Stanislav Erokhin
3812753419 Fix testdata
Update test data, unmute test
 Now behavior is the same as in OI for these cases.
 The behavior was changed in 100a6f70ca
(cherry picked from commit a6e58edfb9)

Fix test data about `JsExport`
 It allows only for top-level declarations, plus JsName is needed to
 avoid error about method redeclaration
(cherry picked from commit 01f2b0e26b)

Update test data: add correct error
(cherry picked from commit a0ecfce7b7)

Minor. Update tests
(cherry picked from commit 4d21a496fe)
2020-08-19 11:57:48 +03:00
Leonid Startsev
3cf6eb1653 Update serialization runtime and fix test data
Revert "Mute/ignore 'PROVIDED_RUNTIME_TOO_LOW' in tests"

(cherry picked from commit 96d0b1c47a)
2020-08-19 11:57:48 +03:00
Nikolay Krasko
0ddb7937ee Use GPG agent for signing in PublishedKotlinModule 2020-08-13 11:42:57 +03:00
Nikolay Krasko
60340bd559 Sign with GnuPG agent 2020-08-13 09:44:39 +03:00
Stanislav Erokhin
923742ee83 Update Kotlin/Native: 1.4 2020-08-12 19:28:52 +03:00
Lilia
3e9162f5f0 Fixed changelog for 1.4.0-rc 2020-08-12 16:49:47 +02:00
Lilia
3115e5b332 Add changelog for 1.4.0 2020-08-12 16:48:24 +02:00
Anton Yalyshev
df2d14040f Add change-notes for 1.4 to 1.4.0 branch 2020-08-12 16:44:17 +03:00
Nikolay Krasko
3f34bc1711 Temporal remove of registerAdditionalResourceBundleInTests hack in as 41 2020-08-12 10:49:24 +03:00
Nikolay Krasko
034b947748 Update maven signing for working with gpg 2 (KTI-314)
Update to maven-gpg-plugin 1.6 and add workaround for https://issues.apache.org/jira/browse/MGPG-59
2020-08-12 09:35:58 +03:00
Sergey Bogolepov
cd005cd919 Update Kotlin/Native: 1.4-rc1-74 2020-08-11 18:29:27 +07:00
Alexey Trilis
d25b099029 Add @SinceKotlin to kotlinx.browser and kotlinx.dom packages
Add @DeprecatedSinceKotlin to kotlin.browser and kotlin.dom packages

(cherry picked from commit d86c14243e)
2020-08-11 12:28:52 +03:00
Ilya Kirillov
74c8d74166 Wizard: fix test data after gradle js support change 2020-08-11 11:16:35 +03:00
Ilya Kirillov
11cee19500 Wizard: update libraries versions 2020-08-11 11:16:34 +03:00
Vyacheslav Gerasimov
e578dc07b9 Build: Remove exclusion of kotlinx-coroutines-core in scripting-common
It breaks available-at feature used in MPP
2020-08-11 10:33:47 +03:00
Mikhail Zarechenskiy
0a755c13af Prohibit using suspend functions as SAM in fun interfaces
#KT-40978 Fixed
2020-08-10 22:12:03 +03:00
Mikhael Bogdanov
425e6db61c Don't generate implicit overrides delegating to Java defaults
#KT-40920 Fixed
2020-08-10 20:06:09 +02:00
Sergey Igushkin
7bdd2785c6 Fix stdlib-by-default with non-compiled source sets (KT-40559)
When a `variantFilter { ... }` is used in Android projects, AGP does not
creates some variants but still creates the source sets which would be
related to those variants.

For source sets that are not included into any compilation, the stdlib
module added by default was kotlin-stdlib-common, and it was added to
the `api` scope.

But AGP checks the `androidTest*Api` configurations and
if it detects any dependencies in them, it reports deprecation warnings.

However, we have plans to prohibit unused source sets at all as they
have no reasonable use cases. So the fix is not to add the stdlib by
default to source sets that participate in no compilations.

Issue #KT-40559 Fixed

(cherry picked from commit 07aee8831e)
2020-08-10 21:54:02 +04:00
Sergey Igushkin
e99b55ef12 Fix source JARs missing in Kotlin/Native targets with HMPP (KT-39051)
With HMPP, a separate implementation of `kotlinComponents` is used which
accidentally ignored the parent's logic for source artifacts.

As a simple fix, copy the parent's logic for source artifacts.

Issue #KT-39051 Fixed

(cherry picked from commit 988480d649)
2020-08-10 21:54:00 +04:00
Valeriy.Vyrva
c6500792b3 Improve docs for createTempDir/createTempFile
#KT-35218

(cherry picked from commit 30ff886754)
2020-08-10 19:11:55 +03:00
Ilya Gorbunov
381e0acf80 Minor: fix toJavaDuration docs
(cherry picked from commit a5178bb826)
2020-08-10 19:11:16 +03:00
Ilya Gorbunov
76f9ed96bc Fix doc wording around covariance/invariance
(cherry picked from commit 99eb7f391b)
2020-08-10 19:11:14 +03:00
Dmitriy Novozhilov
5f83c23859 Disable AllowResultInReturnType feature
#KT-40843
2020-08-10 17:56:48 +03:00
Julian Kotrba
f7f249f19a Make repeat example more expressive
This commit adds the zero-based index of current iteration from the passed HOF "action" of the repeat function to its associated code sample.

KT-20357

(cherry picked from commit 88f508446a)
2020-08-10 16:59:15 +03:00
kvirolainen
36e9a00178 Add samples for flatten, unzip functions
(cherry picked from commit 36984009e9)
2020-08-10 16:58:39 +03:00
Elijah Verdoorn
4d269ea7da Add samples for mapNotNull, find, getOrNull functions
(cherry picked from commit 41d5615608)
2020-08-10 16:58:37 +03:00
Dat Trieu
ba0e47cdf6 KT-20357: Add samples for filter functions
(cherry picked from commit 1009a240f2)
2020-08-10 16:58:22 +03:00
Yan Zhulanow
9147d0d3f6 Move back the 'KotlinStructureViewElement.isPublic' property used externally
Reasoning: Method com.gmail.blueboxware.extsee.kotlin.ExtSeeKotlinStructureViewModel.Companion.PublicElementsFilter.isVisible(com.intellij.ide.util.treeView.smartTree.TreeElement treeNode) : boolean contains an *invokevirtual* instruction referencing an unresolved method org.jetbrains.kotlin.idea.structureView.KotlinStructureViewElement.isPublic()
(cherry picked from commit 5e8e60a399)
2020-08-10 18:20:48 +09:00
Natalia Selezneva
5cf27cdcae Do not hold a lock during loading script templates from dependencies
^KT-40383 Fixed

(cherry picked from commit 8a6cdcba29)
2020-08-07 21:53:22 +02:00
Vladimir Dolzhenko
42bbf1b3f5 Fixed locking granularity in ScriptDefinitionsManager
#KT-34552 Fixed
#KT-39547 Fixed

(cherry picked from commit 45600830d3)
2020-08-07 21:53:22 +02:00
Mikhail Zarechenskiy
368846838b Fix accessibility check for experimental declarations from default scope
#KT-40919 Fixed
2020-08-07 19:13:18 +03:00
Ilmir Usmanov
b6d740b760 Ease field initialization check
Since there is already VAL_REASSIGNMENT diagnostics, we can safely only
for direct assignments.
 #KT-40893 Fixed
2020-08-07 14:38:55 +02:00
Sergey Igushkin
ff6da9b85c Fix typealias usage nullability and annotations lost in deserialization
Issue #KT-40824 Fixed

(cherry picked from commit f6356199d3)
2020-08-07 12:09:46 +04:00
Ilya Goncharov
22507b7f6c [Gradle, JS] Update versions
[Gradle, JS] Update test data

^KT-40884 fixed
2020-08-06 15:28:18 +03:00
Sergey Igushkin
18d1e92c61 Enable compatibility metadata variant by default in HMPP
This by default ensures that libraries published with HMPP are
compatible with non-HMPP consumers (which is the default in 1.4.0).

(cherry picked from commit b5d4e4c44c)
2020-08-06 15:43:18 +04:00
Sergey Igushkin
045cfb3ba7 "Kotlin Multiplatform Projects are an ~experimental~ Alpha feature."
(cherry picked from commit eff5839369)
2020-08-06 15:43:10 +04:00
Mikhail Zarechenskiy
70823f30ec Do not compute SamType too eagerly as it can force member resolution
Internally, during creation of `SamType` the compiler checks if a
 parameter is really can be used as a SAM, so this check involves
 lookup for abstract members, which can force additional computation of
 member scopes. This is totally fine for BE but it can be dangerous
 for light classes computation when not all scopes are processed.

 Note that this issue appeared quite recently after 16f175612e

 #KT-40869 Fixed
2020-08-06 12:23:22 +03:00
Ilya Matveev
386a2ea62c CocoaPods: Fix setting custom framework name
The main scheme of a synthetic project generated for
pod import has the same name as the podspec generated
for the kotlin module (== Gradle project name). But
when starting an Xcode build, we specify the -scheme
argument to a framework name instead of project.name.

By default they are the same, but if a custom framework
name is specified, xcodebuild fails.

Issue #KT-40801 fixed

(cherry picked from commit f6d7e7c52a)
2020-08-05 17:19:00 +07:00
Mikhail Zarechenskiy
c45f2f0510 Add compatibility resolve when SAM conversion was applied partially
#KT-40646 Fixed
2020-08-05 12:58:54 +03:00
Victor Petukhov
0491719503 NI: approximate not top-level captured types during code generation
^KT-40693 Fixed
2020-08-05 10:37:28 +03:00
Roman Artemev
f17617d601 [KLIB] Use SoftReference to hold proto memory
- fix metadata memory leak for KT-40345

(cherry picked from commit 851c287105)
2020-08-04 19:13:58 +03:00
Roman Artemev
c42aa572a8 [KLIB] Change KLIB IO API
- Use ReadBuffer instead of native java buffer
 - Use Weak buffers for File IO
 - fix klib memory leak for KT-40345

(cherry picked from commit add0ad6733)
2020-08-04 19:13:58 +03:00
Victor Petukhov
c5b1b7bbce NI: take into account flexible types during capturing arguments from expression
^KT-40544 Fixed

(cherry picked from commit af48f08f9c)
2020-08-04 17:02:12 +03:00
Ilya Kirillov
78e1b58bcb Fix binary compatibility problems in ImportInsertHelper & ShortenReferences 2020-08-04 12:39:55 +03:00
Dmitry Gridin
05d465c522 [configuration] change updater number to 1.4.* and 1.5.*
#KT-40639 Fixed

(cherry picked from commit a5e9401a0a)
2020-08-04 13:45:28 +07:00
Sergey Bogolepov
c5280b6f9d Update Kotlin/Native: 1.4-rc1-61 2020-08-03 20:33:00 +07:00
Nicolay Mitropolsky
8fe31582e1 Uast: don't throw exception if can't get a receiver parameter for annotation (KT-40494)
(cherry picked from commit f7031e65ba)
2020-08-03 10:52:36 +03:00
Dmitry Gridin
cc9bd1ad8c [formatter] fix infinite recursion
Already exists in the new repo: original-hash e7ea6926a8a414ab6082299d99239ad167ab75a2

#KT-40636 Fixed

(cherry picked from commit e8fd69fde1)
2020-08-03 09:27:59 +07:00
Ilya Chernikov
8584f85692 Add JvmDefault to the new EP method for compatibility with older impls 2020-07-31 11:45:46 +02:00
Ilmir Usmanov
5576f34b93 Check whether the field is indeed being initialized
in checkFieldInExactlyOnceLambdaInitialization
 #KT-40691 Fixed
2020-07-31 11:19:45 +02:00
Denis Zharkov
c2a5111d89 Fix incorrect mixed named/positioned arguments in project code
^KT-40404 Fixed
2020-07-30 17:59:31 +03:00
Denis Zharkov
86b8135ca2 Fix incorrect handling of mixed named/positional arguments
^KT-40404 Fixed
2020-07-30 17:59:31 +03:00
nataliya.valtman
df10fce902 KT-40058 NPE from mpp gradle plugin on kotlinx.benchmarks
(cherry picked from commit fde8a34c32)
2020-07-30 14:41:28 +03:00
Alexander Gorshenev
fb178115ed Don't copy default value parameters for fake overrides
#KT-40083 fixed
2020-07-30 13:04:41 +03:00
Ilya Kirillov
4371d2f197 Wizard: fix default template compilation when using JS IR
#KT-39904 fixed
2020-07-30 12:25:29 +03:00
Roman Artemev
2d9bd91a5d [JS IR] Support external delegation in case of JS in psi2ir
- fix FE delegation resolver
 - fix critical KT-40650

(cherry picked from commit 0559e192ee)
2020-07-29 19:59:36 +03:00
Sergey Rostov
05c4d16dee scripting: preload scripting support plugins
Relates to #KT-40242
(cherry picked from commit 45f0328f21)
2020-07-29 15:06:22 +02:00
Sergey Rostov
cbcb33421c scripting, ucache: don't init caches at start up
init it in async instead. all usages will be updated thanks to
highlighting/reindexing that is called after cache is constructed.

#KT-40242 Fixed

(cherry picked from commit b5e04378ed)
2020-07-29 15:06:21 +02:00
Nikolay Krasko
1ce3ff18eb Remove all signing if prebuiltJar passed
Otherwise can't configure kotlin-stdlib-js project when publishing to
Gradle Plugin Portal.
2020-07-29 16:00:06 +03:00
Ilya Goncharov
bfd4eac01b [Gradle, JS] Fix formatting in Gradle Kotlin/JS wizard
^KT-40149 fixed

(cherry picked from commit b4334a3a3b)
2020-07-29 15:20:44 +03:00
Ilya Goncharov
2e4ce37b1e [Gradle, JS] Deprecate produceExecutable
^KT-40568 fixed

(cherry picked from commit 5444ffaf4b)
2020-07-29 15:20:44 +03:00
Ilya Goncharov
0eb85c69a4 [Gradle, JS] Disable binaries.executable by default in wizard
^KT-40461 fixed
2020-07-29 15:20:42 +03:00
Victor Petukhov
69172c053e NI: use the inferred type to check of nullable array for vararg
^KT-40555 Fixed

(cherry picked from commit cca64b8fab)
2020-07-29 13:38:47 +03:00
Vladimir Ilmov
bfb0660683 (CoroutineDebugger) Enable agent for versions 1.3.8.*
Gradle artifact name gets changed from 'kotlinx-coroutines-core' to
'kotlinx-coroutines-core-jvm'. So it should support both.
2020-07-28 00:48:52 +02:00
Lilia
6836d0ae19 Add changelog for 1.4.0-RC 2020-07-24 11:29:19 +02:00
Vyacheslav Gerasimov
2dfd346c06 Build: Remove attributes from builtins runtimeElementsJvm configuration
To prevent gradle selecting it as default
2020-07-23 16:01:55 +03:00
Sergey Bogolepov
5a8c0c6d12 Update Kotlin/Native: 1.4-rc1-40 2020-07-22 20:25:53 +07:00
Alexander Gorshenev
8b60fd7051 [IR FAKE OVERRIDES] Properly account for outer class type parameters
(cherry picked from commit c076d81f0c)
2020-07-22 12:07:51 +03:00
Ilya Gorbunov
8509faddae Package builtins with jvm reflect into IDEA plugin only
Leave builtins with common reflect for stand-alone compiler.

(cherry picked from commit 95cc35f22e)
2020-07-22 11:38:24 +03:00
Stanislav Erokhin
c7b0b53ee9 Serialize jvm reflect into builtIns
Basically this is revert of 427e34fe5a commit
This was done due to the KT-39728.
Also we do pick every file separately, because builtIn serializer
unable to filter expects

(cherry picked from commit 0c094b1719)
2020-07-22 11:16:00 +03:00
Stanislav Erokhin
1fe66ec082 Move KTypeProjection to separate file
(cherry picked from commit 67090e1afb)
2020-07-22 11:15:56 +03:00
Zalim Bashorov
31cb13accd [KJS FE] Change severity of NON_EXPORTABLE_TYPE from error to warning
The change is required to avoid breaking examples using kotlin-wrappers
until we find an acceptable solution for them.

#KT-39873 Fixed
2020-07-21 23:19:56 +03:00
Leonid Startsev
45cc2a2289 Add JarUtil.getJarAttribute to proguard rules
This method is used by serialization plugin to read runtime JAR
manifest.

Maven serialization plugin seems to use proguarded compiler
distribution,
so to use this method, it should be kept.

Size increased for about 2kb.

(cherry picked from commit a0154b9851)
2020-07-21 15:40:31 +03:00
Leonid Startsev
40a896cde6 Mute/ignore 'PROVIDED_RUNTIME_TOO_LOW' in tests
(cherry picked from commit e3f42721e9)
2020-07-21 15:40:26 +03:00
Leonid Startsev
d2f2330f13 Implement reading kx.serialization runtime metadata from jar manifest
That allows to check whether current compiler plugin can work with
a given runtime version. Implementation-Version can help to detect whether
runtime version is too low, and Require-Kotlin-Version detects whether
runtime version is too high.

Corresponding diagnostic for Require-Kotlin included.
Implement minimal runtime version check for kotlinx.serialization
plugin.

 #KT-40036 Fixed

Cache result from getVersionsForCurrentModule in BindingTrace.
Hide check in the IDE, because caching in trace does not work there.

(cherry picked from commit df5f38fec8)
2020-07-21 15:39:38 +03:00
Leonid Startsev
435668a0cc Add new serialization runtime packages
encoding and descriptors. Rename ContextSerializer to Contextual.
Unify getClassFrom*Package functions.

(cherry picked from commit 7db0bf8195)
2020-07-21 15:39:16 +03:00
Vyacheslav Gerasimov
ee2938c66b Build: Add dependency on sign task for :kotlin-stdlib-js:uploadArchives 2020-07-20 22:04:10 +03:00
Victor Petukhov
61d4cac329 NI: decrease fixation priority for variables which have only incorporated from upper bound constraints
^KT-40045 Fixed
^KT-39633 Fixed

(cherry picked from commit b0ac046b05)
2020-07-20 19:21:48 +03:00
Vyacheslav Gerasimov
1fb8f05c8b Build: Fix signing of kotlin-stdlib-js artifacts 2020-07-20 19:01:38 +03:00
Vladimir Ilmov
82895723a2 (CoroutineDebugger) using WeakReference as lastObservedFrame
relates to #KT-40073
2020-07-20 16:47:25 +02:00
Vladimir Ilmov
b35465dd1a (CoroutineDebugger) added support for DebugCoroutineInfoImpl in kotlinx-coroutines-core:1.3.8
relates to #KT-40073
2020-07-20 16:47:25 +02:00
Vladimir Ilmov
662874ba59 (CoroutineDebugger) lv 'task' added to tests in EventLoopImplBase kotlinx-coroutines-core:1.3.7 2020-07-20 16:47:02 +02:00
Vladimir Ilmov
14b1bb596f (CoroutineDebugger) minimum supported version kotlinx-coroutines-core.1.3.8
Workaround for starting agent on windows removed, version upgraded in tests
 #KT-40073 fixed
2020-07-20 16:47:01 +02:00
Ilya Goncharov
f789df4792 [Gradle, JS] Check if not both compiler 2020-07-20 17:33:17 +03:00
Ilya Goncharov
a9dec2824d [Gradle, JS] Rename flag for legacy
[Gradle, JS] binaries executable for legacy by default

[Gradle, JS] Common configure should be last otherwise user settings can
be overwrote

^KT-40320 fixed
2020-07-20 16:48:27 +03:00
Jim Sproch
bce77bc170 Keep members of com.google.common dependencies intact
It is a workaround for KTI-298
#KT-40354 In progress

(cherry picked from commit 814bd48148)
2020-07-20 15:23:08 +03:00
Mikhail Zarechenskiy
5772a53a63 Fix SAM conversion when lambda is the last expression of another lambda
#KT-39691 Fixed
2020-07-20 15:10:06 +03:00
Mikhail Zarechenskiy
4732b74781 Fix references to sam adapted functions, also fix lookup location
#KT-31025 Fixed
2020-07-20 15:10:06 +03:00
Mikhail Zarechenskiy
d8a357cce3 Prohibit adapted reference resolve against reflective types
There are design questions about reflection for adapted references,
 so the current proposal is to prohibit reflection on them and support
 it properly later

 #KT-40406 Fixed
2020-07-20 15:10:05 +03:00
Jim Sproch
847dbf212f Fallback to fileEntry provided by irFile
(cherry picked from commit a4a398239b)
2020-07-20 11:14:24 +03:00
Jim Sproch
11a9a992b2 Make linker visible to compiler plugins
(cherry picked from commit ccbb2eaba9)
2020-07-20 11:14:24 +03:00
Anton Yalyshev
e06be4a7e3 Add change notes for 1.4-M1,2,3,RC builds in 1.4.0 #KT-40311 Fixed 2020-07-19 21:05:11 +03:00
Ilya Matveev
d75ce04357 Update Kotlin/Native: 1.4-rc1-29 2020-07-19 17:27:24 +07:00
Ivan Gavrilovic
5b82d231f8 Create a valid jar in KaptIncrementalWithIsolatingApt test 2020-07-18 05:02:36 +09:00
Ivan Gavrilovic
6c5cb2edf2 KT-34604: Fix race condition in KAPT
KAPT was relying on clearing JarFileFactory to make sure
annotation processing does not hold onto annotation processing
classpath once done. Once KAPT switched to using Gradle workers, multiple
KAPT runs were sharing the same class loader ie. the same version
of JarFileFactory. Clearing the cache resulted in race condition,
as some runs were unable to load processors from jars.

This commit fixes this problem by avoiding the use of ServiceLoader
which was causing the issue. Jars would be added to the cache, but
they would never be removed. That's why JarFileFactory had to be
clearned manually. By loading the processor names manually (simply
exploring the classpath), no file handles leak.

Fixes https://youtrack.jetbrains.com/issue/KT-34604
Test: verified against the test project from the bug
2020-07-18 05:02:36 +09:00
Ivan Gavrilovic
5d1727b681 KAPT: Fix error reporting
When incremental analysis is unable to run, handle
failure gracefully. More info will be provided by
compiler diagnostics.

Fixes KT-36302
2020-07-18 05:02:36 +09:00
Ivan Gavrilovic
c6373987a9 KAPT: Fix serialization of class structure data
When serializing ClasspathEntryData, ids assigned to types were
incorrect, resulting in corrupt data when deserializing files. This
happened if there were dependencies between classes.

Fixes KT-39876
Test: ClasspathAnalyzerTest
2020-07-18 05:02:35 +09:00
Stanislav Erokhin
f7018888b4 Revert Parcelize commits due to KT-39981
Revert "Parcelize: Fix test code"
This reverts commit 9b7a95b0

Revert "Parcelize: Enable ParcelableDeclarationChecker with the parcelize plugin"
This reverts commit d93e5d3d

Revert "Parcelize: Fall back to readValue/writeValue if no other serializers are available"
This reverts commit f93749ae

Revert "Parcelize: Resolve parcel serializers on demand"
This reverts commit 8d364a8a

Revert "Parcelize: Remap functions in overridden symbols and callable references"
This reverts commit cfe16802

Revert "Fix Parcelize codegen tests following rebase"
This reverts commit b39a6530

Revert "Update Parcelize codegen tests"
This reverts commit 8a9610d3

Revert "Fix Parcelize annotation implementing Parcelable.Creator<T>"
This reverts commit 00ec50ff
2020-07-18 05:02:35 +09:00
Sergey Igushkin
a6c2ad9995 Fix stdlib-by-default failures when configuration has been resolved
Issue #KT-38221

(cherry picked from commit d3f9f4f3e8)
2020-07-17 21:53:22 +04:00
Dmitriy Dolovov
e79ad8c99f [Commonizer] Introduce success marker file in Gradle task
The success marker file is written to the disk only upon successful
commonization. If something goes wrong, this file is not written to
the disk. So the subsequent call of 'runCommonizer' task will be
considered not up-to-date.

^KT-40120
2020-07-17 22:07:18 +07:00
Dmitriy Dolovov
b924a02c52 [Commonizer] More precise up-to-date checks in Gradle task
Don't annotate the whole 'distributionDir' with @InputDirectory.
The contents of the distribution directory may grow over time due to
compilation cache and new commonized libraries.

Don't annotate 'baseDestinationDir' with @InputDirectory. The base
destination directory may contain numerous subdirectories with the
libraries produced for different combinations of commonized targets.
This means that the contents of the base directory will grow over time.

Use more precise directory up-to-dateness checks:
* Annotate the directory with the original common libraries
  (i.e. 'stdlib') as @InputDirectory.
* Annotate the directory with the original platform libraries
  (all targets altogether) as @InputDirectory.
* For each combination of commonized targets mark the list of the
  directories with resulting libraries as @OutputDirectories.

^KT-40120
2020-07-17 22:07:18 +07:00
Konstantin Tskhovrebov
a7bd0a7ff4 Add native targets check to "isAllowCommonizer" method.
#KT-40164 Fixed.

(cherry picked from commit cfd91023be)
2020-07-17 16:49:33 +03:00
Ilya Kirillov
0b98e83754 J2K: do not run runUndoTransparentAction outside EDT
#KT-39739 fixed
2020-07-17 15:59:26 +03:00
Ilya Kirillov
5c6b18c6bd Wizard: do not add stdlib for gradle based projects
#KT-40407 fixed
2020-07-17 15:59:26 +03:00
Ilya Kirillov
47969e77dd Wizard: do not add NPM dependencies for Kotlin/JS wrappers
Those dependencies are included now into corresponding libraries

#KT-40377 fixed
2020-07-17 15:59:26 +03:00
Ilya Kirillov
0bf839b830 Wizard: do not add test task for JS when no test framework is chosen
#KT-40378 fixed
2020-07-17 15:59:25 +03:00
Ilya Kirillov
4e957a206b Wizard: do not allow to choose Frontend Application template & JS Library at the same time
#KT-40371 fixed
2020-07-17 15:59:25 +03:00
Ilya Kirillov
0e55d6d3ec Wizard: fix Android SDK path on Windows
#KT-40232 fixed
2020-07-17 15:59:25 +03:00
Abduqodiri Qurbonzoda
ca4284b3c4 Mark with @DeprecatedSinceKotlin #KT-22423 and #KT-28753
(cherry picked from commit a05681001f)
2020-07-17 15:36:42 +03:00
Ilya Gorbunov
0e2f666d19 Specify DeprecatedSinceKotlin for recently deprecated min/max funs
#KT-38854

(cherry picked from commit 87cb6372a0)
2020-07-17 15:36:38 +03:00
Ilya Gorbunov
15ab6ede2c Add stdlib-gen DSL support for DeprecatedSinceKotlin annotation
(cherry picked from commit a9f4479557)
2020-07-17 15:36:36 +03:00
Mikhail Zarechenskiy
76f1b02ba5 Improve message about compatibility warning a bit
Relates to #KT-40111
2020-07-17 14:37:17 +03:00
Mikhail Zarechenskiy
ab8c862e85 Fix delegated property resolve on number literals and proper types
There is no need to update type of delegate expression if it's already
 resolved correctly (doesn't include non-proper types). In almost all
 cases it was fine except number literals as there we didn't box
 expression in backend and got problems at bytecode verification stage

 #KT-40057 Fixed
2020-07-17 14:37:15 +03:00
Mikhail Zarechenskiy
7e0df1e777 Relax rules about inferring to Nothing for special calls
#KT-37388 Fixed
 #KT-38427 Fixed
 #KT-39953 Fixed
 #KT-38899 Fixed
2020-07-17 07:55:54 +03:00
Shagen Ogandzhanian
f4244f2dda Update dukat dependency to 0.5.7
(cherry picked from commit fa1e3169df)
2020-07-16 19:38:41 +02:00
Svyatoslav Kuzmich
7cdc5ba275 [JS IR] .d.ts generation for module systems
Support .d.ts generation for UMD, AMD, CommonJS module kinds in
addition to existing "plain" module kind.
2020-07-16 18:57:30 +03:00
Svyatoslav Kuzmich
d8b3b6fd78 [JS] Add ; after functions in .d.ts
Fixes nit from KT-37752
2020-07-16 18:57:30 +03:00
Svyatoslav Kuzmich
cc73268daa [JS] Prevent default class constructors in d.ts files.
Generate private TypeScript constructor for classes without public
primary Kotlin constructor.
2020-07-16 18:57:30 +03:00
Svyatoslav Kuzmich
325b6dfd9a [JS] Support secondary constructors in JsExport 2020-07-16 18:57:30 +03:00
Abduqodiri Qurbonzoda
feb0767cb1 Replace @LowPriorityInOverloadResolution with @DeprecatedSinceKotlin #KT-37101
(cherry picked from commit d2c9fc41f1)
2020-07-16 18:08:02 +03:00
Abduqodiri Qurbonzoda
8ed2dec1cc Advance bootstrap to 1.4.0-rc-154 2020-07-16 18:07:36 +03:00
Igor Chevdar
df00daa5ae [IR] Supported IrFunctionExpression in ClosureAnnotator
It may be encountered during local classes extraction from inline lambdas
2020-07-16 20:00:49 +05:00
Victor Petukhov
9858d1fe67 NI: add fallback strategy to get lexical scope to checking coroutine call legality
^KT-40247 Fixed
^KT-40337 Fixed
2020-07-16 15:32:39 +03:00
Roman Artemev
daade4ea5d [FIR] Mute test 2020-07-15 19:19:40 +03:00
Roman Artemev
b395a4d270 [KLIB] Fix deserialization of anonymous classes
In case of initializing property or function with anonymous object the
object is being exposed outside its field/function's scope and
accessible on previous level. In this case in `declarations only` mode
we have unbound symbols. Fix is to force body/initializer loading in
such cases.

Make sure it is deserialized in `declarations'only` mode too.

 - Fix KT-40216
 - Add test
2020-07-15 18:37:29 +03:00
Roman Artemev
f5dd22127f [Psi2IR] Improve assertion message 2020-07-15 18:37:28 +03:00
Victor Petukhov
f86992cd75 Don't try to infer postponed variables on lambdas without BuilderInference annotation
^KT-39618 Fixed

(cherry picked from commit b0c96a61ec)
2020-07-15 18:26:11 +03:00
Victor Petukhov
f559b5d54b Add using -Xinline-classes by default in IDE intentions
^KT-34209 Fixed

(cherry picked from commit bf23b39d76)
(cherry picked from commit d2f5fbdd08)
2020-07-15 18:25:54 +03:00
Dmitry Savvinov
02c4aab112 Coerce commonTest to common in HMPP
Otherwise, Android import won't add dependency from androidTest to
commoonTest. See KT-38744 for details

^KT-38744 Fixed
2020-07-15 13:14:25 +07:00
Mikhail Zarechenskiy
f3f7547e30 Don't perform Unit-conversion for functional types with type variables
#KT-40269 Fixed
2020-07-15 00:00:54 +03:00
Mikhail Zarechenskiy
059f496bad Fix rewrite at slice exception for callable references inside flatMap
#KT-40254 Fixed
2020-07-15 00:00:54 +03:00
Vladimir Dolzhenko
876dda6a96 Force perform FULL analysis to avoid redundant analysis for the current open file
#KT-38687 Fixed

(cherry picked from commit 853503d75f)
2020-07-14 21:42:59 +02:00
Zalim Bashorov
c6749451c2 [KJS] Throw exception on recursive types provided to typeOf and provide proper support later within KT-40173
#KT-38140 fixed

(cherry picked from commit 340512e27a)
2020-07-14 18:49:34 +03:00
Zalim Bashorov
af80a0a8cd [Test infra] Take into account transitive compatible targets while checking compatibility.
(cherry picked from commit c552933459)
2020-07-14 18:49:33 +03:00
Zalim Bashorov
47a1822123 [KJS FE] Allow using typeOf with non-reified type parameters
#KT-38771 fixed

(cherry picked from commit ca37c6bfe6)
2020-07-14 18:49:33 +03:00
Ilya Gorbunov
20674b1376 Make common KClass extend common KClassifier
It already does that in all platforms.
Add KClass common API test.

(cherry picked from commit 010e530ac4)
2020-07-14 18:37:43 +03:00
Andrey Uskov
f57adc266a Send use-ir and jvmDefaults compiler arguments from IDE
Relates to KT-39924 and KT-39977

(cherry picked from commit c37f339d8c)
2020-07-14 16:41:03 +03:00
Andrey Uskov
721ee7e3c7 Report jvm-default compiler arguments from Gradle
#KT-39977 Fixed

(cherry picked from commit 550c53c2ac)
2020-07-14 16:41:03 +03:00
Andrey Uskov
6d0c3d4dcd Report use-ir flag from Gradle
#KT-39924 Fixed

(cherry picked from commit e3a5df1aaa)
2020-07-14 16:41:03 +03:00
Sergey Igushkin
1f4b9d894e Add kotlin.stdlib.default.dependency=false to avoid stdlib default dep
(cherry picked from commit 62aed1b53a)
2020-07-14 16:01:45 +04:00
Sergey Igushkin
a50a5bef27 Fix stdlib default dependencies with Android
* In Android test-related source sets, add an implementation dependency,
  not an api one, because adding dependencies to the api configurations
  leads to warnings from AGP

* Add the default stdlib dependency only to the Android main source set,
  as duplicating it elsewhere leads to issue with publishing the project
  with the `maven` plugin (duplicate conf2ScopeMappings)

(cherry picked from commit ad9d011ed0)
2020-07-14 16:01:45 +04:00
Sergey Igushkin
fd19ee374b KT-38221: Stdlib by default; KT-40225 Single dependency on kotlin-test
* Add a DSL property `kotlin.coreLibrariesVersion` that is used as the
  default version for all org.jetbrains.kotlin dependencies instead of
  the plugin version used previously – the pluging version is the
  default now.

* Support omitting the `kotlin-stdlib-*` dependencies in all kinds of
  projects. For the JVM source sets, choose the stdlib module by
  checking the jvmTarget in the compilations – if all compilations
  target 8+ then use `kotlin-stdlib-jdk8`.

* Support adding a single dependency on the fake module
  `kotlin-test-multiplatform` that is later expanded into the
  appropriate dependencies on `kotlin-test-*` modules. For JVM source
  sets, detect the test framework by inspecting the test tasks.

* (minor) Fix _executionSource not updated in KotlinJvmTestRun

* (minor) Lazily query `kotlinUsageContext`'s dependency-related
  properties to avoid freezing the configurations

Issue #KT-38221 Fixed
Issue #KT-40225 Fixed

(cherry picked from commit d83d3304a5)
2020-07-14 16:01:44 +04:00
Natalia Selezneva
dc6788629b gradle.kts: update notification messages after proofreading
(cherry picked from commit e0bc54cd82)
2020-07-14 14:59:44 +03:00
Ilya Goncharov
0a341d303f [Gradle, JS] Fail build in case when mpp or js targets not configured
^KT-40210 fixed
^KT-40300 fixed

(cherry picked from commit 9d362875da)
2020-07-14 14:22:25 +03:00
Ilya Muradyan
a42b6a4d41 Add @JvmDefault for getPossibleSyntheticNestedClassNames
(cherry picked from commit 07b566dd02)
2020-07-14 14:20:57 +03:00
Vladimir Dolzhenko
f5fce1e302 Fixed Add missing module dependency quick fix
#KT-36131 Fixed
2020-07-14 13:16:34 +02:00
Dmitry Savvinov
bd117ce800 Allow depending on Native stdlib even if platforms do not match under HMPP
^KT-40102
2020-07-14 17:21:32 +07:00
Sergey Igushkin
8fcf688905 Fixup for the fix of KT-39809
In the original fix for KT-39809, the Kapt plugin was not given a proper
empty implementation stub: it was added to `Kapt3GradleSubplugin`, while
originally the Kapt subplugin's META-INF/services entry pointed to
`Kapt3KotlinGradleSubplugin`.

This commit makes the correct class implement the legacy interface.

Issue #KT-39809 Fixed

(cherry picked from commit 5ec93fd74c)
2020-07-14 13:30:24 +04:00
Sergey Igushkin
74fb25edb6 Fix resolving dependency on self in HMPP (KT-39037)
Apply a workaround for grade/gradle#13680

Issue #KT-39037 Fixed

(cherry picked from commit 4c273e1fc5)
2020-07-14 13:30:21 +04:00
Sergey Igushkin
868e9f3147 Fix resolving an MPP dependency in custom configurations (KT-32239)
In the `KotlinPlatformType` disambiguation rule, don't prefer `common`
when there's a `jvm` or an `androidJvm` variant, as this would conflict
with disambiguation rules created by the other plugins, such as Gradle's
`java` which will choose `org.gradle.usage=java-api` and lead to
ambiguity.

Issue #KT-32239 Fixed

(cherry picked from commit aebca19fd7)
2020-07-14 13:30:19 +04:00
Yaroslav Chernyshev
06bf203e05 [Gradle, Cocoapods] Fixed bug in scheme name for pods
(cherry picked from commit 07e3dd9ec7)
2020-07-13 16:57:30 +03:00
Steven Schäfer
12c60d9544 JVM IR: Mangle delegated properties with inline class type (KT-40125)
(cherry picked from commit 097e0fb46c)
2020-07-13 14:47:28 +02:00
Dmitry Petrov
9cad15b462 JVM_IR: fix property reference generation for inline class primary val
(cherry picked from commit 761e47264a)
2020-07-13 14:47:28 +02:00
Dmitry Petrov
5ecc1c16a5 JVM_IR: Mangle primary val getter of inline class if required
TODO fix reflection

(cherry picked from commit 8da988b18e)
2020-07-13 14:47:28 +02:00
Steven Schäfer
007ba7dbfb JVM IR: Fix inline class constructor ABI (KT-37013, KT-37015)
(cherry picked from commit 846fc13519)
2020-07-13 14:47:28 +02:00
Mikhail Zarechenskiy
c66f0deff9 Fix presence of Deprecated hidden annotation for reference arguments
#KT-40234 Fixed
2020-07-13 11:30:47 +03:00
Dmitry Savvinov
0d5b8c569c Force expansion to have the same nullability as abbreviation
Note that classifier.underlyingType is always non-nullable, but
abbreviation might be nullable, so we should keep them consistent

^KT-40199 Fixed
2020-07-13 14:13:44 +07:00
Dmitry Savvinov
5c4a1b2552 Add test on signatures with nullable abbreviated types
Currently test fails, see KT-40199
2020-07-13 14:12:47 +07:00
Mikhail Zarechenskiy
67703add94 Introduce compiler key to disable compatibility resolution mechanism
Enable it if one was using new inferene before 1.4

 #KT-40128 Fixed
 #KT-40112 Fixed
 #KT-40113 Fixed

(cherry picked from commit 0c8b847ae6)
2020-07-12 23:59:46 +03:00
Mikhail Zarechenskiy
da1a51ce3a Fix coercion to Unit when variable already have other constraints
Don't add `Unit` if variable has an upper constraint T <: A.

 It's impossible to coerce variable T to Unit as constraint system will
 be always contradictory: T := Unit => Unit should be subtype of A

 #KT-39900 Fixed

(cherry picked from commit 0ee7306d9c)
2020-07-12 23:59:46 +03:00
Mikhail Zarechenskiy
d10a570203 Add compatibility resolve when variable has "bad" intersection type
#KT-39468 Fixed

(cherry picked from commit d51bb2c053)
2020-07-12 23:59:46 +03:00
Ilya Chernikov
0701ea57c7 NI: Optimize some potential hot places
(cherry picked from commit 2656eeb164)
2020-07-12 23:59:46 +03:00
Mikhail Zarechenskiy
61e55c9b4b Update ApiTest.testIrStdlib for JS, an addition to 9be8c5b5
(cherry picked from commit b0b8d40b71)
2020-07-12 23:59:46 +03:00
Vladimir Ilmov
074bff4dc6 (CoroutineDebugger) Restored frame variables isn't shown for 2020.1.
#KT-40172 fixed
2020-07-11 10:24:27 +02:00
Ilya Gorbunov
a2c0e81baa Postpone introducing common StringBuilder.capacity() function
Its support complicates JS StringBuilder implementation with no actual
performance improvements. Benefits of having capacity() function
in common code are also not completely clear.

Relates to KT-33069
#KT-40168

(cherry picked from commit 20683d62a6)
2020-07-10 20:25:14 +03:00
Ilya Gorbunov
0a8b4c6996 Add EXACTLY_ONCE contract to suspendCoroutine* functions
Update line numbers in the affected test.

(cherry picked from commit 2f3e1dcbc6)
2020-07-10 15:47:21 +03:00
Ilya Gorbunov
17e210e19c Add EXACTLY_ONCE contract to functions that call their lambda parameter once
KT-35972

(cherry picked from commit 1a32fdf6d7)
2020-07-10 15:47:21 +03:00
Ilya Gorbunov
8ae480aa4c Fix typo in kotlinx.dom docs
(cherry picked from commit c85432b2f9)
2020-07-10 15:47:21 +03:00
Natalia Selezneva
4d7eeccdf6 *.gradle.kts: get java home from build environment instead of execution settings
Note that getting GradleExecutionSettings may lead to write action
because it link javaHome with existing sdks

^KT-39317

(cherry picked from commit c7c7ffb0e0)
2020-07-10 15:42:35 +03:00
Dmitriy Dolovov
055d2fff1f [Commonizer] Lookup descriptors that doesn't participate in commonization
^KT-40119
2020-07-10 19:14:33 +07:00
Dmitriy Dolovov
7620dffee4 [Commonizer] Use ClassId instead of FqName for addressing classes and TAs
(cherry picked from commit ffd0c69698)
2020-07-10 19:14:28 +07:00
Victor Petukhov
2068d07908 Add skipped ignore directive in test for b08c7eff38 2020-07-10 14:51:50 +03:00
Victor Petukhov
b08c7eff38 NI: introduce simple calls storage (which aren't gone through type inference) in coroutine inference session to further substitute postponed variable
^KT-40151 Fixed

(cherry picked from commit 514ac7dc8f)
2020-07-10 12:12:25 +03:00
Victor Petukhov
e5cce3f3d9 NI: do substitution stub types during updating trace for lambda (these stub types can appear from the builder inference as postponed variables)
^KT-40060 Fixed

(cherry picked from commit c588bc604d)
2020-07-10 12:12:22 +03:00
Victor Petukhov
f580653740 NI: don't collect members if a receiver type is StubType to avoid creating error candidates instead of not crating them at all
^KT-37717 Fixed

(cherry picked from commit eec3a4720c)
2020-07-10 12:12:20 +03:00
Anton Yalyshev
b332174f91 Enable FUS for Code Completion in 1.4.0
(cherry picked from commit bc979a33f7)
2020-07-09 19:55:06 +03:00
Alexander Udalov
c5ecb60ed3 Fix compilation of stdlib when JDK_16 points to JDK 8+
(cherry picked from commit 2be94d9d2f)
2020-07-09 18:45:50 +02:00
Leonid Startsev
8a4e99a718 Add 'Incorrect Transient' diagnostic
when users write @Transient, they get @kotlin.jvm.Transient, because it's always in auto-import.
This annotation does not work with @Serializable classes; @kotlinx.serialization.Transient should be used instead.

Add quickfix for 'incorrect transient' diagnostic:
'Import kotlinx.serialization.Transient'

 #KT-28662 Fixed

(cherry picked from commit 340deb01dd)
2020-07-09 19:39:24 +03:00
Leonid Startsev
12a338fa52 Split ContextualSerialization annotation in two
(cherry picked from commit 6ef597a4ee)
2020-07-09 19:39:07 +03:00
Ilya Kirillov
70b98018c3 Wizard: fix project template list size
(cherry picked from commit f179b39c70)
2020-07-09 18:25:27 +03:00
Ilya Kirillov
37a67d85fd Wizard: update ktor version
#KT-40037 fixed
2020-07-09 18:25:27 +03:00
Ilya Kirillov
feee61b1e3 Wizard: consider RC version as a EAP one
#KT-39871 fixed
2020-07-09 18:25:27 +03:00
Ilya Kirillov
613898bf16 Wizard: add kotlinx repo for projects using kotlinx-html
#KT-40004 fixed
2020-07-09 18:25:27 +03:00
Roman Artemev
68bb96ddaf [IR] Fix synthetic declarations generator to make it produce correct type
- Fix KT-40126
 - Add test

(cherry picked from commit ca44242f37)
2020-07-09 17:35:38 +03:00
Ilya Muradyan
503f8f63da Fix REPL completion for import directives
(cherry picked from commit 2487f9369c)
2020-07-09 16:19:03 +03:00
Stanislav Erokhin
1a140ddf58 Fix since-build version for AS 3.6 and AS 4.0 2020-07-09 15:20:39 +03:00
Ilya Matveev
d2cfabb210 Update K/N version: 1.4-rc1-18 2020-07-09 14:33:36 +07:00
Roman Golyshev
69e45061a0 KT-39869 Remove redundant performDelayedRefactoringRequests call
- In `ObsoleteExperimentalCoroutinesInspection` it is redundant because
it is performed immediately after the single `bindToFqName` call,
so there is no reason to postpone the refactoring and then immediately
invoke it
- In `ObsoleteKotlinJsPackagesInspection` there are no reason to call
it at all (no refactorings are postponed)

(cherry picked from commit 637d3430ff)
2020-07-08 15:38:56 +00:00
Roman Golyshev
46e4a21dfd KT-39869 Add inspection for FQN usages of kotlin.browser package
- `kotlin.dom` does not need this because it contains only extensions
- Add test for launching whole project fix; mute it because currently it
does not pass
  - The test fails because in tests `RefJavaManager` tries to create
  `RefJavaFileImpl` for .kt files. It will try to use UAST, but it
  does not work for JS files. In production this is disabled, so no
  problems occur

(cherry picked from commit 5cf6b860a6)
2020-07-08 15:38:55 +00:00
Roman Golyshev
2b73400c8f KT-39869 Fix review suggestions
- Review: https://jetbrains.team/p/kt/review/1349

(cherry picked from commit 91fa5d38b3)
2020-07-08 15:38:54 +00:00
Roman Golyshev
c6f342bd9e KT-39869 Add ObsoleteKotlinJsPackagesInspection inspection
- This inspection allows to migrate from `kotlin.dom|kotlin.browser`
to `kotlinx.dom|kotlinx.browser` packages respectively
- This inspection is available from the import statements, and also
from the `Run migrations` action
- ^KT-39869 Fixed

(cherry picked from commit 75de352ce2)
2020-07-08 15:38:53 +00:00
Roman Golyshev
46f0c39c58 KT-39869 Move base classes to separate file
(cherry picked from commit ec087e8f3d)
2020-07-08 15:38:52 +00:00
Roman Golyshev
181ecb9e19 KT-39869 Refactor ObsoleteExperimentalCoroutinesInspection.kt
- We need this to reuse the logic for migration inspections

(cherry picked from commit 871bb30dbe)
2020-07-08 15:38:50 +00:00
Ilya Goncharov
a8cdf4bd88 [Gradle, JS] Update version in package.json with file dependency 2020-07-08 16:38:03 +03:00
Lilia
e8ef514f4b Add changelog for 1.4-M3 2020-07-08 13:20:52 +02:00
Ilya Goncharov
d54243609c [Gradle, JS] Output file of public package json as var for changing it
(cherry picked from commit a2d5cda716)

[Gradle, JS] Simplify creation of public package json task

(cherry picked from commit 5c968acb13)

[Gradle, JS] jsJar dependsOn PublicPackageJsonTask

But package.json included into jar only if public npm dependencies exists

(cherry picked from commit f76a1f0e86)

[Gradle, JS] Add test on public package json inside archives (jar and klib)

(cherry picked from commit 03bc61c80a)

^KT-40067 fixed
2020-07-07 13:19:33 +03:00
Yaroslav Chernyshev
34bcc97160 KT-36801 Added forgotten changes for 192 platform
#KT-39989 Fixed

(cherry picked from commit aeed7fe52d)
2020-07-06 21:49:36 +03:00
Ilya Goncharov
fc5328d7a6 [Gradle, JS] Deprecation of frontend plugin
^KT-40048 fixed

(cherry picked from commit cb3d7349a3)
2020-07-06 18:49:17 +03:00
Vladimir Dolzhenko
cf9a881a3f Fix KOTLIN_BUNDLED registration
#KT-39968 Fixed

(cherry picked from commit 1450cf5f63)
2020-07-03 22:18:17 +02:00
Svyatoslav Scherbina
40e29a34b8 Add "Remove annotation" quickfix for @Throws override mismatch 2020-07-03 20:47:32 +03:00
Svyatoslav Scherbina
30b9f63146 Add "Remove annotation" quickfix for empty @Throws 2020-07-03 20:47:30 +03:00
Svyatoslav Scherbina
aa3eb2e3a0 Add quickfix for adding CancellableException to @Throws suspend fun 2020-07-03 20:47:27 +03:00
Svyatoslav Scherbina
91272d042f Add basic support for Native in idea/testdata/multiModuleQuickFix 2020-07-03 20:47:25 +03:00
Vyacheslav Gerasimov
02b4836c17 Build: Encode build number in teamcity build url 2020-07-03 15:35:02 +03:00
Mikhail Zarechenskiy
b342422959 Advance bootstrap to 1.4.0-rc-87 2020-07-02 22:35:58 +03:00
Vyacheslav Gerasimov
c28533aa61 Build: Use project kotlin-reflect in fir tree generator
To avoid unstable dependency substitution depending on local version
2020-07-02 20:47:05 +03:00
Mikhail Zarechenskiy
da924219c0 Advance bootstrap to 1.4.0-rc-83 2020-07-02 20:00:35 +03:00
Mikhail Zarechenskiy
7ac36eff82 Update test data as stdlib now isn't pre-release 2020-07-02 18:35:30 +03:00
Mikhail Zarechenskiy
60a9629b2f Set KotlinCompilerVersion.IS_PRE_RELEASE = false
Since master is 1.4.20 now and branch 1.4.0 is 1.4-RC

 #KT-39860 Fixed
2020-07-02 18:35:15 +03:00
Vsevolod Tolstopyatov
66c5b58420 Introduce CancellationException
#KT-39126 Fixed
2020-07-02 11:14:00 +03:00
Alexander Gorshenev
aa1f689b2f Adapted fake override checker to inheritance from friend module internal interfaces 2020-07-01 20:33:51 +03:00
Denis Zharkov
5fb57511ca Fix incremental compilation for calls to inner classes from supertypes
The problem became actual after 8c2baf0704

(cherry picked from commit 3ce980fd88)
2020-07-01 07:01:51 +03:00
Mikhail Bogdanov
ede7737348 Check target for -Xjvm-default modes
#KT-39925 Fixed

(cherry picked from commit b5b5c8aebc)
2020-06-30 20:12:15 +02:00
Mikhail Bogdanov
6c8544aa97 Write proto flag about compatibility mode
There is no any special aim for this flag now.
  But it could be useful in future in case of compatibility mode deprecation

(cherry picked from commit 3580c7c28c)

 #KT-39943 Fixed
2020-06-30 15:24:56 +02:00
Alexander Gorshenev
42a4f70294 Muted .IncrementalJsKlibCompilerRunnerTestGenerated.ClassHierarchyAffected.testMethodRemoved
until we have full fledged fake override support in klib
2020-06-30 13:50:47 +03:00
Alexander Gorshenev
189dba39a6 Updated extraHelp test data for the new flags 2020-06-30 13:50:42 +03:00
Alexander Gorshenev
2c2799e531 Compute correct signature for fake override properties with type parameters 2020-06-30 13:50:35 +03:00
Alexander Gorshenev
fa274e03dd Fine tuned fake override validator for internals 2020-06-30 13:50:29 +03:00
Alexander Gorshenev
e341ba30c0 Treat internals as publics for fake override construction 2020-06-30 13:50:19 +03:00
Alexander Gorshenev
94d334d92c Fake override construction fallback mode 2020-06-30 13:50:14 +03:00
Alexander Gorshenev
700234ed2a Added -Xdisable-fake-override-validator 2020-06-30 13:50:06 +03:00
Sergey Igushkin
64aa5dcd70 Add back empty stub implementations of KotlinGradleSubplugin (KT-39809)
* If a KotlinGradleSubplugin implements
 KotlinCompilerPluginSupportPlugin, don't apply it as a legacy plugin

* Add the legacy KotlinGradleSubplugin implementations back so that
 when there's JAR hell with META-INF/services in the old artifacts
 pointing to the classes, loading the plugins with ServiceLoader (legacy
 implementation) from the new artifacts would not fail.

* There's a corner case for plugins not in kotlin-gradle-plugin
 If a newer and older version of such a subplugin is used with an older
 version of the Kotlin Gradle plugin, the latter will find the META-INF
 entries and will try to load the subplugins from the new version. With
 the original fix for KT-39809, this would result in silently ignored
 empty stub implementations.

 Given that the Kotlin Gradle plugin can now check if a subplugin
 supports the new API, it's OK to keep the old entries and make the
 stub implementations throw a build error when called, so that improper
 plugin versions are not ignored and are clearly reported.

 Note that this is only necessary for the subplugins not bundled in the
 kotlin-gradle-plugin module, as those will always be in sync with the
 Kotlin version.

Issue #KT-39809 Fixed

(cherry picked from commit 1f5fa5eb7c)
2020-06-30 13:19:54 +03:00
Sergey Igushkin
24a4229d70 Remove kotlin.native.linkFromSources, expose tasks' sources
* Drop the deprecated mode in the Kotlin/Native link
tasks using sources rather than the intermediate
compiled klib.

* Remove the `allSources` and `commonSources`
properties from the KotlinNativeCompilation, use the
tasks' properties instead.

(cherry picked from commit e6bca819d4)
2020-06-30 13:18:45 +03:00
Abduqodiri Qurbonzoda
b2c7055892 Deprecate with error mixed Int/FP contains operator for ranges KT-22423
(cherry picked from commit d3fb9cc5f3)
2020-06-29 18:22:10 +03:00
Abduqodiri Qurbonzoda
5f8b0ffc8d Fix min/maxByOrNull function samples
(cherry picked from commit a04f70fb36)
2020-06-29 18:22:05 +03:00
Mikhail Zarechenskiy
0e43040535 Update tests for completion after adding DeprecatedSinceKotlin 2020-06-29 18:08:09 +03:00
Mikhail Zarechenskiy
4f130321c1 Update ApiTest.testStdlib for JS, an addition to 9be8c5b5 2020-06-29 18:08:09 +03:00
Mikhail Zarechenskiy
29feb78fbc Fix priority for "add import" action wrt DeprecatedSinceKotlin 2020-06-29 18:08:09 +03:00
Mikhail Zarechenskiy
4d659a4d47 Fix completion order & presentation wrt to DeprecatedSinceKotlin 2020-06-29 18:08:08 +03:00
Mikhail Zarechenskiy
d40d50922a Fix parameter info presentation with regard to DeprecatedSinceKotlin 2020-06-29 18:08:08 +03:00
Mikhail Zarechenskiy
72de5447d6 Update test data about built-ins 2020-06-29 18:08:08 +03:00
Mikhail Zarechenskiy
9940ef685b Implement equals/hashCode as this class previously was a data one
Fixes duplicated diagnostics in tests
2020-06-29 18:08:08 +03:00
Mikhail Zarechenskiy
d5b276a80b Prohibit using DeprecatedSinceKotlin outside kotlin subpackage 2020-06-29 18:08:07 +03:00
Mikhail Zarechenskiy
ef9b309d27 Prohibit using DeprecatedSinceKotlin annotation without arguments 2020-06-29 18:08:07 +03:00
Mikhail Zarechenskiy
70ef0b2e4b Reject values of DeprecatedSince.. that are not parseable as a version 2020-06-29 18:08:07 +03:00
Mikhail Zarechenskiy
1a05fc023f Place DeprecatedSinceKotlin annotation under 1.4 version 2020-06-29 18:08:06 +03:00
Mikhail Zarechenskiy
e505271225 Add various test for DeprecatedSinceKotlin annotation 2020-06-29 18:08:06 +03:00
Mikhail Zarechenskiy
3b96519d68 Don't perform additional lookups for DeprecatedSinceKotlin annotation
There is no need to check it as `DeprecatedSinceKotlin` can be used
 only along with `Deprecated` annotation
2020-06-29 18:08:06 +03:00
Mikhail Zarechenskiy
7ea0a2918c Remove message and replaceWith parameters from DeprecatedSinceKotlin 2020-06-29 18:08:06 +03:00
Mikhail Zarechenskiy
55c2a888b1 Introduce declaration checker for DeprecatedSinceKotlin annotation
- DeprecatedSinceKotlin annotation should only be applicable when
   there's `@Deprecated` annotation on the same declaration
 - Deprecation level shouldn't be specified in the relevant
   `@Deprecated` annotation
 - Check that warningSince <= errorSince <= hiddenSince
2020-06-29 18:08:05 +03:00
Alexander Udalov
57efee8d79 Introduce DeprecatedSinceKotlin annotation
This annotation will be used in the standard library to prevent the new
compiler from reporting deprecation diagnostics in case an older API
version is used (where the declaration was not deprecated yet).

 #KT-23575 Fixed
2020-06-29 18:08:05 +03:00
Shagen Ogandzhanian
a386d5c351 Update dukat dependency to 0.5.4
(cherry picked from commit 8a393ec041)
2020-06-29 13:23:38 +02:00
Alexey Trilis
57284816c3 KT-39843 Update project wizard templates after replacing kotlin.browser with kotlinx.browser
#KT-39843 Fixed

(cherry picked from commit 955087868a)
2020-06-29 13:26:10 +03:00
Dmitriy Dolovov
f0ab9358ba [Commonizer] Fast-pass for library fragments absent for some targets
^KT-39897
2020-06-29 17:22:34 +07:00
Andrey Uskov
0cb3c647c2 Escape arguments when Gradle plugin launches out of process compilation
#KT-39755 Fixed

(cherry picked from commit f4e9acb233)
2020-06-28 11:41:31 +03:00
Leonid Startsev
a62a563477 Rename several core entities as a part of kx.serialization abi change
(cherry picked from commit 901d8f3e7a)
2020-06-26 20:32:59 +03:00
Leonid Startsev
669092bf63 Support new ContextSerializer signature
(cherry picked from commit 5208bbcd21)
2020-06-26 20:32:43 +03:00
Ilya Goncharov
aeb93f5a3f [Gradle, JS] Ignore peer dependencies in yarn resolution
^KT-39842 fixed

(cherry picked from commit bd05b447c0)
2020-06-26 16:38:40 +03:00
Ilya Gorbunov
e277fd793d Expose KTypeProjection.STAR constant in a field
#KT-30083

(cherry picked from commit 8dfcebf542)
2020-06-26 16:17:31 +03:00
Ilya Gorbunov
765f62e2e2 Validate arguments of KTypeProjection constructor
#KT-34596 Fixed

(cherry picked from commit 53cbcfac5a)
2020-06-26 16:17:29 +03:00
Ilya Gorbunov
434d13f131 Annotate KTypeProjection factory methods with JvmStatic
#KT-30084 Fixed

(cherry picked from commit d41e8ed4ad)
2020-06-26 16:17:27 +03:00
Ilya Gorbunov
0c999107be Advance bootstrap to 1.4-M3-eap-163 2020-06-26 16:17:26 +03:00
Mikhail Zarechenskiy
e0f0f5da8d Don't silently ignore argument mismatch for provide delegate
#KT-39816 Fixed

(cherry picked from commit a87b25d10e)
2020-06-26 14:29:15 +03:00
Mikhail Zarechenskiy
0bd70f877f Fix ambiguity on reference inside blocks of special functions
#KT-37058 Fixed

(cherry picked from commit ea5fef76d1)
2020-06-26 14:29:11 +03:00
Mikhail Zarechenskiy
0c468e17e0 Fix adaptation for references with default values after varargs
After vararg argument it's possible to pass values only by name, so
 here we modulate this behavior

 #KT-37721 Fixed

(cherry picked from commit c2c139ef4f)
2020-06-26 14:29:08 +03:00
Mikhail Zarechenskiy
16ca988f24 Callable reference adaptation should have dependency on API version 1.4
#KT-38069 Fixed

(cherry picked from commit c5a2ab2512)
2020-06-26 14:29:04 +03:00
Mikhail Zarechenskiy
611fa3a290 Prohibit functional interface constructor references
#KT-36706 Fixed

(cherry picked from commit bc40669598)
2020-06-26 14:29:00 +03:00
Mikhail Zarechenskiy
a74b2f1507 Don't skip constraints from equations with the kind equal
The problem was that we didn't incorporate T == Foo into K <: Inv<out T>.
 It happened because of optimisation that isn't applicable here as we
 already have projection in the initial type

 #KT-39777 Fixed

(cherry picked from commit a5ae1b38b0)
2020-06-26 14:28:57 +03:00
Mikhail Zarechenskiy
904f154cbf Fix coercion to Unit with equal Nothing constraint
#KT-39669 Fixed

(cherry picked from commit e7cee9c6e1)
2020-06-26 14:28:55 +03:00
Mikhail Zarechenskiy
59edd8dd20 Fix overload ambiguity after smartcast to nullable Nothing
#KT-39544 Fixed

(cherry picked from commit a06c8786df)
2020-06-26 14:28:52 +03:00
Ilya Kirillov
6f72dedd3c Wizard: update versions of used libraries for 1.4-M3
#KT-39503 fixed
#KT-39503 fixed

(cherry picked from commit 366a75e222)
2020-06-26 12:28:28 +03:00
Victor Petukhov
c3106be503 Commit trace for callable reference's LHS with reserved syntax like foo?::bar?::bar to avoid the lack of diagnostics reporting
^KT-35075 Fixed
2020-06-26 11:35:19 +03:00
Vladimir Ilmov
38ba0cd93a (CoroutineDebugger) fix for debugger agent doesn't start for -core 1.3.6 and up
Coroutine information will be missing otherwise

 #KT-39808 fix
2020-06-26 10:18:38 +02:00
Ilya Gorbunov
34ca070553 KT-38817 capitalize uses title case for the first char where available
This unifies its behavior with new capitalize overload with Locale.

Co-authored-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
(cherry picked from commit 33150a0809)
2020-06-25 21:47:02 +03:00
Ilya Gorbunov
00dc4046c1 Promote capitalize/decapitalize with Locale to stable
Relates to KT-28933

(cherry picked from commit 9e2f95233c)
2020-06-25 21:47:01 +03:00
Kirill Shmakov
60d415fd3a Fix Android app in template project
(cherry picked from commit b62e22cb01)
2020-06-25 21:45:42 +03:00
Raluca Sauciuc
b4865998de Restore KotlinExplicitMovementProvider in as40
(cherry picked from commit 9c8904f165)
2020-06-25 18:46:43 +02:00
Alexander Udalov
4239214520 Skip unresolved JvmStatic/JvmField annotations in builtins
This is needed to implement KT-30084 and KT-30083 after bootstrap.

(cherry picked from commit 05e8546bdb)
2020-06-25 18:44:37 +03:00
Alexey Trilis
b5b78d897c Fix testdata after changing API of kotlin.browser and kotlin.dom
(cherry picked from commit 593684ecb6)
2020-06-25 14:57:43 +03:00
Ilya Chernikov
fb7f14c551 [minor] clean up main-kts-dependencies 2020-06-25 11:45:54 +02:00
Ilya Chernikov
4140b38c31 Move main-kts cache test to out-of-process compilation
to avoid clashes with coroutine debugger when running
tests from IntelliJ
2020-06-25 11:45:54 +02:00
Ilya Chernikov
ad1cadb94e Fix coroutines core shading in main-kts 2020-06-25 11:45:54 +02:00
Dmitriy Dolovov
83d0043a5f Minor. Fix typo in text printed to users 2020-06-24 13:10:46 +07:00
Ilya Goncharov
b97156094e Fix new project wizard css support for karma
(cherry picked from commit e6539eade5)
2020-06-23 18:47:25 +03:00
Natalia Selezneva
85e3ad5bef Fix freeze during loading script configurations through legacy scripting API
Do not wrap the whole configuration loading process into readAction
^KT-39771 Fixed
2020-06-23 16:06:17 +03:00
Svyatoslav Kuzmich
4e959a5d3c [JS] Fix stack trace capturing from secondary constructors KT-37563 2020-06-23 15:27:33 +03:00
Svyatoslav Kuzmich
ad5df77251 [JS IR] Fix stack trace capturing in secondary constructors (KT-37563)
Call captureStack in primary constructors and generated factories
2020-06-23 15:27:33 +03:00
Svyatoslav Kuzmich
2ff4dd0891 [IR] Add IrRawFunctionReference 2020-06-23 15:27:33 +03:00
Ilya Gorbunov
3255debef3 Fix stdlib-js-ir-for-tests build
Exclude kotlinx.browser and kotlinx.dom packages

(cherry picked from commit b2e70f9c21)
2020-06-23 14:22:07 +03:00
Ilya Goncharov
8d218aefc4 Add enabling css into wizard
#KT-39770 fixed

(cherry picked from commit c9c20bb34c)

Refactor aligning for css support

#KT-39770 fixed

(cherry picked from commit b8aff0660c)

Add CSS support to new project wizard

#KT-39770 fixed

(cherry picked from commit 5676d31a1c)

Kind and css support to single platform JS

#KT-39770 fixed

(cherry picked from commit c2e97a7287)

Update test data

#KT-39770 fixed

(cherry picked from commit 852e860743)

Fix browser settings for webpack tasks

Fix test with css case

cssSettings -> cssSupport
2020-06-23 13:14:16 +03:00
Ilya Goncharov
4a6c5efd5c cssSettings -> cssSupport
(cherry picked from commit 793ada08a9)
2020-06-23 13:10:26 +03:00
Ilya Goncharov
84471282b7 Fix test with css case
(cherry picked from commit 538cf8af56)
2020-06-23 13:10:24 +03:00
Ilya Goncharov
9e7a4af91d Fix browser settings for webpack tasks
(cherry picked from commit 4ad95dbe0c)
2020-06-23 13:10:23 +03:00
Dmitriy Novozhilov
1d3559bac5 [FIR] Fix completing bodies of property setters with delegates
(cherry picked from commit be2ac3bb4f)
2020-06-23 00:52:00 +03:00
Dmitriy Novozhilov
0f195bf65d [FIR] Add transformBody to FirFunction
(cherry picked from commit 8ce28cb509)
2020-06-23 00:52:00 +03:00
Ilya Gorbunov
2c8344a339 Remove kotlin.coroutines.experimental package descriptions
(cherry picked from commit 23dc75fb87)
2020-06-23 00:52:00 +03:00
Ilya Gorbunov
2cb0e1584c Update API dumps
(cherry picked from commit 9d111b9451)
2020-06-23 00:51:59 +03:00
Ilya Gorbunov
f8dd945c4b Drop deprecated jsClass top level and extension functions
Introduce internal toplevel jsClass in js-ir source set instead.
It is needed for JS-IR backend.

(cherry picked from commit 6c8ff25e5d)
2020-06-23 00:51:59 +03:00
Ilya Gorbunov
54b6519694 Drop deprecated MutableMap property delegation operator
(cherry picked from commit 696701d377)
2020-06-23 00:51:59 +03:00
Ilya Gorbunov
9eeb024fa5 Drop deprecated CollectionAssertions.kt
Remove incorrect import from callByWithEmptyVarArg test

(cherry picked from commit 7632910ffd)
2020-06-23 00:06:07 +03:00
Ilya Gorbunov
6ea35d3934 Remove hidden Random.Companion
It was never released as stable since 1.3. Was provided for binary
compatibility with 1.3 prereleases.

(cherry picked from commit 5550dc93a1)
2020-06-23 00:06:05 +03:00
Ilya Gorbunov
51e977fd3d Drop previously deprecated API
- common and JS org.junit.Test from kotlin.test
- kotlin.Synchronized/Volatile from K/JS
- JS 'native' annotation

(cherry picked from commit b55729957e)
2020-06-23 00:06:03 +03:00
Ilya Gorbunov
65806649a6 Increase deprecation level for previously deprecated API
- unsupported common exceptions
- common 'synchronized'
- jquery API
- experimental kotlin.time API
- js Math object
- DefaultAsserter constructor-like fun

(cherry picked from commit e9c4f531eb)
2020-06-23 00:06:02 +03:00
Alexander Gorshenev
02df11bae8 Fix for KT-37761. Don't use mmap. It causes more troubles than it produce benefits 2020-06-22 19:10:05 +03:00
Andrei Klunnyi
1ba824af44 KT-36801 IDE: Unsupported language version values 2020-06-22 15:21:36 +02:00
Yaroslav Chernyshev
5883ee1328 [Gradle, CocoaPods] Improved CocoaPods Integration features with tests
(cherry picked from commit c638043aee)
2020-06-22 14:16:19 +03:00
Roman Artemev
64be011d49 [KLIB IC] Fix dirty declaration detector
- make kjs-stdlib be compiled correctly in IC mode

(cherry picked from commit 2c3d8feb26)
2020-06-22 11:32:05 +03:00
Ilya Gorbunov
81b78aeece Provide flatMapIndexed operation
- similar to flatMap, but transform function takes index and element

#KT-36894

(cherry picked from commit 130987fa1e)
2020-06-19 18:02:17 +03:00
Abduqodiri Qurbonzoda
d70a675e9e Initial template for flatMapIndexed operation
#KT-36894

(cherry picked from commit db93462bcf)
2020-06-19 18:02:16 +03:00
Sergey Igushkin
8d9949f62f Fix compilation of DukatCompilationResolverPlugin after rebase
(cherry picked from commit d9fea52344)
2020-06-19 17:51:37 +03:00
Sergey Igushkin
e341065bef (minor) Fixes for review KT-MR-1290
(cherry picked from commit f7b660b573)
2020-06-19 17:51:35 +03:00
Sergey Igushkin
00fb7058b7 Fixes for task configuration avoidance in Gradle Kotlin/JS support
(cherry picked from commit 10cae9bc5d)
2020-06-19 17:51:32 +03:00
Sergey Igushkin
e6b271b7d6 Move kotlinOptions out of the tasks
(cherry picked from commit 0b7d8c51cb)
2020-06-19 17:51:28 +03:00
Sergey Igushkin
a977e8ea09 Rework ScriptingGradleSubplugin for the new subplugins API
(cherry picked from commit 19ac036ec5)
2020-06-19 17:51:25 +03:00
Sergey Igushkin
9b572295ca Rework AndroidSubplugin for the new subplugins API
(cherry picked from commit cb5aa64a95)
2020-06-19 17:51:23 +03:00
Sergey Igushkin
2d9152b639 Rework SamWithReceiverSubplugin for the new subplugins API
(cherry picked from commit 48153c53ca)
2020-06-19 17:51:19 +03:00
Sergey Igushkin
32b9f83b3a (minor) Suppress a warning about property initialized with ctor param
(cherry picked from commit 120f77416b)
2020-06-19 17:51:15 +03:00
Sergey Igushkin
3a0b98fe6e Rework ExampleSubplugin for the new subplugins API
(cherry picked from commit 66a59df7de)
2020-06-19 17:51:11 +03:00
Sergey Igushkin
844c58e67a Rework SerializationSubplugin for the new subplugins API
(cherry picked from commit a2e4b52747)
2020-06-19 17:51:08 +03:00
Sergey Igushkin
94b8ea4837 Rework NoArgSubplugin for the new subplugins API
(cherry picked from commit 98fc4ab2e1)
2020-06-19 17:51:06 +03:00
Sergey Igushkin
83877b33e8 Rework AllOpenSubplugin for the new subplugins API
(cherry picked from commit f2bc391bdd)
2020-06-19 17:51:03 +03:00
Sergey Igushkin
9cef58cefd Rework Gradle subplugins application in Kotlin/Native
(cherry picked from commit e8a303650c)
2020-06-19 17:51:02 +03:00
Sergey Igushkin
454dced6bb Refactor the Kotlin Android plugin to make it compliant with TCA
Also simplify some of the APIs and move some others which are only used
by kapt to the kapt's codebase.

(cherry picked from commit 06a3376368)
2020-06-19 17:50:58 +03:00
Sergey Igushkin
26bcd82400 Refactor the kapt Gradle plugin to use the new plugins API and TCA
(cherry picked from commit 4dbc6803ba)
2020-06-19 17:50:12 +03:00
Sergey Igushkin
b71942b3dd Introduce new API for Kotlin compiler support Gradle plugins
The old API was too specific for the Kotlin internal use cases and
leaked some abstractions due to the missing target-compilation project
model. One of such leaking abstractions was the Gradle tasks being
exposed to the subplugin, which required the tasks to instantiate
in order for the subplugin to apply. This violated task configuration
avoidance, so the old API could never work in compliance with TCA.

Introduce the new KotlinCompilerPluginSupportPlugin API that uses the
compilations instead of the tasks and is TCA-compliant.

(cherry picked from commit 96ed30a449)
2020-06-19 17:50:10 +03:00
Sergey Igushkin
8a10a21712 Refactor Kotlin classes registration for java-library plugin
(cherry picked from commit 0b2d96c1ef)
2020-06-19 17:50:07 +03:00
Sergey Igushkin
5804ca3437 Use TCA-compliant Gradle APIs in the JS part of the Kotlin Gradle plugin
(cherry picked from commit 58dd0fa3d2)
2020-06-19 17:50:04 +03:00
Sergey Igushkin
587e418ba2 Use TCA-compliant Gradle APIs in the Kotlin Gradle plugin
(cherry picked from commit 58e9b3ae0e)
2020-06-19 17:50:01 +03:00
Sergey Igushkin
a3550c95b7 Add Java tasks to relevant compilation APIs
(cherry picked from commit 84287d77ca)
2020-06-19 17:49:52 +03:00
Sergey Igushkin
144a66347f (minor) Initialize compilations with the precise target type
(cherry picked from commit 1749cb9129)
2020-06-19 17:49:47 +03:00
Sergey Igushkin
ee20744fae Add TaskProvider property for Kotlin compile tasks in compilations
(cherry picked from commit f4e4baa253)
2020-06-19 17:49:29 +03:00
Ilya Gorbunov
d1f8f27b75 Leave StringBuilder.append/insert with non-nullable String parameter
Leave these methods as hidden in order to preserve binary compatibility.

#KT-39504

(cherry picked from commit 606fad64ad)
2020-06-19 17:42:47 +03:00
Sergey Rostov
a372aa2073 gradle scripts: fix isFirstLoadActual and notification typos 2020-06-19 17:01:50 +03:00
Mikhail Zarechenskiy
05c07032ee Fix compatibility resolve for references with multiple outer candidates
#KT-39533 Fixed

(cherry picked from commit 9c8e979308)
2020-06-19 16:55:29 +03:00
Mikhail Zarechenskiy
127156042b Add test for obsolete issue
The issue was fixed in df1595e

 #KT-39630 Fixed

(cherry picked from commit d44a7ff8f9)
2020-06-19 16:55:28 +03:00
Mikhail Zarechenskiy
5e6af8ee02 Enable test for new inference after df1595e4
Follow up KT-37149

(cherry picked from commit a067d138e9)
2020-06-19 16:55:28 +03:00
Mikhail Zarechenskiy
95276fc13b Fix SAM conversions for derived classes
#KT-39535 Fixed
 #KT-37149 Fixed

(cherry picked from commit df1595e4bc)
2020-06-19 16:55:28 +03:00
Mikhail Zarechenskiy
bb87e7817c Add test for obsolete issue
#KT-17341 Obsolete
 #KT-32958 Obsolete

(cherry picked from commit 3921a0ed70)
2020-06-19 16:55:27 +03:00
Sergey Rostov
8cbd4d1240 gradle scripts: custom notification wording gradle with default scripting support (gradle older then 6.0) 2020-06-19 16:39:20 +03:00
Sergey Rostov
f2d2bafd56 gradle scripts: "link project" action implementation 2020-06-19 16:39:20 +03:00
Sergey Rostov
9c34419a77 gradle scripts: temporary disable irrelevant actions when script configuration was not received during import 2020-06-19 16:39:20 +03:00
Abduqodiri Qurbonzoda
c168083ab6 Update js public api dump
(cherry picked from commit 6e5b94f695)
2020-06-19 16:13:51 +03:00
Abduqodiri Qurbonzoda
971142721e Deprecate contains, indexOf, lastIndexOf functions of Float/DoubleArray #KT-28753
(cherry picked from commit c923b2e139)
2020-06-19 16:13:49 +03:00
Abduqodiri Qurbonzoda
214913d21f Compare floating point values asList elements in total order #KT-28753
(cherry picked from commit 97c688057d)
2020-06-19 16:13:48 +03:00
Abduqodiri Qurbonzoda
11e2baac78 Update js public api dump
(cherry picked from commit bf26d87ee9)
2020-06-19 16:13:41 +03:00
Abduqodiri Qurbonzoda
a1b28fd6ce Introduce minWithOrNull and maxWithOrNull extension functions #KT-38854
(cherry picked from commit 16b62b8e65)
2020-06-19 16:13:39 +03:00
Abduqodiri Qurbonzoda
abc6ca2b37 Introduce minByOrNull and maxByOrNull extension functions #KT-38854
(cherry picked from commit 194791a168)
2020-06-19 16:13:37 +03:00
Abduqodiri Qurbonzoda
8e2e1f63c7 Introduce minOrNull and maxOrNull extension functions #KT-39064
(cherry picked from commit 846a7823ad)
2020-06-19 16:13:36 +03:00
Mikhail Bogdanov
87aa084225 Fix test data
(cherry picked from commit 58183b774d)
2020-06-19 15:09:15 +02:00
Alexey Trilis
1f04feddf3 Deprecate kotlin.browser and kotlin.dom packages and provide
replacements in packages kotlinx.dom and kotlinx.browser

KT-39330 Fixed

(cherry picked from commit 99d844dcfb)
2020-06-19 16:03:03 +03:00
Ilya Chernikov
3ad6d5ca35 Add classpaths from all plugin classloaders to the console scripts 2020-06-19 14:57:56 +02:00
Ilya Chernikov
51333d4d0b Load script configuration under read action - avoid possible exception 2020-06-19 14:57:55 +02:00
Natalia Selezneva
595927f687 Filter only valid roots in KotlinScriptDependenciesClassFinder
ClassFinder should return only valid roots,
but in allScriptsDependenciesClassFiles may contain old roots
because they are persistently saved in the storage.
This may cause exception after IDE restart

(cherry picked from commit 44f6a5adcd)
2020-06-19 15:54:18 +03:00
Natalia Selezneva
bff86a335e Add registry key to hide new Load Script Configurations action
(cherry picked from commit d119298232)
2020-06-19 15:54:18 +03:00
Natalia Selezneva
c0c91460d0 Do not start gradle import if it is already in progress
(cherry picked from commit b43014a097)
2020-06-19 15:54:18 +03:00
Natalia Selezneva
2e114dcf35 Floating notification shouldn't be shown during import
It depends on up to date check that is correct only after all caches are updated after import

(cherry picked from commit 66e23c9767)
2020-06-19 15:54:17 +03:00
Dmitriy Dolovov
7fa8e68ca8 [Commonizer] Replace j.u.HashMap by g.t.THashMap to reduce memory usage 2020-06-19 19:35:27 +07:00
Dmitriy Dolovov
923b736f37 [Commonizer] Intern duplicated CirContainingClassDetails instances 2020-06-19 19:24:40 +07:00
Dmitriy Dolovov
5b27cf679f [Commonizer] Intern duplicated CirFunctionModifiers instances 2020-06-19 19:24:34 +07:00
Dmitriy Dolovov
fb9ab023e3 [Commonizer] More detailed progress logging 2020-06-19 19:24:27 +07:00
Dmitriy Dolovov
cb18fc8893 Minor. Replace computeIfAbsent() by getOrPut() 2020-06-19 19:24:21 +07:00
Dmitriy Dolovov
a30370bdcd [Commonizer] Rework preparation of CIR cache in TypeCommonizerTest 2020-06-19 19:24:13 +07:00
Dmitriy Dolovov
2fc3c11f32 [Commonizer] Rework CommonizedGroup API to make it more usable 2020-06-19 19:24:01 +07:00
Dmitriy Dolovov
100b9314cf [Commonizer] Reduce memory consumption during approximation phase
^KT-39320
2020-06-19 19:23:55 +07:00
Ilya Chernikov
de5cfa0812 Clean-up and improve sam-with-receiver test with scripts 2020-06-19 14:11:38 +02:00
Ilya Chernikov
42a7b1ad45 Add serialization plugin test with main-kts 2020-06-19 14:11:37 +02:00
Ilya Chernikov
4272180ad3 Implement non-transitive dependencies resolving in main-kts 2020-06-19 14:11:37 +02:00
Ilya Chernikov
e28b0cbdc3 Add error reporting on the options parsing errors in scripting
also report standard parsing warnings
also fix language version test, since it is not possible anymore
  to use version 1.0
2020-06-19 14:11:36 +02:00
Mathias Quintero
c657aa5f56 Fix annotation construction with array literals
Turns out the issue happens to be that ArrayValue uses a list of values which needs to be translated to an array of the percise type before it is used by callBy

This also addresses handling of arguments after a vararg in an annotation
2020-06-19 14:11:36 +02:00
Efeturi Money
b403081a2f Explicitly handle array annotation args in scripting pre-processing
#KT-35411 fixed
2020-06-19 14:11:35 +02:00
Ilya Muradyan
bb4a35a788 Don't create default importing scopes for REPL snippets
Default scopes should be created only once, for the first snippet.
All following snippets should not create new default importing scopes.
#KT-35651 fixed
2020-06-19 12:59:40 +02:00
Ilya Muradyan
276fb265a8 Allow not to create default importing scopes 2020-06-19 12:59:40 +02:00
Ilya Muradyan
a13faab02b Refactor REPL IDE services testing configuration and add new tests 2020-06-19 12:59:40 +02:00
Ilya Muradyan
150c958782 Support selective filtering of implicits for extensions resolution in REPL 2020-06-19 12:59:40 +02:00
Ilya Muradyan
130d401184 Allow skipping extensions resolution for implicit receivers 2020-06-19 12:59:40 +02:00
Mikhail Bogdanov
44930a59fa Fix compilation
(cherry picked from commit 8bc4407be0)
2020-06-19 12:55:22 +02:00
Mikhail Bogdanov
6e7a79bc16 Report error on missed specialization in compatibility mode
#KT-39603 Fixed

(cherry picked from commit 9c0b96af71)
2020-06-19 12:43:54 +02:00
Mikhail Bogdanov
a2e3166f3e Don't forget about extension parameter in methodSignatureMapping.kt
(cherry picked from commit a150e7b6e5)
2020-06-19 12:43:53 +02:00
Mikhail Bogdanov
c5068c2296 Move common logic from CodegenTestCase to KotlinBaseTest
(cherry picked from commit 929bb0e8d1)
2020-06-19 12:43:52 +02:00
Mikhail Bogdanov
8d8861b887 Make proper check for defaults on delegation to DefaultImpls
(cherry picked from commit 9d48ecfac3)
2020-06-19 12:43:52 +02:00
Mikhail Bogdanov
06e1550924 Generate nullability annotations on this receiver in DefaultImpls. Don't generate nullability annotations in private methods
#KT-36969 Fixed

(cherry picked from commit b8f0ad2111)
2020-06-19 12:43:15 +02:00
Mikhail Bogdanov
8f8f901b2e Don't generate compatibility stubs for @JvmDefaultWithoutCompatibility
(cherry picked from commit 5bdf3d5757)
2020-06-19 12:41:01 +02:00
Mikhail Bogdanov
2321ddad79 Add JvmDefaultWithoutCompatibility annotation
(cherry picked from commit 477cca3c99)
2020-06-19 12:41:01 +02:00
Pavel Kirpichenkov
cf2a554c78 Use bound resolution facade in DeprecationResolver usages
Resolution facade should be used consistently with direct usages of frontend components.
Otherwise they can start processing descriptors from foreign resolvers which leads to memory leaks.

Plain resolution API with provided facade is not suitable as-is for compiled declarations in KotlinIndicesHelper though.
Resolution facade for module sources contained in helper can't handle decompiled
sources from PSI indices (leads to "ModuleInfo not contained in resolver" errors).
That's why "hacked" resolve via import references should be used there.

#KT-39642 Fixed
2020-06-19 12:36:20 +03:00
Pavel Kirpichenkov
1ed04ff939 Fix tests 2020-06-19 12:35:50 +03:00
Dmitry Savvinov
e32308af02 Check for native-shared source-sets properly during facet import
Otherwise they are detected as common source-sets, thus getting
K2MetadataCompilerArguments (instead of FakeK2NativeCompilerArguments),
and the 'applyCompilerArgumentsToFacets' will fail due to check on
javaClass equality

^KT-39657 Fixed
2020-06-19 12:18:21 +03:00
Ilya Goncharov
e126402267 [Gradle, JS] Add webpackConfig for karma
#KT-39654 fixed

(cherry picked from commit ce553f1211)
2020-06-19 11:41:03 +03:00
Ilya Goncharov
c575dae3d9 [Gradle, JS] Disable css support by default
#KT-39654 fixed

(cherry picked from commit 48a4e08d60)
2020-06-19 11:41:02 +03:00
Ilya Goncharov
32606dbd16 [Gradle, JS] Allow to change destDir only for separate task and name it destinationDir
#KT-38331 fixed

(cherry picked from commit 932cf21776)
2020-06-19 11:26:57 +03:00
Ilya Goncharov
3ddfd706a3 [Gradle, JS] AbstractDukatTask -> DukatTask
#KT-38331 fixed

(cherry picked from commit 7386408e94)
2020-06-19 11:26:57 +03:00
Ilya Goncharov
d43975d55a [Gradle, JS] DukatTask -> IntegratedDukatTask
#KT-38331 fixed

(cherry picked from commit 49dd839131)
2020-06-19 11:26:57 +03:00
Ilya Goncharov
c15b9128a7 [Gradle, JS] Add task for separate usage of Dukat with project npm dependencies
#KT-38331 fixed

(cherry picked from commit 46be588f27)
2020-06-19 11:26:57 +03:00
Ilya Kirillov
486b910963 Wizard: group project templates into the categories on the first step
#KT-39700 fixed

(cherry picked from commit 11a680d7d8)
2020-06-19 10:00:32 +03:00
Ilya Kirillov
9b5c01ad6a Wizard: use new icons in UI
(cherry picked from commit bfedeed2c1)
2020-06-19 10:00:31 +03:00
Ilya Kirillov
5c44096828 Wizard: fix ui constants
(cherry picked from commit 7df0dd5032)
2020-06-19 10:00:30 +03:00
Victor Petukhov
4aed5fc5fc NI: clean calls in coroutine inference before the second analysis of += only for right side
^KT-39660 Fixed

(cherry picked from commit ece61915de)
2020-06-18 23:09:53 +03:00
Victor Petukhov
75acd603e4 Revert "Revert "NI: clear calls info in coroutine inference before the second analysis of += right side""
This reverts commit 2fa26fef
2020-06-18 23:09:43 +03:00
Ilya Muradyan
6dae86aa51 Add missing definitelyDoesNotContainName methods
(cherry picked from commit 8c2baf0704)
2020-06-18 22:54:02 +03:00
Ilya Muradyan
984d3cd736 Add missing recordLookup implementations
(cherry picked from commit 573c60ed6b)
2020-06-18 22:54:01 +03:00
Ilya Muradyan
f2a8e6a9cd Compare lookups without respect to their order
(cherry picked from commit 7526ff9484)
2020-06-18 22:54:01 +03:00
Natalia Selezneva
4ac0fa2e95 Run partial import only for specified build root
(cherry picked from commit bf1ad44af9)
2020-06-18 21:17:57 +03:00
Natalia Selezneva
e5544069f7 Workaround for bug in GradleInstallationManager.resolveGradleVersion()
Wrong gradle version when wrapper is used
fixed in 201

(cherry picked from commit 5fe47ffbec)
2020-06-18 21:17:55 +03:00
Natalia Selezneva
c93c6e5d16 Get gradle version and gradle home from corresponding BuildModel after import
GradleProjectSettings that were used, are updated after KotlinDslListener is called,
so it isn't correct to check if kotlinDslModels are supported using it.
Also GradleScriptDefinitionsContributor should use gradle home from BuildModel, not from settings for the same reasons.

^KT-39104 Fixed

(cherry picked from commit 7a47994498)
2020-06-18 21:17:46 +03:00
Natalia Selezneva
f7806558c0 Load script definitions only from production source root and libraries
Exclude not connected to current project roots

EA-210662 Fixed

(cherry picked from commit d1c88798df)
2020-06-18 21:16:57 +03:00
Ilya Matveev
1997bb5207 [Gradle, native] Allow parallel in-process compiler execution
This commit allows parallel in-process execution of the K/N compiler
that was prohibited by 254a978a06.

Issue #KT-38991 fixed
2020-06-18 21:21:03 +07:00
Ilya Matveev
c9215ba09f [klib] Create ZipFileSystem from a Path instead of an URI
Calling FileSystems.newFileSystem(URI, ...) throws a
FileSystemAlreadyExistsException if a ZipFileSystem for this
URI is already created. We still can use a single instance
of ZipFileSystem by calling FileSystems.getFileSystem. In
this case we use reference counting to determine when this
instance can be safely closed.

But we cannot count references if the same ZipFileSystem is used
from different class loaders. This patch fixes this issue by
creating a file system from Path instead of an URI. Contract of
FileSystemProvider.newFileSystem(Path, ...) doesn't imply throwing
FileSystemAlreadyExistsException.

Issue #KT-37443 fixed
2020-06-18 21:21:02 +07:00
Ilya Goncharov
b4aeb89b55 [Gradle, JS] Remove custom source-map-loader
#KT-39377 fixed

(cherry picked from commit 4bbead6200)

[Gradle, JS] Remove trailing commas from webpack config

#KT-39377 fixed

(cherry picked from commit 69b9a2e98a)

[Gradle, JS] Filter warning with source maps

#KT-39377 fixed

(cherry picked from commit 97e4d23d75)

[Gradle, JS] All regular text printed to DEBUG

(cherry picked from commit c5aa35e016)

#KT-39665 fixed
2020-06-18 14:55:24 +03:00
Alexander Udalov
ee2c3b27e2 Fix expected FQ name in JavaTypeTest.nestedTypes
(cherry picked from commit 650469024e)
2020-06-18 13:19:51 +03:00
Ilya Gorbunov
cdfb17bea8 Update public jvm API dump after introduction of javaType
See 9e37b62f62

(cherry picked from commit ec5a04a6c7)
2020-06-18 12:54:48 +03:00
Ilya Gorbunov
942173f3ee Fix OnlyInputType usage in tests where it can be invisible
(cherry picked from commit e13a38a758)
2020-06-18 12:54:48 +03:00
Ilya Gorbunov
463da96885 Do not place copyrights in stdlib api dump .kt files
(cherry picked from commit 95625d0fae)
2020-06-18 12:54:48 +03:00
Florian Kistner
4ccf107ba1 Don't apply copyright notice to Kotlin Ultimate
(cherry picked from commit 71a45e56d7)
2020-06-18 12:54:47 +03:00
Ilya Gorbunov
ae33b3c281 Shadow addSuppressed member with an extension
#KT-38777

(cherry picked from commit 41131e46d7)
2020-06-18 12:54:47 +03:00
Ilya Gorbunov
7a1b045fea Add SKIP_DCE_DRIVEN directive in JS-IR tests
Otherwise they fail with a compiler exception:
"An operation is not implemented: SAM conversion"

(cherry picked from commit 2fe222e8e7)
2020-06-18 12:54:47 +03:00
Ilya Gorbunov
9afbcb3f54 Make ReadOnlyProperty and PropertyDelegateProvider fun interfaces
(cherry picked from commit de6154980d)
2020-06-18 12:54:47 +03:00
Ilya Gorbunov
91b242d8a6 Make Comparator fun interface in Common and JS
(cherry picked from commit d2ea108123)
2020-06-18 12:54:47 +03:00
Igor Chevdar
c5768e2ad0 [IR] Supported extension receivers in SAM conversions 2020-06-18 13:30:53 +05:00
Dmitry Savvinov
17f852e4b4 Make sure that commonizer is enabled before adding -no-default-libs argument
^KT-39632 Fixed
2020-06-18 11:05:09 +03:00
Igor Chevdar
e601006043 Added a test 2020-06-18 12:51:02 +05:00
Igor Chevdar
8af22c9c35 [IR] Supported IrEnumEntry
Fixes https://youtrack.jetbrains.com/issue/KT-38996
2020-06-18 12:50:50 +05:00
Ilya Gorbunov
7fe7f5e50a Increase memory for Kotlin compile daemon to 2200M
(cherry picked from commit 388e619d90)
2020-06-18 09:07:42 +03:00
Ilya Gorbunov
84d27b4710 Advance bootstrap to 1.4-M3-eap-102 2020-06-18 09:07:42 +03:00
Stanislav Erokhin
d9a03db329 Revert "Add missing definitelyDoesNotContainName methods"
This reverts commit d324cd91
2020-06-18 07:50:31 +03:00
Vladimir Ilmov
68864eaf72 (CoroutineDebugger) -core jar has precedence over -debug
#KT-39412 fixed
 #KT-39648 fixed
2020-06-17 23:52:01 +02:00
Stanislav Erokhin
2fa26fefa0 Revert "NI: clear calls info in coroutine inference before the second analysis of += right side"
This reverts commit cd469bcaf5.
2020-06-17 20:20:02 +03:00
Alexander Udalov
3d3a9ad0b8 Use experimental javaType in full reflect where it's not supported yet
#KT-22936 Fixed
 #KT-34344 Fixed

(cherry picked from commit 117aae8a6b)
2020-06-17 18:34:42 +02:00
Alexander Udalov
0bd07c51db Support KType.javaType in stdlib
#KT-32241 Fixed

(cherry picked from commit 9e37b62f62)
2020-06-17 18:34:40 +02:00
Sergey Rostov
2c2f22cc90 gradle.kts standalone scripts: show actions inside single notification 2020-06-17 16:52:56 +03:00
Sergey Rostov
fbd3092bbb gradle.kts legacy: out of project script notification 2020-06-17 16:52:56 +03:00
Sergey Rostov
9f081cfeaa minor: rename GradleScriptNotificationProvider 2020-06-17 16:52:56 +03:00
Sergey Rostov
55747fb64f gradle.kts: check gradle version before loading from fs cache 2020-06-17 16:52:56 +03:00
Sergey Rostov
8cae8fcc10 default scripting support: remove notifications after script definitions update 2020-06-17 16:52:56 +03:00
Sergey Rostov
5a7ef83963 gradle.kts: update notification only after caches updated 2020-06-17 16:52:56 +03:00
Sergey Rostov
90f3ed5a1e GradleScriptConfigurationsImportingFeature 2020-06-17 16:52:56 +03:00
Sergey Rostov
65969b4018 gradle.kts postponed loading: hide notifaction right after click on action 2020-06-17 16:52:55 +03:00
Sergey Rostov
c88c8ae145 gradle.kts standalone scripts: load configuration after switching without prompt 2020-06-17 16:52:55 +03:00
Sergey Rostov
d14795139f gradle.kts, minor: cleanup & simplify code 2020-06-17 16:52:55 +03:00
Sergey Rostov
85e512faab gradle.kts legacy: don't start loading without prompt on first opening 2020-06-17 16:52:55 +03:00
Sergey Rostov
d3f5725e75 gradle.kts: update notifications when scripting support was changed 2020-06-17 16:52:55 +03:00
Sergey Rostov
efe47e8573 GradleBuildRootsManager: check gradle version change in gradle-wrapper.properties 2020-06-17 16:52:55 +03:00
Sergey Rostov
45c87dc15a scriptConfigurationsNeedToBeUpdatedBalloon registry key 2020-06-17 16:52:55 +03:00
Sergey Rostov
61c0261b94 GradleBuildRootsManager: update notifications in corner cases
- notification for all visible editors should be updates on each change,
since it may depend on last modified ts.
- notifications should be updated only for active editors, not all opened
- we should recheck it on editor activation too
- analyzer should be restarted on roots update only
2020-06-17 16:52:55 +03:00
Sergey Rostov
247453df3b GradleBuildRootsManager: implement getScriptFirstSeenTs 2020-06-17 16:52:54 +03:00
Sergey Rostov
c5661daa72 GradleScriptNotifications: suggest to import and link gradle project 2020-06-17 16:52:54 +03:00
Sergey Rostov
56c2495999 GradleScriptNotifications: extract and fix i18n strings 2020-06-17 16:52:54 +03:00
Sergey Rostov
e6d5fdc81f GradleBuildRootsManager: fix for autoload 2020-06-17 16:52:54 +03:00
Sergey Rostov
f7f4a7d532 GradleScriptNotifications: typo in code 2020-06-17 16:52:54 +03:00
Sergey Rostov
e9637abb24 GradleBuildRoot: ability to detect if file was existed before import 2020-06-17 16:52:54 +03:00
Sergey Rostov
d98e3a4d08 GradleBuildRootsManager, minor: fix notifications 2020-06-17 16:52:54 +03:00
Sergey Rostov
855ff3d4cd GradleBuildRoot: require LastModifiedFiles explicitly 2020-06-17 16:52:54 +03:00
Sergey Rostov
b39f184868 GradleBuildRoot: remove classes nesting 2020-06-17 16:52:53 +03:00
Sergey Rostov
133b4cbf1a gradle.kts: standalone scripts support (without ui and persistence) 2020-06-17 16:52:53 +03:00
Sergey Rostov
61ae186631 scripting: drop ManualConfigurationLoading and kotlin.gradle.scripts.useIdeaProjectImport registry flag 2020-06-17 16:52:53 +03:00
Sergey Rostov
38de675fef LastModifiedFiles: fix concurrency 2020-06-17 16:52:53 +03:00
Sergey Rostov
3393a222df GradleBuildRoot: std scripts under project roots should be treated as new 2020-06-17 16:52:53 +03:00
Sergey Rostov
74b3af0a2c GradleBuildRoot: add projects from settings
Fir the cases when they are missed absent in imported data
2020-06-17 16:52:53 +03:00
Sergey Rostov
3957be447a GradleBuildRoot: extract GradleBuildRootsLocator for testing 2020-06-17 16:52:53 +03:00
Ilya Chernikov
a37df6ec3f Fix SamWithReceiver tests for scripts, add tests...
that use new script definition and ability to load
annotations from script definition
2020-06-17 15:10:38 +02:00
Ilya Chernikov
bf40aaf596 Process compiler plugins and options in scripting compiler
#KT-37766 fixed
2020-06-17 15:10:37 +02:00
Ilya Chernikov
7088aabc6b [minor] Add serialization plugin to kotlin paths 2020-06-17 15:10:37 +02:00
Sergey Igushkin
19ddaf5089 VariantAwareDependenciesIT.kt: remove compile/runtime/... configurations
(cherry picked from commit e4e70f1b5b)
2020-06-17 13:40:58 +03:00
Sergey Igushkin
ea29eb9ec2 Fixup BuildCacheRelocationIT: Gradle 5.6.1 -> 5.6.4 (AGP requirement)
(cherry picked from commit 52b29b53bc)
2020-06-17 13:40:57 +03:00
Sergey Igushkin
14b3b3c7a3 Fix BuildCacheIT and BuildCacheRelocationIT
* Adjust the log checks for newer Gradle versions
* Use AGP 3.6.0 and Gradle 5.6.1 as the older version

(cherry picked from commit 603bae398f)
2020-06-17 13:40:56 +03:00
Sergey Igushkin
098921a249 Fix unused source sets missing in compilationsBySourceSets (KT-39304)
Issue #KT-39304 Fixed

(cherry picked from commit f7ed3139ab)
2020-06-17 13:40:48 +03:00
Vladimir Ilmov
4685c99cbd (CoroutineDebugger) fails to start in gradle mode
#KT-39634 fixed
2020-06-17 10:10:19 +02:00
Mikhail Glukhikh
168e1e00cf Add more detailed exception message in KtExpression.isUsedAsExpression
(cherry picked from commit d385a9b29e)
2020-06-17 10:51:16 +03:00
Ilya Chernikov
78d6ce2672 Add script definition for extension scripts and...
IDE consoles.
2020-06-17 09:33:26 +02:00
Victor Petukhov
af203f1a70 Use lexical scope from trace during checking suspend context if the analysis of engaged parent function isn't completed
^KT-39461 Fixed

(cherry picked from commit 901b794af3)
2020-06-17 10:30:23 +03:00
Victor Petukhov
cd469bcaf5 NI: clear calls info in coroutine inference before the second analysis of += right side
^KT-39376 Fixed

(cherry picked from commit 982cbf1148)
2020-06-17 10:30:17 +03:00
Dmitriy Dolovov
c818a33b29 IDE perf tests for K/N: Re-enable PerformanceNativeProjectsTest 2020-06-17 12:04:31 +07:00
Dmitriy Dolovov
da0c5a867c IDE perf tests for K/N: Add assertion on failed Gradle project import 2020-06-17 12:04:26 +07:00
Dmitriy Dolovov
24f8c14b8c IDE perf tests for K/N: Switch to 1.4-M2 2020-06-17 12:04:19 +07:00
Dmitriy Dolovov
9f07c0c568 [Commonizer] Fix incorrect merging KLIB dependencies
^KT-39609
2020-06-17 11:38:54 +07:00
Ilya Muradyan
5d5c83f26d Fix build error messages
(cherry picked from commit 9db9e2ad57)
2020-06-16 18:25:19 +02:00
Alexander Gorshenev
4cd3459bc3 Allow dynamic types in ir fake override substitution arguments 2020-06-16 18:59:03 +03:00
Ilya Goncharov
88817213ee [Gradle, JS] Rename generateKotlinExternals on generateExternals
(cherry picked from commit 6316949e36)

[Gradle, JS] In npm dependency extension use default generate value from properties

(cherry picked from commit eb6e797001)
2020-06-16 18:35:33 +03:00
Ilya Chernikov
c0cbe42165 Convert contributed descriptors to list...
without this `KDocCompletionTestGenerated,testExtensionsFQLink`, which
most likely point to some broken contract in the test.

(cherry picked from commit d7df249480)
2020-06-16 13:50:35 +02:00
Dmitriy Dolovov
7579d19fb4 [Commonizer] Fallback for const val properties with different values 2020-06-16 15:04:37 +07:00
Abduqodiri Qurbonzoda
433983cd00 Promote ArrayDeque and MutableList.removeFirst/LastOrNull to stable
(cherry picked from commit b93c49afae)
2020-06-16 04:16:10 +03:00
Ilya Gorbunov
62d508c024 Add run configuration for stdlib-js ApiTest
(cherry picked from commit d5ae06e7ed)
2020-06-16 00:42:30 +03:00
Ilya Gorbunov
654644519d Use fixed versions of node.js and npm packages in tests
(cherry picked from commit 05f9154bdd)
2020-06-16 00:42:30 +03:00
Ilya Gorbunov
b202b183fe Allow shadowing member addSuppressed with extension
#KT-38777

(cherry picked from commit 535534cf66)
2020-06-16 00:42:29 +03:00
Valeriy.Vyrva
9c869ef21b Create SortedMap with Comparator and items
KT-34142

(cherry picked from commit c023a02884)
2020-06-16 00:42:29 +03:00
Mikhail Bogdanov
d6b710edef Don't use labels for caching
Avoid new objects creation

(cherry picked from commit fe4bb24a3e)
2020-06-15 18:46:07 +02:00
Mikhail Bogdanov
25436a5ae2 Fix compilation with ASM 8
General rule to use linkedLabel or linkWithLabel
  when label from node is reused in other instructions.
  If label is not linked then it will point to another labelNode when visited

  #KT-39013 Fixed

(cherry picked from commit db50afeafe)
2020-06-15 18:46:02 +02:00
Dmitriy Dolovov
1ec64d23e1 [Commonizer] More precise approximation of callables 2020-06-15 16:14:21 +07:00
Dmitriy Dolovov
66770a3026 [Commonizer] Stats collector: support aggregated stats 2020-06-15 16:14:15 +07:00
Dmitriy Dolovov
3810278af2 [Commonizer] Update stats collector: report receivers & parameters 2020-06-15 16:14:08 +07:00
Dmitriy Dolovov
db83afe407 Minor. Rename excludes list 2020-06-15 16:13:25 +07:00
Anton Bannykh
7356a66ae0 JS stdlib api test: various changes
- Setting -Doverwrite.output=true updates gold data
- Big packages don't get split into chunks
- Unique lines in the API are marked with /*∆*/ and diff test is removed
- Annotations on separate lines and other dump format tweaks
- Test data moved to libraries/stdlib/api/
- Minor visibility fix to Enum members

(cherry picked from commit 04ab8943d6)
2020-06-15 11:51:41 +03:00
Igor Chevdar
a5972eb0cf Added a test on possible name clash for SAM wrappers 2020-06-15 12:49:27 +05:00
Igor Chevdar
20b6ec857a [IR] Improved tuning of SAM wrapper visibility 2020-06-15 12:49:15 +05:00
Lilia
4ec68832eb Add changelog for 1.4-M2 2020-06-12 14:14:49 +02:00
Ilmir Usmanov
386645d9ef Forbid val field initialization inside EXACLTY_ONCE lambda
unless the lambda is inline. This way, final field will remain final.
2020-06-12 05:53:37 +02:00
Konstantin Tskhovrebov
a52bde34aa Revert "Add tests for setup native run gutters."
This reverts commit d61e40e4

(cherry picked from commit 032d017c4f)
2020-06-11 17:29:52 +03:00
Nikolay Krasko
69bca4f0fe 202: Restrict compatibility for 201 plugin
(cherry picked from commit bc20464bad)
2020-06-11 16:01:31 +03:00
Nikolay Krasko
23bcd4b247 AS41: Fix problems with initialization of Android plugin in tests
org/intellij/images/fileTypes/ImageFileTypeManager
java.lang.NoClassDefFoundError: org/intellij/images/fileTypes/ImageFileTypeManager
	at org.jetbrains.android.AndroidPlugin.lambda$registerWebpSupport$1(AndroidPlugin.java:50)

(cherry picked from commit 6babc73320)
2020-06-11 16:01:31 +03:00
Nikolay Krasko
2343845ce7 202: Fix compilation in DefaultDiagnosticReporter
(cherry picked from commit 7190b3400f)
2020-06-11 16:01:30 +03:00
Nikita Bobko
133626fb1d 202: Fix compilation
(cherry picked from commit ff7576f8e4)
2020-06-11 16:01:30 +03:00
Nikita Bobko
045d502005 202: Fix compilation because of CoreJarVirtualFile
CoreJarVirtualFile is now package private. And seems that
most of VirtualFiles return system independent path

(cherry picked from commit eb67c4519d)
2020-06-11 16:01:30 +03:00
Nikolay Krasko
559612e5c0 202: Disable check for broken plugins in tests
Otherwise is is an exception in PluginManagerCore
because of brokenPlugins.txt file.

(cherry picked from commit 256bd8d594)
2020-06-11 16:01:30 +03:00
Nikolay Krasko
06c071c158 202: Add fastutil dependency to compiler for to make proguard work
(cherry picked from commit 143cad78bf)
2020-06-11 16:01:29 +03:00
Nikolay Krasko
999ed15719 202: Update dependencies
(cherry picked from commit cc709a2ef9)
2020-06-11 16:01:29 +03:00
Nikolay Krasko
702d7c3722 202: Update to the latest EAP
(cherry picked from commit 8485532856)
2020-06-11 16:01:29 +03:00
Ilya Chernikov
dac21d9fbc Optimize AllUnderImportScope 2020-06-11 13:21:54 +02:00
Ilya Chernikov
39bf821844 Optimize resolution scope queries from the synthetic scopes
now required descriptors are queried in advance and passed to the
methods, to avoid multiple same name queries in a row
2020-06-11 13:21:54 +02:00
Ilya Chernikov
268d42a2fd Optimize scopes handling inside ChainedMemberScope 2020-06-11 13:21:53 +02:00
Ilya Chernikov
85b823fba3 Optimize scopes handling inside LexicalChainedScope 2020-06-11 13:21:53 +02:00
Ilya Chernikov
0c2824f1cc Optimize data handling inside scopes 2020-06-11 13:21:53 +02:00
Ilya Chernikov
be8983ee34 Optimize LazyScopeAdapter internals 2020-06-11 13:21:53 +02:00
Ilya Muradyan
62b6c9a277 Fix importing scopes problem for scripting REPL
We don't need to add any importing scopes for a snippet if it doesn't
contain import directives. This fix optimizes performance by reducing
importing scopes count.
2020-06-11 13:21:53 +02:00
Ilya Muradyan
d324cd91c1 Add missing definitelyDoesNotContainName methods
Some implementations of definitelyDoesNotContainName method were
missing that led to performance problems during symbols resolution
using TowerResolver.

Relates to KT-39139.
2020-06-11 13:21:53 +02:00
Ilya Muradyan
e9d3faffec Add overload to comply with the contract
Method getVariableNames() should return all variable names, but in the
inherited implementation it doesn't return resX names which represent
result fields.
2020-06-11 13:21:53 +02:00
Ilya Muradyan
4843d998ea [minor] Fix typo in comment 2020-06-11 13:21:52 +02:00
Ilya Matveev
362ea857de Update K/N: 1.4-M3-eap-10 2020-06-11 11:02:38 +07:00
Ilya Chernikov
3689f76e22 [minor] Fix textdata after reapplying commit w\ CompilerMessageLocation
(cherry picked from commit 69d5635aae)
2020-06-10 17:20:34 +02:00
Mathias Quintero
0a19571d5d Add options param to external dependencies resolver API 2020-06-10 17:19:57 +02:00
Mathias Quintero
ec84ae6dfa Add API to get locations of collected script annotations
#KT-38404 fixed

also:
- Add wrapper class for the location combined with the location id
- Add source code location parameters to external dependency resolvers
- Add tests for locations in annotations
- Add tests for order of annotation resolution for dependencies resolvers
2020-06-10 17:19:56 +02:00
Konstantin Tskhovrebov
a00a85869c Add tests for setup native run gutters.
(cherry picked from commit d61e40e49b)
2020-06-10 16:01:18 +03:00
Konstantin Tskhovrebov
8ddc96778e Fix for 192: enable native run gutters only if gradle plugin exists.
Fixed #KT-39465

(cherry picked from commit 39e1f03cd1)
2020-06-10 16:01:16 +03:00
Ilya Goncharov
861e20267f [Gradle, JS] Fix name of publication in both mode
(cherry picked from commit 18914ac9a5)
2020-06-10 14:58:19 +03:00
Ilya Goncharov
c6316ddf77 [Gradle, JS] Fix isMain in js targets
(cherry picked from commit 60d62148e8)
2020-06-10 14:58:18 +03:00
Ilya Goncharov
e70e8fd10b [Gradle, JS] Remove Native Only isMainCompilation only
(cherry picked from commit b72f7c3021)
2020-06-10 14:58:16 +03:00
Ilya Goncharov
5df39478f6 [Gradle, JS] Use common isMain for KotlinCompilation
(cherry picked from commit 2d068a42f4)
2020-06-10 14:58:15 +03:00
Dmitriy Dolovov
245ce4b114 Minor. Remove unused code 2020-06-10 18:41:32 +07:00
Dmitriy Dolovov
a4ca2b8618 [Commonizer] Speed-up serialization of commonized member scopes 2020-06-10 18:15:59 +07:00
Ilya Goncharov
a85e4fbf0b [Gradle, JS] Fix error message for both executable 2020-06-10 11:23:51 +03:00
Alexander Udalov
e87abaee3b Minor, remove unneeded check in ClosureCodegen
Actually we do need to generate delegates to DefaultImpls even for Java
SAM wrappers, so this condition is incorrect. However, this never worked
properly anyway because of KT-12466.

(cherry picked from commit e3a23aed33)
2020-06-09 20:02:32 +02:00
Mikhail Zarechenskiy
1f9a5834c3 Delay check for possibly deferred return type for reference candidate
This issue appeared after recently added new overload for flatMapTo.
 Before that, we picked candidate returning List<T> and completed
 inference, now we also check one more flatMapTo, which is here is
 incorrect and as a result we go into outer scope. Outer scope contains
 one property with deferred type, which introduced error about
 "typechecker has run into recursive problem" even it isn't applicable
 by receiver.

 So, the fix is to check receiver first and only then check return
 type of a candidate.

 #KT-39470 Fixed
2020-06-09 17:52:42 +03:00
Konstantin Tskhovrebov
5ab46e9f6c Add test for check expect/actual gutters at same module.
(cherry picked from commit 21f7cd5d8f)
2020-06-09 17:00:53 +03:00
Konstantin Tskhovrebov
4d37e55fa7 Fix expect/actual gutters for declarations in the same module.
Fixed #KT-33510.

(cherry picked from commit a6161c6f22)
2020-06-09 17:00:52 +03:00
Alexander Udalov
0763a6d20b JVM IR: generate delegates to DefaultImpls for fun interfaces
(cherry picked from commit 6adad1055b)
2020-06-09 12:08:38 +02:00
Alexander Udalov
61ede55319 Generate delegates to DefaultImpls in fun interface wrappers
#KT-37436 Fixed

(cherry picked from commit fc1217ba07)
2020-06-09 12:08:36 +02:00
Alexander Udalov
f66ab1d1f9 JVM IR: generate InnerClasses attribute for nested classes in annotation arguments
#KT-38853

(cherry picked from commit 77e479fda8)
2020-06-09 11:41:28 +02:00
Alexander Udalov
eb24189adb Handle IllegalArgumentException in trimMargin intrinsics on JVM
#KT-38537 Fixed

(cherry picked from commit 2793187bda)
2020-06-09 11:20:40 +02:00
Dmitriy Novozhilov
6e73a708fe Enable ContractsOnCallsWithImplicitReceiver in 1.4
#KT-28672 Fixed
2020-06-09 11:22:16 +03:00
Dmitriy Dolovov
748fb7307c [Commonizer] Update stats collector to report lifted up declarations 2020-06-09 11:09:20 +07:00
Dmitriy Dolovov
2f2b9fec50 [Commonizer] Drop useless annotation tests
^KMM-238
^KMM-53
2020-06-09 11:09:15 +07:00
Dmitriy Dolovov
4602865376 [Commonizer] Refactor/simplify marker interfaces 2020-06-09 11:09:10 +07:00
Dmitriy Dolovov
b6be9bed04 [Commonizer] Drop useless "allowPrivate" flag in VisibilityCommonizer 2020-06-09 11:09:05 +07:00
Dmitriy Dolovov
4fe6ea243b [Commonizer] Source-based tests on lifting up identical type aliases
^KMM-55
2020-06-09 11:09:00 +07:00
Dmitriy Dolovov
2c4221d75b [Commonizer] Unit tests on lifting up identical type aliases
^KMM-55
2020-06-09 11:08:55 +07:00
Dmitriy Dolovov
3364b9f0ac [Commonizer] Lift up identical type aliases
^KMM-55
2020-06-09 11:08:50 +07:00
Dmitriy Dolovov
0ca7c542c9 [Commonizer] Process expect/actual cross-module dependencies in source-based tests 2020-06-09 11:08:44 +07:00
Dmitriy Dolovov
a7cf8b656c [Commonizer] Clean-up in AbstractCommonizationFromSourcesTest 2020-06-09 11:08:39 +07:00
Dmitriy Dolovov
fcbf587434 [Commonizer] Minor. Fixed typo 2020-06-09 11:08:34 +07:00
Dmitriy Dolovov
59130061c0 [Commonizer] Minor. Improve error reporting 2020-06-09 11:08:29 +07:00
Dmitriy Dolovov
01983eeee1 [Commonizer] Move fqNameWithTypeParameters extension val into CirType 2020-06-09 11:08:24 +07:00
Dmitriy Dolovov
610ea3d53f [Commonizer] Move some extension functions into CirFunctionOrProperty 2020-06-09 11:08:19 +07:00
Dmitriy Dolovov
9214ee454e [Commonizer] Simplify detection if property is lifted up 2020-06-09 11:08:13 +07:00
Alexander Gorshenev
e0e9518bb8 Fixing a bug with private accessors in IR fake override construction 2020-06-08 20:56:14 +03:00
Abduqodiri Qurbonzoda
e540cfd1a5 Deprecate old CharArray to String conversion api #KT-31343
(cherry picked from commit 6a2fed33d3)
2020-06-08 20:08:23 +03:00
Abduqodiri Qurbonzoda
a027df67c1 Promote scanReduce deprecation level to error
(cherry picked from commit 820353ee0e)
2020-06-08 20:08:20 +03:00
Abduqodiri Qurbonzoda
b860872df5 Promote randomOrNull, reduceOrNull, scan to stable
(cherry picked from commit 4e820edd1f)
2020-06-08 20:08:18 +03:00
Abduqodiri Qurbonzoda
b03970ba08 Remove experimental status from Array.associateWith
(cherry picked from commit 094dbf4c2d)
2020-06-08 20:08:15 +03:00
Abduqodiri Qurbonzoda
500414ae5a Promote String <-> utf8 and CharArray conversions to stable
(cherry picked from commit 46297645a4)
2020-06-08 20:08:13 +03:00
Abduqodiri Qurbonzoda
bd1dcb72e3 Promote KClass.cast/safeCast, KAnnotatedElement.hasAnnotation() to stable
(cherry picked from commit e3fb74b656)
2020-06-08 20:08:12 +03:00
Dmitry Petrov
7ca0547d1d Bootstrap: 1.4.20-dev-117 2020-06-08 15:36:55 +03:00
Konstantin Tskhovrebov
311df7bcb0 Hide commonizer import error message for unsupported kotlin plugin.
(cherry picked from commit c3802891fc)
2020-06-08 15:10:50 +03:00
Pavel Kirpichenkov
ae6e459015 Avoid persisting default anchor configuration
#KT-24309 In Progress
2020-06-08 11:31:51 +03:00
Pavel Kirpichenkov
0e45def480 Update library to source analysis mode configuration
Persist analysis flag in the same xml where anchor mapping reside instead
of using properties. This makes it possible to save config in VCS.

#KT-24309 In Progress
2020-06-08 11:31:51 +03:00
Pavel Kirpichenkov
7990399e0d Clean up API of AbstractResolverForProject
Resolution anchors are IDE-specific.
Creating dedicated methods for them in AbstractResolverForProject leads to meaningless
implementation in non-IDE resolvers. Now this method is implemented only
for IDE resolver and accessed through JvmPlatformParameters.

#KT-24309 In Progress
2020-06-08 11:31:51 +03:00
Pavel Kirpichenkov
15bbac7e75 Optimize synchronization for resolution anchors
Use volatile state instead of synchronized access to it.
This should be enough as the component's state is only read
by the component users and never changed.
2020-06-08 11:31:51 +03:00
Pavel Kirpichenkov
5aa7adcd01 Add cancelation check when building anchor mappings 2020-06-08 11:31:51 +03:00
Pavel Kirpichenkov
123c3e4c78 Changes after review
- Replace leaking ModuleResolverTracker with use of ModuleDescriptor.Capabilies
- Provide API for retrieving ResolverForProject from ResolutionFacade
- Update names
2020-06-08 11:31:50 +03:00
Pavel Kirpichenkov
c2495dbe5f Introduce components for library-to-source resolution in IDE
#KT-24309 In progress
2020-06-08 11:31:50 +03:00
Mikhail Zarechenskiy
2d78aa2148 Update forgotten FIR test
(cherry picked from commit a086d9f7df)
2020-06-08 00:00:31 +03:00
Mikhail Zarechenskiy
bc34d69d56 Don't apply Unit-conversion for expressions that return Nothing type
(cherry picked from commit 22b558110d)
2020-06-08 00:00:28 +03:00
Mikhail Zarechenskiy
b74e24b819 Don't allow coercing receivers from signed to unsigned constants
(cherry picked from commit e72401c5f4)
2020-06-08 00:00:25 +03:00
Mikhail Zarechenskiy
47e76c260b Introduce call checker for Unit-conversions
(cherry picked from commit bfa648972f)
2020-06-08 00:00:22 +03:00
Mikhail Zarechenskiy
441e86e892 Allow suspend-conversion for callable references as part of adaptation
(cherry picked from commit 6b0a803d14)
2020-06-08 00:00:19 +03:00
Mikhail Zarechenskiy
14cd518aa9 Fix chained conversions for subtypes of functional types
(cherry picked from commit 6b58be377e)
2020-06-08 00:00:16 +03:00
Mikhail Zarechenskiy
74b35939fa Introduce Unit-conversions for simple arguments
(cherry picked from commit 71cbe97688)
2020-06-08 00:00:13 +03:00
Mikhail Zarechenskiy
8d91ce5774 Refactoring: rename files to avoid "util" suffixes
(cherry picked from commit f08a45f2d4)
2020-06-08 00:00:09 +03:00
Mikhail Zarechenskiy
dc2440185b Narrow down the range for compatibility warning to callee expression
(cherry picked from commit a4af833d55)
2020-06-08 00:00:07 +03:00
Mikhail Zarechenskiy
2262f0a4ef Refactoring: rename method to make it more specific
(cherry picked from commit 4bd622c1c5)
2020-06-08 00:00:04 +03:00
Mikhail Zarechenskiy
65b282bada Compatibility warning for references to companion via name (KT-13934)
(cherry picked from commit 718f23b34f)
2020-06-08 00:00:00 +03:00
Anton Bannykh
a62fbd7fa1 JS: fix explicit cross-module SAM constructor calls
(cherry picked from commit bd2a0563ad)
2020-06-06 17:48:45 +03:00
Anton Bannykh
d08260d60c Add stdlib API test + remove some extra IR stdlib API's
(cherry picked from commit a18bfad53a)
2020-06-06 17:48:45 +03:00
Ilya Muradyan
56cf876cb8 Add info about the end of range in scripting REPL compiler messages 2020-06-05 22:05:01 +02:00
Ilya Chernikov
61f8953bd3 Extract interface from CompilerMessageLocation to ease extension
The CompilerMessageLocation is an implicit part of the binary daemon
protocol so changing it breaks compatibility with older daemons.
This change allows to extend location for non-daemon uses without
breaking the binary protocol.
2020-06-05 22:05:00 +02:00
Ilya Kirillov
b185884005 Wizard: use cache redirector on project importing tests
(cherry picked from commit 8a4521864e)
2020-06-05 13:04:23 +03:00
Ilya Kirillov
eba09719d2 Wizard: download latest dev version for tests from bintray
(cherry picked from commit cce5a9a1ca)
2020-06-05 13:04:22 +03:00
Dmitry Petrov
70e928f4d9 Fix stdlib compilation after updated @JvmName check
Previously, extension receiver type was not taken into account when
checking for @JvmName annotation applicability to possibly mangled
functions (such functions, however, were mangled).
This bug was fixed, but, unfortunately, not before such functions were
added to stdlib ('sumOf' family).
2020-06-05 10:43:52 +03:00
Dmitry Petrov
7029e78ca2 Forward compatibility hacks for Result.{success, failure}
Don't mangled functions annotated with @JvmName.
Annotate 'Result.success' and 'Result.failure' with @JvmName and
@Suppress("INAPPLICABLE_JVM_NAME").
NB this would require bootstrap.

(cherry picked from commit 202bbdf8dd)
2020-06-05 10:38:49 +03:00
Roman Artemev
a394de00c5 [JS IR] Greenify failing (in 1.4.0 branch) tests 2020-06-04 16:53:20 +03:00
Roman Artemev
d29251f507 [PLUGIN API] Implement custom linkage for plugin extensions
(cherry picked from commit 5eae262264)
2020-06-04 15:32:49 +03:00
Roman Artemev
e61f5956cb [PLUGIN API] Add extension point to customize linkage process
(cherry picked from commit a401374ed4)
2020-06-04 15:32:48 +03:00
Roman Artemev
740bbaeb8c [IR] Move IrProvider and 'IrDeserializer' into separate package
(cherry picked from commit f9c2c846f7)
2020-06-04 15:32:48 +03:00
Alexander Udalov
6851607a04 JVM IR: do not generate DefaultImpls delegate for collection fake overrides
In the newly added test, prior to this change, JVM IR was generating
DefaultImpls classes with calls to things like
`kotlin/collections/MutableList$DefaultImpls.spliterator` and other
default methods present in JDK 8+. This obviously didn't make much
sense. Although these weren't explicitly mentioned anywhere in the
bytecode, they caused some validation tools to report errors (e.g.
animalsniffer used in arrow).

(cherry picked from commit 5647a935a2)
2020-06-04 14:28:07 +02:00
Ilya Goncharov
5b5684cd5d [Gradle, JS] Fix test after changing type of IR link task on mode
(cherry picked from commit 74e4a817cb)
2020-06-04 11:07:06 +03:00
Ilya Goncharov
a6a9427757 [Gradle, JS] Webpack on file providers for task configuration avoidance
(cherry picked from commit 426f164e02)
2020-06-04 11:07:06 +03:00
Ilya Goncharov
52dace2970 [Gradle, JS] Make destinationDir as var
(cherry picked from commit 01f3e4b083)
2020-06-04 11:07:06 +03:00
Ilya Goncharov
3716d2c4e7 [Gradle, JS] Use RegularFile to not explicit dependsOn
^KT-32273 fixed
^KT-36451 fixed
^KT-37258 fixed

(cherry picked from commit 402dfd5da7)
2020-06-04 11:07:06 +03:00
Ilya Goncharov
4f96393f14 [Gradle, JS] Add dependency on dce task
^KT-32273 fixed
^KT-36451 fixed
^KT-37258 fixed

(cherry picked from commit e27bd04ba2)
2020-06-04 11:07:06 +03:00
Ilya Goncharov
6995eb87df [Gradle, JS] JsBinaryType to KotlinJsBinaryType
(cherry picked from commit d3260bca27)
2020-06-04 11:07:06 +03:00
Ilya Goncharov
f94653fd49 [Gradle, JS] KotlinJsType to KotlinJsMode
(cherry picked from commit d27ad99daa)
2020-06-04 11:07:05 +03:00
Ilya Goncharov
007b3d97d6 [Gradle, JS] Move common part of webpack configuration to separate fun
^KT-32273 fixed
^KT-36451 fixed
^KT-37258 fixed

(cherry picked from commit a5e46568ee)
2020-06-04 11:07:05 +03:00
Ilya Goncharov
b8918eab5d [Gradle, JS] Add resolveFromModulesFirst to build tasks
(cherry picked from commit ef63d6f84c)
2020-06-04 11:07:05 +03:00
Ilya Goncharov
aaa2747a4e [Gradle, JS] Use property for webpack entry
(cherry picked from commit d4d8495840)
2020-06-04 11:07:05 +03:00
Ilya Goncharov
5c40432b4e [Gradle, JS] Add dce to development
^KT-32273 fixed
^KT-36451 fixed
^KT-37258 fixed

(cherry picked from commit 65db6bb2a5)
2020-06-04 11:07:05 +03:00
Ilya Goncharov
6fe1c56c32 [Gradle, JS] Use API form Gradle 5.0
(cherry picked from commit 9d8eb65a5e)
2020-06-04 11:07:05 +03:00
Ilya Goncharov
130eeff06e [Gradle, JS] Add index.html to Kotlin DSL wizard
^KT-39275 fixed

(cherry picked from commit bd194686df)
2020-06-04 11:06:45 +03:00
Ilya Goncharov
385498aa78 [Gradle, JS] Fix grammar in methods for JS import
(cherry picked from commit 890da492fb)
2020-06-04 11:05:59 +03:00
Ilya Goncharov
6ec97cc85f [Gradle, JS] Fix grammar on comment
(cherry picked from commit bc4d7e0020)
2020-06-04 11:05:59 +03:00
Mikhail Bogdanov
328db2f0bf Remove compatibility hack
(cherry picked from commit 4f8ad6bdcb)
2020-06-04 08:03:22 +02:00
Vyacheslav Gerasimov
357203fb11 Build: Remove identifying info from build scans 2020-06-03 19:33:25 +03:00
Henrik Tunedal
f8693209ab Use system-specific user cache directory in main-kts
#KT-38222 fixed
2020-06-03 11:18:33 +02:00
Henrik Tunedal
1e9ee7014b Improve hashing of script files 2020-06-03 11:18:33 +02:00
25659 changed files with 487490 additions and 972646 deletions

8
.bunch
View File

@@ -1,4 +1,8 @@
202
193
201
202_201
192
as36_192
as40
as41_201
as42
as42_202_201

1
.gitattributes vendored
View File

@@ -3,6 +3,5 @@
* text=auto
* eol=lf
*.png binary
*.jar binary
compiler/cli/bin/* eol=lf
compiler/cli/bin/*.bat eol=crlf

3
.gitignore vendored
View File

@@ -59,6 +59,3 @@ node_modules/
.rpt2_cache/
libraries/tools/kotlin-test-js-runner/lib/
local.properties
buildSrcTmp/
distTmp/
outTmp/

View File

@@ -13,6 +13,21 @@
</option>
</JavaCodeStyleSettings>
<JetCodeStyleSettings>
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
<value>
<package name="java.util" alias="false" withSubpackages="false" />
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
</value>
</option>
<option name="PACKAGES_IMPORT_LAYOUT">
<value>
<package name="" alias="false" withSubpackages="true" />
<package name="java" alias="false" withSubpackages="true" />
<package name="javax" alias="false" withSubpackages="true" />
<package name="kotlin" alias="false" withSubpackages="true" />
<package name="" alias="true" withSubpackages="true" />
</value>
</option>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<MarkdownNavigatorCodeStyleSettings>
@@ -101,4 +116,4 @@
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
</codeStyleSettings>
</code_scheme>
</component>
</component>

View File

@@ -11,7 +11,6 @@
<w>protobuf</w>
<w>redirector</w>
<w>remapper</w>
<w>sonatype</w>
<w>unpresent</w>
</words>
</dictionary>

View File

@@ -1,7 +1,6 @@
<component name="ProjectDictionaryState">
<dictionary name="dmitriy.dolovov">
<words>
<w>cinterop</w>
<w>commonizable</w>
<w>commonization</w>
<w>commonize</w>
@@ -9,12 +8,8 @@
<w>commonizer</w>
<w>commonizers</w>
<w>commonizes</w>
<w>commonizing</w>
<w>interop</w>
<w>jetbrains</w>
<w>konan</w>
<w>kotlinx</w>
<w>macos</w>
</words>
</dictionary>
</component>

View File

@@ -1,27 +0,0 @@
<component name="ProjectDictionaryState">
<dictionary name="svyatoslav.kuzmich">
<words>
<w>anyfunc</w>
<w>copysign</w>
<w>eqref</w>
<w>exnref</w>
<w>externref</w>
<w>funcref</w>
<w>jetbrains</w>
<w>kotlinx</w>
<w>ktor</w>
<w>optref</w>
<w>popcnt</w>
<w>rotl</w>
<w>rotr</w>
<w>simd</w>
<w>sqrt</w>
<w>testsuite</w>
<w>uninstantiable</w>
<w>unlinkable</w>
<w>vtable</w>
<w>wabt</w>
<w>xopt</w>
</words>
</dictionary>
</component>

View File

@@ -10,10 +10,7 @@
<w>kapt</w>
<w>kotlinc</w>
<w>mutators</w>
<w>parcelable</w>
<w>parceler</w>
<w>parcelers</w>
<w>parcelize</w>
<w>repl</w>
<w>testdata</w>
<w>uast</w>

View File

@@ -453,4 +453,4 @@
<option name="ignoreNonEmtpyLoops" value="false" />
</inspection_tool>
</profile>
</component>
</component>

View File

@@ -10,7 +10,7 @@
</option>
<option name="taskNames">
<list>
<option value=":compiler:tests-for-compiler-generator:generateTests" />
<option value=":compiler:generateTests" />
<option value=":compiler:tests-java8:generateTests" />
<option value=":compiler:tests-against-klib:generateTests" />
<option value=":js:js.tests:generateTests" />
@@ -22,4 +22,4 @@
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<method />
</configuration>
</component>
</component>

View File

@@ -1,20 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Test: KMM" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="kmmTest" />
</list>
</option>
<option name="vmOptions" value="" />
</ExternalSystemSettings>
<method v="2" />
</configuration>
</component>

View File

@@ -4,13 +4,12 @@
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="--tests &quot;org.jetbrains.kotlin.js.test.ApiTest&quot; -Poverwrite.output=true --parallel" />
<option name="scriptParameters" value="--tests &quot;org.jetbrains.kotlin.js.test.ApiTest&quot; -Poverwrite.output=true" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value=":js:js.tests:cleanTest" />
<option value=":js:js.tests:test" />
</list>
</option>

View File

@@ -1,3 +1,3 @@
<component name="DependencyValidationManager">
<scope name="Apply copyright" pattern="!file[*]:*//testData//*&amp;&amp;!file[*]:testData//*&amp;&amp;!file[*]:*.gradle.kts&amp;&amp;!file[*]:*.gradle&amp;&amp;!file[group:kotlin-ultimate]:*/&amp;&amp;!file[kotlin.libraries]:stdlib/api//*" />
<scope name="Apply copyright" pattern="!file[*]:*//testData//*&amp;&amp;!file[*]:testData//*&amp;&amp;!file[*]:*.gradle.kts&amp;&amp;!file[*]:*.gradle&amp;&amp;!file[kotlin.kotlin-ultimate]:*/&amp;&amp;!file[kotlin.kotlin-ultimate.*]:*/&amp;&amp;!file[kotlin.libraries]:stdlib/api//*" />
</component>

File diff suppressed because it is too large Load Diff

View File

@@ -2,14 +2,10 @@
[![TeamCity (simple build status)](https://img.shields.io/teamcity/http/teamcity.jetbrains.com/s/Kotlin_KotlinPublic_Compiler.svg)](https://teamcity.jetbrains.com/buildConfiguration/Kotlin_KotlinPublic_Compiler?branch=%3Cdefault%3E&buildTypeTab=overview&mode=builds)
[![Maven Central](https://img.shields.io/maven-central/v/org.jetbrains.kotlin/kotlin-maven-plugin.svg)](https://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.jetbrains.kotlin%22)
[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0)
[![Revved up by Gradle Enterprise](https://img.shields.io/badge/Revved%20up%20by-Gradle%20Enterprise-06A0CE?logo=Gradle&labelColor=02303A)](https://ge.jetbrains.com/scans?search.rootProjectNames=Kotlin)
# Kotlin Programming Language!!!
# Kotlin Programming Language
Welcome to [Kotlin](https://kotlinlang.org/)!
It is an open-source, statically typed programming language supported and developed by [JetBrains](https://www.jetbrains.com/) and open-source contributors.
Some handy links:
Welcome to [Kotlin](https://kotlinlang.org/)! Some handy links:
* [Kotlin Site](https://kotlinlang.org/)
* [Getting Started Guide](https://kotlinlang.org/docs/tutorials/getting-started.html)
@@ -18,21 +14,10 @@ Some handy links:
* [Issue Tracker](https://youtrack.jetbrains.com/issues/KT)
* [Forum](https://discuss.kotlinlang.org/)
* [Kotlin Blog](https://blog.jetbrains.com/kotlin/)
* [Subscribe to Kotlin YouTube channel](https://www.youtube.com/channel/UCP7uiEZIqci43m22KDl0sNw)
* [Follow Kotlin on Twitter](https://twitter.com/kotlin)
* [Public Slack channel](https://slack.kotlinlang.org/)
* [TeamCity CI build](https://teamcity.jetbrains.com/project.html?tab=projectOverview&projectId=Kotlin)
## Kotlin Multiplatform capabilities
Support for multiplatform programming is one of Kotlins key benefits. It reduces time spent writing and maintaining the same code for [different platforms](https://kotlinlang.org/docs/reference/mpp-supported-platforms.html) while retaining the flexibility and benefits of native programming.
* [Kotlin Multiplatform Mobile](https://kotlinlang.org/lp/mobile/) for sharing code between Android and iOS
* [Getting Started with Kotlin Multiplatform Mobile Guide](https://kotlinlang.org/docs/mobile/create-first-app.html)
* [Kotlin Multiplatform Benefits](https://kotlinlang.org/docs/reference/multiplatform.html)
* [Share code on all platforms](https://kotlinlang.org/docs/reference/mpp-share-on-platforms.html#share-code-on-all-platforms)
* [Share code on similar platforms](https://kotlinlang.org/docs/reference/mpp-share-on-platforms.html#share-code-on-similar-platforms)
## Editing Kotlin
* [Kotlin IntelliJ IDEA Plugin](https://kotlinlang.org/docs/tutorials/getting-started.html)
@@ -56,12 +41,7 @@ For local development, if you're not working on bytecode generation or the stand
You also can use [Gradle properties](https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties) to setup `JDK_*` variables.
Note: The JDK 6 for MacOS is not available on Oracle's site. You can install it by
```bash
$ brew tap caskroom/versions
$ brew cask install java6
```
> Note: The JDK 6 for MacOS is not available on Oracle's site. You can [download it here](https://support.apple.com/kb/DL1572).
On Windows you might need to add long paths setting to the repo:
@@ -101,8 +81,6 @@ command line parameters on the first run:
- `compilerTest` - build and run all compiler tests
- `ideaPluginTest` - build and run all IDEA plugin tests
To reproduce TeamCity build use `-Pteamcity=true` flag. Local builds don't run proguard and have jar compression disabled by default.
**OPTIONAL:** Some artifacts, mainly Maven plugin ones, are built separately with Maven.
Refer to [libraries/ReadMe.md](libraries/ReadMe.md) for details.
@@ -168,28 +146,6 @@ includeBuild('/path/to/kotlin') {
}
```
### Dependency verification
We have a [dependencies verification](https://docs.gradle.org/current/userguide/dependency_verification.html) feature enabled in the
repository for all Gradle builds. Gradle will check hashes (md5 and sha256) of used dependencies and will fail builds with
`Dependency verification failed` errors when local artifacts are absent or have different hashes listed in the
[verification-metadata.xml](https://github.com/JetBrains/kotlin/blob/master/gradle/verification-metadata.xml) file.
It's expected that `verification-metadata.xml` should only be updated with the commits that modify the build. There are some tips how
to perform such updates:
- Use auto-generation for getting an initial list of new hashes (verify updates relate to you changes).
`./gradlew -M sha256,md5 help`
*(any other task may be used instead of `help`)*
- Consider removing old versions from the file if you are updating dependencies.
- Leave meaningful `origin` attribute (instead of `Generated by Gradle`) if you did some manual verification of the artifact.
- Always do manual verification if several hashes are needed and a new `also-trust` tag has to be added.
- If youre adding a dependency with OS mentioning in an artifact name (`darwin`, `mac`, `osx`, `linux`, `windows`), remember to add
counterparts for other platforms.
# License
Kotlin is distributed under the terms of the Apache License (Version 2.0). See [license folder](license/README.md) for details.

View File

@@ -16,24 +16,18 @@
package org.jetbrains.kotlin.ant
import org.apache.tools.ant.BuildException
import org.apache.tools.ant.taskdefs.Execute
import org.apache.tools.ant.taskdefs.Redirector
import org.apache.tools.ant.types.*
import org.apache.tools.ant.types.Path
import org.apache.tools.ant.types.Reference
import java.io.File.pathSeparator
import java.io.File.separator
class Kotlin2JvmTask : KotlinCompilerBaseTask() {
override val compilerFqName = "org.jetbrains.kotlin.cli.jvm.K2JVMCompiler"
var includeRuntime: Boolean = false
var includeRuntime: Boolean = true
var moduleName: String? = null
var noReflect: Boolean = false
private val cmdl = CommandlineJava()
var fork: Boolean = false
private var compileClasspath: Path? = null
fun setClasspath(classpath: Path) {
@@ -79,47 +73,4 @@ class Kotlin2JvmTask : KotlinCompilerBaseTask() {
if (noReflect) args.add("-no-reflect")
if (includeRuntime) args.add("-include-runtime")
}
override fun execute() {
if (!fork)
super.execute()
else {
exec()
}
}
private fun exec() {
val javaHome = System.getProperty("java.home")
val javaBin = javaHome + separator + "bin" + separator + "java"
val redirector = Redirector(this)
fillArguments()
val command = ArrayList<String>()
command.add(javaBin)
command.addAll(cmdl.vmCommand.arguments) // jvm args
command.add("-Dorg.jetbrains.kotlin.cliMessageRenderer=FullPath") // same MessageRenderer as non-forking mode
command.add("-cp")
command.add(KotlinAntTaskUtil.compilerJar.canonicalPath)
command.add(compilerFqName)
command.addAll(args) // compiler args
// streamHandler: used to handle the input and output streams of the subprocess.
// watchdog: a watchdog for the subprocess or <code>null</code> to disable a timeout for the subprocess.
// TODO: support timeout for the subprocess
val exe = Execute(redirector.createHandler(), null)
exe.setAntRun(getProject())
exe.commandline = command.toTypedArray()
log("Executing command: ${command.joinToString(" ")}", LogLevel.DEBUG.level)
log("Compiling ${src!!.list().toList()} => [${output!!.canonicalPath}]")
val exitCode = exe.execute()
redirector.complete()
if (failOnError && exitCode != 0) {
throw BuildException("Compile failed; see the compiler error output for details.")
}
}
fun createJvmarg(): Commandline.Argument {
return cmdl.createVmArgument()
}
}

View File

@@ -80,7 +80,7 @@ abstract class KotlinCompilerBaseTask : Task() {
fillSpecificArguments()
}
override fun execute() {
final override fun execute() {
fillArguments()
val compilerClass = KotlinAntTaskUtil.getOrCreateClassLoader().loadClass(compilerFqName)

View File

@@ -1,23 +1,53 @@
import kotlinx.benchmark.gradle.benchmark
val benchmarks_version = "0.3.0"
val benchmarks_version = "0.2.0-dev-7"
buildscript {
val benchmarks_version = "0.2.0-dev-7"
repositories {
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
if (cacheRedirectorEnabled) {
maven("https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlinx")
maven("https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlin-dev")
} else {
maven("https://dl.bintray.com/kotlin/kotlinx")
maven("https://dl.bintray.com/kotlin/kotlin-dev")
}
}
dependencies {
classpath("org.jetbrains.kotlinx:kotlinx.benchmark.gradle:$benchmarks_version")
}
}
apply(plugin = "kotlinx.benchmark")
plugins {
java
kotlin("jvm")
id("org.jetbrains.kotlinx.benchmark") version "0.3.0"
}
repositories {
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
if (cacheRedirectorEnabled) {
maven("https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlinx")
maven("https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlin-dev")
} else {
maven("https://dl.bintray.com/kotlin/kotlinx")
maven("https://dl.bintray.com/kotlin/kotlin-dev")
}
}
dependencies {
compile(kotlinStdlib())
compile(project(":compiler:frontend"))
compile(projectTests(":compiler:tests-common"))
compile(project(":compiler:cli"))
compile(intellijCoreDep()) { includeJars("intellij-core") }
compile(jpsStandalone()) { includeJars("jps-model") }
compile(intellijPluginDep("java"))
Platform[192].orHigher {
compile(intellijPluginDep("java"))
}
compile(intellijDep()) { includeIntellijCoreJarDependencies(project) }
compile("org.jetbrains.kotlinx:kotlinx-benchmark-runtime:$benchmarks_version")
compile("org.jetbrains.kotlinx:kotlinx.benchmark.runtime-jvm:$benchmarks_version")
}
sourceSets {
@@ -43,7 +73,6 @@ benchmark {
param("size", 1000)
include("CommonCallsBenchmark")
include("ControlFlowAnalysisBenchmark")
//include("InferenceBaselineCallsBenchmark")
}
@@ -66,52 +95,3 @@ benchmark {
register("main")
}
}
tasks.named("classes") {
doLast {
tasks.named("mainBenchmarkJar", Zip::class.java) {
isZip64 = true
archiveName = "benchmarks.jar"
}
listOf("mainBenchmark", "mainFirBenchmark", "mainNiBenchmark").forEach {
tasks.named(it, JavaExec::class.java) {
systemProperty("idea.home.path", intellijRootDir().canonicalPath)
}
}
}
}
tasks.register<JavaExec>("runBenchmark") {
// jmhArgs example: -PjmhArgs='CommonCalls -p size=500 -p isIR=true -p useNI=true -f 1'
val jmhArgs = if (project.hasProperty("jmhArgs")) project.property("jmhArgs").toString() else ""
val resultFilePath = "$buildDir/benchmarks/jmh-result.json"
val ideaHome = intellijRootDir().canonicalPath
val benchmarkJarPath = "$buildDir/benchmarks/main/jars/benchmarks.jar"
args = mutableListOf("-Didea.home.path=$ideaHome", benchmarkJarPath, "-rf", "json", "-rff", resultFilePath) + jmhArgs.split("\\s".toRegex())
main = "-jar"
doLast {
if (project.kotlinBuildProperties.isTeamcityBuild) {
val jsonArray = com.google.gson.JsonParser.parseString(File(resultFilePath).readText()).asJsonArray
jsonArray.forEach {
val benchmark = it.asJsonObject
// remove unnecessary name parts from string like this "org.jetbrains.kotlin.benchmarks.CommonCallsBenchmark.benchmark"
val name = benchmark["benchmark"].asString.removeSuffix(".benchmark").let {
val indexOfLastDot = it.indexOfLast { it == '.' }
it.removeRange(0..indexOfLastDot)
}
val params = benchmark["params"].asJsonObject
val isIR = if (params.has("isIR")) params["isIR"].asString else "false"
val useNI = if (params.has("useNI")) params["useNI"].asString else "false"
val size = params["size"].asString
val score = "%.3f".format(benchmark["primaryMetric"].asJsonObject["score"].asString.toFloat())
val irPostfix = if (isIR.toBoolean()) " isIR=true" else ""
val niPostfix = if (useNI.toBoolean() && !isIR.toBoolean()) " isNI=true" else ""
println("""##teamcity[buildStatisticValue key='$name size=$size${irPostfix}$niPostfix' value='$score']""")
}
}
}
}

View File

@@ -5,6 +5,7 @@
package org.jetbrains.kotlin.benchmarks
import com.intellij.openapi.Disposable
import com.intellij.openapi.extensions.Extensions
import com.intellij.openapi.project.Project
import com.intellij.openapi.vfs.CharsetToolkit
import com.intellij.psi.PsiElementFinder
@@ -12,6 +13,7 @@ import com.intellij.psi.PsiFileFactory
import com.intellij.psi.impl.PsiFileFactoryImpl
import com.intellij.psi.search.GlobalSearchScope
import com.intellij.testFramework.LightVirtualFile
import org.jetbrains.kotlin.analyzer.ModuleInfo
import org.jetbrains.kotlin.asJava.finder.JavaElementFinder
import org.jetbrains.kotlin.builtins.jvm.JvmBuiltIns
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
@@ -24,15 +26,21 @@ import org.jetbrains.kotlin.context.withModule
import org.jetbrains.kotlin.context.withProject
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl
import org.jetbrains.kotlin.diagnostics.Severity
import org.jetbrains.kotlin.fir.FirSession
import org.jetbrains.kotlin.fir.builder.RawFirBuilder
import org.jetbrains.kotlin.fir.createSession
import org.jetbrains.kotlin.fir.java.FirJavaElementFinder
import org.jetbrains.kotlin.fir.java.FirJavaModuleBasedSession
import org.jetbrains.kotlin.fir.java.FirLibrarySession
import org.jetbrains.kotlin.fir.java.FirProjectSessionProvider
import org.jetbrains.kotlin.fir.resolve.firProvider
import org.jetbrains.kotlin.fir.resolve.providers.impl.FirProviderImpl
import org.jetbrains.kotlin.fir.resolve.transformers.FirTotalResolveProcessor
import org.jetbrains.kotlin.idea.KotlinLanguage
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.platform.TargetPlatform
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.resolve.PlatformDependentAnalyzerServices
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformAnalyzerServices
import org.jetbrains.kotlin.storage.ExceptionTracker
import org.jetbrains.kotlin.storage.LockBasedStorageManager
import org.jetbrains.kotlin.storage.StorageManager
@@ -103,7 +111,9 @@ abstract class AbstractSimpleFileBenchmark {
)
if (isIR) {
PsiElementFinder.EP.getPoint(env.project).unregisterExtension(JavaElementFinder::class.java)
Extensions.getArea(env.project)
.getExtensionPoint(PsiElementFinder.EP_NAME)
.unregisterExtension(JavaElementFinder::class.java)
}
file = createFile(
@@ -152,7 +162,7 @@ abstract class AbstractSimpleFileBenchmark {
.uniteWith(TopDownAnalyzerFacadeForJVM.AllJavaSourcesInProjectScope(env.project))
val session = createSession(env, scope)
val firProvider = session.firProvider as FirProviderImpl
val builder = RawFirBuilder(session, firProvider.kotlinScopeProvider)
val builder = RawFirBuilder(session, firProvider.kotlinScopeProvider, stubMode = false)
val totalTransformer = FirTotalResolveProcessor(session)
val firFile = builder.buildFirFile(file).also(firProvider::recordFile)
@@ -160,10 +170,43 @@ abstract class AbstractSimpleFileBenchmark {
totalTransformer.process(listOf(firFile))
bh.consume(firFile.hashCode())
env.project.extensionArea
.getExtensionPoint<PsiElementFinder>(PsiElementFinder.EP.name)
.unregisterExtension(FirJavaElementFinder::class.java)
}
protected abstract fun buildText(): String
}
fun createSession(
environment: KotlinCoreEnvironment,
sourceScope: GlobalSearchScope,
librariesScope: GlobalSearchScope = GlobalSearchScope.notScope(sourceScope)
): FirSession {
val moduleInfo = FirTestModuleInfo()
val project = environment.project
val provider = FirProjectSessionProvider(project)
return FirJavaModuleBasedSession.create(moduleInfo, provider, sourceScope).also {
createSessionForDependencies(provider, moduleInfo, librariesScope, environment)
}
}
private fun createSessionForDependencies(
provider: FirProjectSessionProvider,
moduleInfo: FirTestModuleInfo,
librariesScope: GlobalSearchScope,
environment: KotlinCoreEnvironment
) {
val dependenciesInfo = FirTestModuleInfo()
moduleInfo.dependencies.add(dependenciesInfo)
FirLibrarySession.create(
dependenciesInfo, provider, librariesScope, environment.project,
environment.createPackagePartProvider(librariesScope)
)
}
class FirTestModuleInfo(
override val name: Name = Name.identifier("TestModule"),
val dependencies: MutableList<ModuleInfo> = mutableListOf(),
override val platform: TargetPlatform = JvmPlatforms.unspecifiedJvmPlatform,
override val analyzerServices: PlatformDependentAnalyzerServices = JvmPlatformAnalyzerServices
) : ModuleInfo {
override fun dependencies(): List<ModuleInfo> = dependencies
}

View File

@@ -1,35 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.benchmarks
import org.openjdk.jmh.annotations.*
import org.openjdk.jmh.infra.Blackhole
import java.util.concurrent.TimeUnit
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@State(Scope.Benchmark)
open class ControlFlowAnalysisBenchmark : AbstractSimpleFileBenchmark() {
@Param("1000")
private var size: Int = 0
@Benchmark
fun benchmark(bh: Blackhole) {
analyzeGreenFile(bh)
}
override fun buildText() =
buildString {
appendLine("fun test() {")
for (i in 0 until size) {
appendLine("for (i$i in 0..10) { ")
}
for (i in 0 until size) {
appendLine("}")
}
appendLine("}")
}
}

View File

@@ -23,28 +23,28 @@ open class ManyImplicitReceiversBenchmark : AbstractSimpleFileBenchmark() {
override fun buildText(): String {
return buildString {
appendLine("inline fun <T, R> with(receiver: T, block: T.() -> R): R = block()")
appendln("inline fun <T, R> with(receiver: T, block: T.() -> R): R = block()")
for (i in 1..size) {
appendLine("interface A$i {")
appendLine(" fun foo$i()")
appendLine("}")
appendLine()
appendln("interface A$i {")
appendln(" fun foo$i()")
appendln("}")
appendln()
}
appendLine()
appendln()
append("fun test(")
append((1..size).joinToString(", ") { "a$it: A$it" })
appendLine(" {")
appendln(" {")
for (i in 1..size) {
appendLine("with(a$i) {")
appendln("with(a$i) {")
}
for (i in 1..size) {
appendLine("foo$i()")
appendln("foo$i()")
}
for (i in 1..size) {
appendLine("}")
appendln("}")
}
appendLine("}")
appendln("}")
}
}
}

View File

@@ -22,7 +22,7 @@ open class PlusAssignOperatorDesugaringBenchmark : AbstractInferenceBenchmark()
}
override fun buildText(): String = buildString {
appendLine(
appendln(
"""
class A {
operator fun <T : Number> plus(other: (Int) -> T): A = this
@@ -30,20 +30,19 @@ open class PlusAssignOperatorDesugaringBenchmark : AbstractInferenceBenchmark()
}
""".trimIndent()
)
appendLine("fun test() {")
appendLine("var a = A()")
appendln("fun test() {")
appendln("var a = A()")
for (i in 1..size) {
appendLine("a += {")
appendln("a += {")
}
for (i in 1..size) {
appendLine(
appendln(
"""
it.inc()
1
}
""".trimIndent()
)
""".trimIndent())
}
appendLine()
appendln()
}
}

View File

@@ -7,7 +7,6 @@ plugins {
dependencies {
compileOnly(project(":core:util.runtime"))
compileOnly(project(":compiler:backend.common.jvm"))
compileOnly(project(":compiler:util"))
compileOnly(project(":compiler:cli-common"))
compileOnly(project(":compiler:frontend.java"))

File diff suppressed because it is too large Load Diff

View File

@@ -17,6 +17,9 @@ interface BuildMetaInfo {
val compilerBuildVersion: String
val languageVersionString: String
val apiVersionString: String
val coroutinesEnable: Boolean
val coroutinesWarn: Boolean
val coroutinesError: Boolean
val multiplatformEnable: Boolean
val metadataVersionMajor: Int
val metadataVersionMinor: Int
@@ -32,6 +35,9 @@ abstract class BuildMetaInfoFactory<T : BuildMetaInfo>(private val metaInfoClass
compilerBuildVersion: String,
languageVersionString: String,
apiVersionString: String,
coroutinesEnable: Boolean,
coroutinesWarn: Boolean,
coroutinesError: Boolean,
multiplatformEnable: Boolean,
ownVersion: Int,
coroutinesVersion: Int,
@@ -47,6 +53,9 @@ abstract class BuildMetaInfoFactory<T : BuildMetaInfo>(private val metaInfoClass
compilerBuildVersion = KotlinCompilerVersion.VERSION,
languageVersionString = languageVersion.versionString,
apiVersionString = args.apiVersion ?: languageVersion.versionString,
coroutinesEnable = args.coroutinesState == CommonCompilerArguments.ENABLE,
coroutinesWarn = args.coroutinesState == CommonCompilerArguments.WARN,
coroutinesError = args.coroutinesState == CommonCompilerArguments.ERROR,
multiplatformEnable = args.multiPlatform,
ownVersion = OWN_VERSION,
coroutinesVersion = COROUTINES_VERSION,

View File

@@ -15,6 +15,9 @@ data class CommonBuildMetaInfo(
override val compilerBuildVersion: String,
override val languageVersionString: String,
override val apiVersionString: String,
override val coroutinesEnable: Boolean,
override val coroutinesWarn: Boolean,
override val coroutinesError: Boolean,
override val multiplatformEnable: Boolean,
override val metadataVersionMajor: Int,
override val metadataVersionMinor: Int,
@@ -29,6 +32,9 @@ data class CommonBuildMetaInfo(
compilerBuildVersion: String,
languageVersionString: String,
apiVersionString: String,
coroutinesEnable: Boolean,
coroutinesWarn: Boolean,
coroutinesError: Boolean,
multiplatformEnable: Boolean,
ownVersion: Int,
coroutinesVersion: Int,
@@ -41,6 +47,9 @@ data class CommonBuildMetaInfo(
compilerBuildVersion = compilerBuildVersion,
languageVersionString = languageVersionString,
apiVersionString = apiVersionString,
coroutinesEnable = coroutinesEnable,
coroutinesWarn = coroutinesWarn,
coroutinesError = coroutinesError,
multiplatformEnable = multiplatformEnable,
metadataVersionMajor = metadataVersion.major,
metadataVersionMinor = metadataVersion.minor,

View File

@@ -1,12 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build
import java.io.Serializable
enum class ExecutionStrategy : Serializable {
DAEMON, IN_PROCESS, OUT_OF_PROCESS
}

View File

@@ -15,6 +15,9 @@ data class JsBuildMetaInfo(
override val compilerBuildVersion: String,
override val languageVersionString: String,
override val apiVersionString: String,
override val coroutinesEnable: Boolean,
override val coroutinesWarn: Boolean,
override val coroutinesError: Boolean,
override val multiplatformEnable: Boolean,
override val metadataVersionMajor: Int,
override val metadataVersionMinor: Int,
@@ -29,6 +32,9 @@ data class JsBuildMetaInfo(
compilerBuildVersion: String,
languageVersionString: String,
apiVersionString: String,
coroutinesEnable: Boolean,
coroutinesWarn: Boolean,
coroutinesError: Boolean,
multiplatformEnable: Boolean,
ownVersion: Int,
coroutinesVersion: Int,
@@ -41,6 +47,9 @@ data class JsBuildMetaInfo(
compilerBuildVersion = compilerBuildVersion,
languageVersionString = languageVersionString,
apiVersionString = apiVersionString,
coroutinesEnable = coroutinesEnable,
coroutinesWarn = coroutinesWarn,
coroutinesError = coroutinesError,
multiplatformEnable = multiplatformEnable,
metadataVersionMajor = metadataVersion.major,
metadataVersionMinor = metadataVersion.minor,

View File

@@ -16,7 +16,7 @@
package org.jetbrains.kotlin.build
import org.jetbrains.kotlin.load.kotlin.JvmBytecodeBinaryVersion
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmBytecodeBinaryVersion
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmMetadataVersion
/**
@@ -27,6 +27,9 @@ data class JvmBuildMetaInfo(
override val compilerBuildVersion: String,
override val languageVersionString: String,
override val apiVersionString: String,
override val coroutinesEnable: Boolean,
override val coroutinesWarn: Boolean,
override val coroutinesError: Boolean,
override val multiplatformEnable: Boolean,
override val metadataVersionMajor: Int,
override val metadataVersionMinor: Int,
@@ -44,6 +47,9 @@ data class JvmBuildMetaInfo(
compilerBuildVersion: String,
languageVersionString: String,
apiVersionString: String,
coroutinesEnable: Boolean,
coroutinesWarn: Boolean,
coroutinesError: Boolean,
multiplatformEnable: Boolean,
ownVersion: Int,
coroutinesVersion: Int,
@@ -56,6 +62,9 @@ data class JvmBuildMetaInfo(
compilerBuildVersion = compilerBuildVersion,
languageVersionString = languageVersionString,
apiVersionString = apiVersionString,
coroutinesEnable = coroutinesEnable,
coroutinesWarn = coroutinesWarn,
coroutinesError = coroutinesError,
multiplatformEnable = multiplatformEnable,
metadataVersionMajor = metadataVersion.major,
metadataVersionMinor = metadataVersion.minor,

View File

@@ -1,24 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build.report
import org.jetbrains.kotlin.build.report.metrics.BuildMetricsReporter
import org.jetbrains.kotlin.build.report.metrics.RemoteBuildMetricsReporter
open class BuildReporter(
protected open val icReporter: ICReporter,
protected open val buildMetricsReporter: BuildMetricsReporter
) : ICReporter by icReporter, BuildMetricsReporter by buildMetricsReporter
class RemoteBuildReporter(
override val icReporter: RemoteICReporter,
override val buildMetricsReporter: RemoteBuildMetricsReporter
) : BuildReporter(icReporter, buildMetricsReporter), RemoteReporter {
override fun flush() {
icReporter.flush()
buildMetricsReporter.flush()
}
}

View File

@@ -1,9 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build.report
interface RemoteICReporter : ICReporter,
RemoteReporter

View File

@@ -1,11 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build.report
interface RemoteReporter {
fun flush()
}

View File

@@ -1,37 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build.report.metrics
import java.io.Serializable
enum class BuildAttributeKind : Serializable {
REBUILD_REASON;
companion object {
const val serialVersionUID = 0L
}
}
enum class BuildAttribute(val kind: BuildAttributeKind) : Serializable {
NO_BUILD_HISTORY(BuildAttributeKind.REBUILD_REASON),
CACHE_CORRUPTION(BuildAttributeKind.REBUILD_REASON),
UNKNOWN_CHANGES_IN_GRADLE_INPUTS(BuildAttributeKind.REBUILD_REASON),
JAVA_CHANGE_UNTRACKED_FILE_IS_REMOVED(BuildAttributeKind.REBUILD_REASON),
JAVA_CHANGE_UNEXPECTED_PSI(BuildAttributeKind.REBUILD_REASON),
JAVA_CHANGE_UNKNOWN_QUALIFIER(BuildAttributeKind.REBUILD_REASON),
DEP_CHANGE_REMOVED_ENTRY(BuildAttributeKind.REBUILD_REASON),
DEP_CHANGE_HISTORY_IS_NOT_FOUND(BuildAttributeKind.REBUILD_REASON),
DEP_CHANGE_HISTORY_CANNOT_BE_READ(BuildAttributeKind.REBUILD_REASON),
DEP_CHANGE_HISTORY_NO_KNOWN_BUILDS(BuildAttributeKind.REBUILD_REASON),
DEP_CHANGE_NON_INCREMENTAL_BUILD_IN_DEP(BuildAttributeKind.REBUILD_REASON),
IN_PROCESS_EXECUTION(BuildAttributeKind.REBUILD_REASON),
OUT_OF_PROCESS_EXECUTION(BuildAttributeKind.REBUILD_REASON),
IC_IS_NOT_ENABLED(BuildAttributeKind.REBUILD_REASON);
companion object {
const val serialVersionUID = 0L
}
}

View File

@@ -1,30 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build.report.metrics
import java.io.Serializable
import java.util.*
class BuildAttributes : Serializable {
private val myAttributes =
EnumMap<BuildAttribute, Int>(
BuildAttribute::class.java
)
fun add(attr: BuildAttribute, count: Int = 1) {
myAttributes[attr] = myAttributes.getOrDefault(attr, 0) + count
}
fun addAll(other: BuildAttributes) {
other.myAttributes.forEach { (attr, n) -> add(attr, n) }
}
fun asMap(): Map<BuildAttribute, Int> = myAttributes
companion object {
const val serialVersionUID = 0L
}
}

View File

@@ -1,22 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build.report.metrics
import java.io.Serializable
data class BuildMetrics(
val buildTimes: BuildTimes = BuildTimes(),
val buildAttributes: BuildAttributes = BuildAttributes()
) : Serializable {
fun addAll(other: BuildMetrics) {
buildTimes.addAll(other.buildTimes)
buildAttributes.addAll(other.buildAttributes)
}
companion object {
const val serialVersionUID = 0L
}
}

View File

@@ -1,28 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build.report.metrics
interface BuildMetricsReporter {
fun startMeasure(metric: BuildTime, startNs: Long)
fun endMeasure(metric: BuildTime, endNs: Long)
fun addAttribute(attribute: BuildAttribute)
fun getMetrics(): BuildMetrics
fun addMetrics(metrics: BuildMetrics?)
}
inline fun <T> BuildMetricsReporter.measure(metric: BuildTime, fn: () -> T): T {
val start = System.nanoTime()
startMeasure(metric, start)
try {
return fn()
} finally {
val end = System.nanoTime()
endMeasure(metric, end)
}
}

View File

@@ -1,47 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build.report.metrics
import java.util.*
class BuildMetricsReporterImpl : BuildMetricsReporter {
private val myBuildTimeStartNs: EnumMap<BuildTime, Long> =
EnumMap(
BuildTime::class.java
)
private val myBuildTimes = BuildTimes()
private val myBuildAttributes = BuildAttributes()
override fun startMeasure(metric: BuildTime, startNs: Long) {
if (metric in myBuildTimeStartNs) {
error("$metric was restarted before it finished")
}
myBuildTimeStartNs[metric] = startNs
}
override fun endMeasure(metric: BuildTime, endNs: Long) {
val startNs = myBuildTimeStartNs.remove(metric) ?: error("$metric finished before it started")
val durationNs = endNs - startNs
myBuildTimes.add(metric, durationNs)
}
override fun addAttribute(attribute: BuildAttribute) {
myBuildAttributes.add(attribute)
}
override fun getMetrics(): BuildMetrics =
BuildMetrics(
buildTimes = myBuildTimes,
buildAttributes = myBuildAttributes
)
override fun addMetrics(metrics: BuildMetrics?) {
if (metrics == null) return
myBuildAttributes.addAll(metrics.buildAttributes)
myBuildTimes.addAll(metrics.buildTimes)
}
}

View File

@@ -1,43 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build.report.metrics
import java.io.Serializable
@Suppress("Reformat")
enum class BuildTime(val parent: BuildTime? = null) : Serializable {
GRADLE_TASK,
CLEAR_OUTPUT(GRADLE_TASK),
BACKUP_OUTPUT(GRADLE_TASK),
RESTORE_OUTPUT_FROM_BACKUP(GRADLE_TASK),
CONNECT_TO_DAEMON(GRADLE_TASK),
CLEAR_JAR_CACHE(GRADLE_TASK),
RUN_COMPILER(GRADLE_TASK),
NON_INCREMENTAL_COMPILATION_IN_PROCESS(RUN_COMPILER),
NON_INCREMENTAL_COMPILATION_OUT_OF_PROCESS(RUN_COMPILER),
NON_INCREMENTAL_COMPILATION_DAEMON(RUN_COMPILER),
INCREMENTAL_COMPILATION(RUN_COMPILER),
IC_CALCULATE_INITIAL_DIRTY_SET(INCREMENTAL_COMPILATION),
IC_ANALYZE_CHANGES_IN_DEPENDENCIES(IC_CALCULATE_INITIAL_DIRTY_SET),
IC_FIND_HISTORY_FILES(IC_ANALYZE_CHANGES_IN_DEPENDENCIES),
IC_ANALYZE_HISTORY_FILES(IC_ANALYZE_CHANGES_IN_DEPENDENCIES),
IC_ANALYZE_CHANGES_IN_JAVA_SOURCES(IC_CALCULATE_INITIAL_DIRTY_SET),
IC_ANALYZE_CHANGES_IN_ANDROID_LAYOUTS(IC_CALCULATE_INITIAL_DIRTY_SET),
IC_DETECT_REMOVED_CLASSES(IC_CALCULATE_INITIAL_DIRTY_SET),
CLEAR_OUTPUT_ON_REBUILD(INCREMENTAL_COMPILATION),
IC_UPDATE_CACHES(INCREMENTAL_COMPILATION),
INCREMENTAL_ITERATION(INCREMENTAL_COMPILATION),
NON_INCREMENTAL_ITERATION(INCREMENTAL_COMPILATION),
IC_WRITE_HISTORY_FILE(INCREMENTAL_COMPILATION);
companion object {
const val serialVersionUID = 0L
val children by lazy {
values().filter { it.parent != null }.groupBy { it.parent }
}
}
}

View File

@@ -1,29 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build.report.metrics
import java.io.Serializable
import java.util.*
class BuildTimes : Serializable {
private val myBuildTimes = EnumMap<BuildTime, Long>(BuildTime::class.java)
fun addAll(other: BuildTimes) {
for ((bt, timeNs) in other.myBuildTimes) {
add(bt, timeNs)
}
}
fun add(buildTime: BuildTime, timeNs: Long) {
myBuildTimes[buildTime] = myBuildTimes.getOrDefault(buildTime, 0) + timeNs
}
fun asMap(): Map<BuildTime, Long> = myBuildTimes
companion object {
const val serialVersionUID = 0L
}
}

View File

@@ -1,25 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build.report.metrics
object DoNothingBuildMetricsReporter : BuildMetricsReporter {
override fun startMeasure(metric: BuildTime, startNs: Long) {
}
override fun endMeasure(metric: BuildTime, endNs: Long) {
}
override fun addAttribute(attribute: BuildAttribute) {
}
override fun getMetrics(): BuildMetrics =
BuildMetrics(
BuildTimes(),
BuildAttributes()
)
override fun addMetrics(metrics: BuildMetrics?) {}
}

View File

@@ -1,11 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build.report.metrics
import org.jetbrains.kotlin.build.report.RemoteReporter
interface RemoteBuildMetricsReporter : BuildMetricsReporter,
RemoteReporter

View File

@@ -29,43 +29,21 @@ import org.jetbrains.kotlin.cli.common.arguments.Argument;
import org.jetbrains.kotlin.cli.common.arguments.CommonToolArguments;
import org.jetbrains.kotlin.cli.common.arguments.InternalArgument;
import org.jetbrains.kotlin.cli.common.arguments.ParseCommandLineArgumentsKt;
import org.jetbrains.kotlin.idea.ExplicitDefaultSubstitutor;
import org.jetbrains.kotlin.idea.ExplicitDefaultSubstitutorsKt;
import org.jetbrains.kotlin.utils.StringsKt;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Type;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
public class ArgumentUtils {
private ArgumentUtils() {
}
private ArgumentUtils() {}
@NotNull
public static List<String> convertArgumentsToStringList(@NotNull CommonToolArguments arguments)
throws InstantiationException, IllegalAccessException, InvocationTargetException {
List<String> convertedArguments = convertArgumentsToStringListInternal(arguments);
Map<KClass<? extends CommonToolArguments>, Collection<ExplicitDefaultSubstitutor>> defaultSubstitutorsMap =
ExplicitDefaultSubstitutorsKt.getDefaultSubstitutors();
KClass<? extends CommonToolArguments> argumentsKClass = JvmClassMappingKt.getKotlinClass(arguments.getClass());
Collection<ExplicitDefaultSubstitutor> defaultSubstitutors = defaultSubstitutorsMap.get(argumentsKClass);
if (defaultSubstitutors != null) {
for (ExplicitDefaultSubstitutor substitutor : defaultSubstitutors) {
if (substitutor.isSubstitutable(convertedArguments)) convertedArguments.addAll(substitutor.getNewSubstitution());
}
}
return convertedArguments;
}
@NotNull
public static List<String> convertArgumentsToStringListNoDefaults(@NotNull CommonToolArguments arguments)
throws InstantiationException, IllegalAccessException, InvocationTargetException {
return convertArgumentsToStringListInternal(arguments);
}
private static List<String> convertArgumentsToStringListInternal(@NotNull CommonToolArguments arguments)
throws InstantiationException, IllegalAccessException, InvocationTargetException {
List<String> result = new ArrayList<>();
Class<? extends CommonToolArguments> argumentsClass = arguments.getClass();
convertArgumentsToStringList(arguments, argumentsClass.newInstance(), JvmClassMappingKt.getKotlinClass(argumentsClass), result);

View File

@@ -1,46 +0,0 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.idea
import org.jetbrains.kotlin.cli.common.arguments.Argument
import org.jetbrains.kotlin.cli.common.arguments.CommonToolArguments
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
import org.jetbrains.kotlin.config.JvmTarget
import kotlin.reflect.KClass
import kotlin.reflect.KProperty1
import kotlin.reflect.full.findAnnotation
val defaultSubstitutors: Map<KClass<out CommonToolArguments>, Collection<ExplicitDefaultSubstitutor>> =
mapOf(K2JVMCompilerArguments::class to listOf(JvmTargetDefaultSubstitutor))
sealed class ExplicitDefaultSubstitutor {
abstract val substitutedProperty: KProperty1<out CommonToolArguments, String?>
abstract val oldSubstitution: List<String>
abstract val newSubstitution: List<String>
abstract fun isSubstitutable(args: List<String>): Boolean
protected val argument: Argument by lazy {
substitutedProperty.findAnnotation() ?: error("Property \"${substitutedProperty.name}\" has no Argument annotation")
}
}
object JvmTargetDefaultSubstitutor : ExplicitDefaultSubstitutor() {
override val substitutedProperty
get() = K2JVMCompilerArguments::jvmTarget
private val oldDefault: String
get() = JvmTarget.JVM_1_6.description
private val newDefault: String
get() = JvmTarget.JVM_1_8.description
private fun prepareSubstitution(default: String): List<String> = listOf(argument.value, default)
override val oldSubstitution: List<String>
get() = prepareSubstitution(oldDefault)
override val newSubstitution: List<String>
get() = prepareSubstitution(newDefault)
override fun isSubstitutable(args: List<String>): Boolean = argument.value !in args
}

View File

@@ -19,7 +19,6 @@ package org.jetbrains.kotlin.incremental
import com.intellij.util.io.EnumeratorStringDescriptor
import org.jetbrains.kotlin.incremental.storage.*
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.deserialization.Flags
import org.jetbrains.kotlin.metadata.deserialization.NameResolver
import org.jetbrains.kotlin.metadata.deserialization.TypeTable
import org.jetbrains.kotlin.metadata.deserialization.supertypes
@@ -35,15 +34,12 @@ interface IncrementalCacheCommon {
val thisWithDependentCaches: Iterable<AbstractIncrementalCache<*>>
fun classesFqNamesBySources(files: Iterable<File>): Collection<FqName>
fun getSubtypesOf(className: FqName): Sequence<FqName>
fun getSupertypesOf(className: FqName): Sequence<FqName>
fun getSourceFileIfClass(fqName: FqName): File?
fun markDirty(removedAndCompiledSources: Collection<File>)
fun clearCacheForRemovedClasses(changesCollector: ChangesCollector)
fun getComplementaryFilesRecursive(dirtyFiles: Collection<File>): Collection<File>
fun updateComplementaryFiles(dirtyFiles: Collection<File>, expectActualTracker: ExpectActualTrackerImpl)
fun dump(): String
fun isSealed(className: FqName): Boolean?
}
/**
@@ -54,7 +50,6 @@ abstract class AbstractIncrementalCache<ClassName>(
protected val pathConverter: FileToPathConverter
) : BasicMapsOwner(workingDir), IncrementalCacheCommon {
companion object {
private val CLASS_ATTRIBUTES = "class-attributes"
private val SUBTYPES = "subtypes"
private val SUPERTYPES = "supertypes"
private val CLASS_FQ_NAME_TO_SOURCE = "class-fq-name-to-source"
@@ -76,7 +71,6 @@ abstract class AbstractIncrementalCache<ClassName>(
result
}
internal val classAttributesMap = registerMap(ClassAttributesMap(CLASS_ATTRIBUTES.storageFile))
private val subtypesMap = registerMap(SubtypesMap(SUBTYPES.storageFile))
private val supertypesMap = registerMap(SupertypesMap(SUPERTYPES.storageFile))
protected val classFqNameToSourceMap = registerMap(ClassFqNameToSourceMap(CLASS_FQ_NAME_TO_SOURCE.storageFile, pathConverter))
@@ -96,14 +90,6 @@ abstract class AbstractIncrementalCache<ClassName>(
override fun getSubtypesOf(className: FqName): Sequence<FqName> =
subtypesMap[className].asSequence()
override fun getSupertypesOf(className: FqName): Sequence<FqName> {
return supertypesMap[className].asSequence()
}
override fun isSealed(className: FqName): Boolean? {
return classAttributesMap[className]?.isSealed
}
override fun getSourceFileIfClass(fqName: FqName): File? =
classFqNameToSourceMap[fqName]
@@ -132,7 +118,6 @@ abstract class AbstractIncrementalCache<ClassName>(
supertypesMap[child] = parents
classFqNameToSourceMap[child] = srcFile
classAttributesMap[child] = ICClassesAttributes(ProtoBuf.Modality.SEALED == Flags.MODALITY.get(proto.flags))
}
protected fun removeAllFromClassStorage(removedClasses: Collection<FqName>, changesCollector: ChangesCollector) {
@@ -167,17 +152,14 @@ abstract class AbstractIncrementalCache<ClassName>(
}
}
removedFqNames.forEach {
classFqNameToSourceMap.remove(it)
classAttributesMap.remove(it)
}
removedFqNames.forEach { classFqNameToSourceMap.remove(it) }
}
protected class ClassFqNameToSourceMap(
storageFile: File,
private val pathConverter: FileToPathConverter
) : BasicStringMap<String>(storageFile, EnumeratorStringDescriptor(), PathStringDescriptor) {
) :
BasicStringMap<String>(storageFile, EnumeratorStringDescriptor(), PathStringDescriptor) {
operator fun set(fqName: FqName, sourceFile: File) {
storage[fqName.asString()] = pathConverter.toPath(sourceFile)
}

View File

@@ -19,14 +19,12 @@ package org.jetbrains.kotlin.incremental
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.deserialization.Flags
import org.jetbrains.kotlin.metadata.deserialization.NameResolver
import org.jetbrains.kotlin.metadata.deserialization.supertypes
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.protobuf.MessageLite
import org.jetbrains.kotlin.serialization.deserialization.getClassId
class ChangesCollector {
private val removedMembers = hashMapOf<FqName, MutableSet<String>>()
private val changedParents = hashMapOf<FqName, MutableSet<FqName>>()
private val changedMembers = hashMapOf<FqName, MutableSet<String>>()
private val areSubclassesAffected = hashMapOf<FqName, Boolean>()
@@ -49,10 +47,6 @@ class ChangesCollector {
changes.add(ChangeInfo.SignatureChanged(fqName, areSubclassesAffected))
}
for ((fqName, changedParents) in changedParents) {
changes.add(ChangeInfo.ParentsChanged(fqName, changedParents))
}
return changes
}
@@ -85,12 +79,12 @@ class ChangesCollector {
}
if (oldData == null) {
newData!!.collectAll(isRemoved = false, isAdded = true, collectAllMembersForNewClass = collectAllMembersForNewClass)
newData!!.collectAll(isRemoved = false, collectAllMembersForNewClass = collectAllMembersForNewClass)
return
}
if (newData == null) {
oldData.collectAll(isRemoved = true, isAdded = false)
oldData.collectAll(isRemoved = true)
return
}
@@ -104,7 +98,6 @@ class ChangesCollector {
collectSignature(oldData, diff.areSubclassesAffected)
}
collectChangedMembers(fqName, diff.changedMembersNames)
addChangedParents(fqName, diff.changedSupertypes)
}
is PackagePartProtoData -> {
collectSignature(oldData, areSubclassesAffected = true)
@@ -128,11 +121,10 @@ class ChangesCollector {
private fun <T> T.getNonPrivateNames(nameResolver: NameResolver, vararg members: T.() -> List<MessageLite>): Set<String> =
members.flatMap { this.it().filterNot { it.isPrivate }.names(nameResolver) }.toSet()
//TODO remember all sealed parent classes
private fun ProtoData.collectAll(isRemoved: Boolean, isAdded: Boolean, collectAllMembersForNewClass: Boolean = false) =
private fun ProtoData.collectAll(isRemoved: Boolean, collectAllMembersForNewClass: Boolean = false) =
when (this) {
is PackagePartProtoData -> collectAllFromPackage(isRemoved)
is ClassProtoData -> collectAllFromClass(isRemoved, isAdded, collectAllMembersForNewClass)
is ClassProtoData -> collectAllFromClass(isRemoved, collectAllMembersForNewClass)
}
private fun PackagePartProtoData.collectAllFromPackage(isRemoved: Boolean) {
@@ -151,7 +143,7 @@ class ChangesCollector {
}
}
private fun ClassProtoData.collectAllFromClass(isRemoved: Boolean, isAdded: Boolean, collectAllMembersForNewClass: Boolean = false) {
private fun ClassProtoData.collectAllFromClass(isRemoved: Boolean, collectAllMembersForNewClass: Boolean = false) {
val classFqName = nameResolver.getClassId(proto.fqName).asSingleFqName()
val kind = Flags.CLASS_KIND.get(proto.flags)
@@ -170,23 +162,6 @@ class ChangesCollector {
collectSignature(classFqName, areSubclassesAffected = true)
}
if (isRemoved || isAdded) {
collectChangedParents(classFqName, proto.supertypeList)
}
}
private fun addChangedParents(fqName: FqName, parents: Collection<FqName>) {
if (parents.isNotEmpty()) {
changedParents.getOrPut(fqName) { HashSet() }.addAll(parents)
}
}
private fun ClassProtoData.collectChangedParents(fqName: FqName, parents: Collection<ProtoBuf.Type>) {
val changedParentsFqNames = parents.map { type ->
nameResolver.getClassId(type.className).asSingleFqName()
}
addChangedParents(fqName, changedParentsFqNames)
}
private fun ClassProtoData.getNonPrivateMemberNames(): Set<String> {

View File

@@ -3,7 +3,7 @@
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build.report
package org.jetbrains.kotlin.incremental
import org.jetbrains.kotlin.cli.common.ExitCode
import java.io.File
@@ -17,5 +17,3 @@ interface ICReporter {
fun reportMarkDirtyMember(affectedFiles: Iterable<File>, scope: String, name: String)
fun reportMarkDirty(affectedFiles: Iterable<File>, reason: String)
}

View File

@@ -1,9 +1,9 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build.report
package org.jetbrains.kotlin.incremental
import java.io.File

View File

@@ -32,7 +32,6 @@ import org.jetbrains.kotlin.name.parentOrNull
import org.jetbrains.kotlin.serialization.SerializerExtensionProtocol
import org.jetbrains.kotlin.serialization.deserialization.getClassId
import org.jetbrains.kotlin.serialization.js.JsSerializerProtocol
import org.jetbrains.kotlin.util.capitalizeDecapitalize.capitalizeAsciiOnly
import java.io.DataInput
import java.io.DataOutput
import java.io.File
@@ -76,7 +75,7 @@ open class IncrementalJsCache(
override fun markDirty(removedAndCompiledSources: Collection<File>) {
removedAndCompiledSources.forEach { sourceFile ->
// The common prefix of all FQN parents has to be the file package
sourceToClassesMap[sourceFile].map { it.parentOrNull()?.asString() ?: "" }.minByOrNull { it.length }?.let {
sourceToClassesMap[sourceFile].map { it.parentOrNull()?.asString() ?: "" }.minBy { it.length }?.let {
packageMetadata.remove(it)
}
}
@@ -327,7 +326,7 @@ private class ProtoDataProvider(private val serializerProtocol: SerializerExtens
proto.`package`.apply {
val packageNameId = getExtensionOrNull(serializerProtocol.packageFqName)
val packageFqName = packageNameId?.let { FqName(nameResolver.getPackageFqName(it)) } ?: FqName.ROOT
val packagePartClassId = ClassId(packageFqName, Name.identifier(sourceFile.nameWithoutExtension.capitalizeAsciiOnly() + "Kt"))
val packagePartClassId = ClassId(packageFqName, Name.identifier(sourceFile.nameWithoutExtension.capitalize() + "Kt"))
classes[packagePartClassId] = PackagePartProtoData(this, nameResolver, packageFqName)
}
@@ -348,7 +347,7 @@ fun getProtoData(sourceFile: File, metadata: ByteArray): Map<ClassId, ProtoData>
proto.`package`.apply {
val packageFqName = getExtensionOrNull(JsProtoBuf.packageFqName)?.let(nameResolver::getPackageFqName)?.let(::FqName) ?: FqName.ROOT
val packagePartClassId = ClassId(packageFqName, Name.identifier(sourceFile.nameWithoutExtension.capitalizeAsciiOnly() + "Kt"))
val packagePartClassId = ClassId(packageFqName, Name.identifier(sourceFile.nameWithoutExtension.capitalize() + "Kt"))
classes[packagePartClassId] = PackagePartProtoData(this, nameResolver, packageFqName)
}
@@ -413,4 +412,4 @@ private class PackageMetadataMap(storageFile: File) : BasicStringMap<ByteArray>(
operator fun get(packageName: String) = storage[packageName]
override fun dumpValue(value: ByteArray): String = "Package metadata: ${value.md5()}"
}
}

View File

@@ -94,10 +94,6 @@ open class IncrementalJvmCache(
fun sourcesByInternalName(internalName: String): Collection<File> =
internalNameToSource[internalName]
fun getAllPartsOfMultifileFacade(facade: JvmClassName): Collection<String>? {
return multifileFacadeToParts[facade]
}
fun isMultifileFacade(className: JvmClassName): Boolean =
className in multifileFacadeToParts
@@ -149,7 +145,6 @@ open class IncrementalJvmCache(
}
protoMap.remove(className, changesCollector)
classFqNameToSourceMap.remove(className.fqNameForClassNameWithoutDollars)
classAttributesMap.remove(className.fqNameForClassNameWithoutDollars)
internalNameToSource.remove(className.internalName)
// TODO NO_CHANGES? (delegates only)
@@ -173,8 +168,6 @@ open class IncrementalJvmCache(
constantsMap.process(kotlinClass, changesCollector)
inlineFunctionsMap.process(kotlinClass, changesCollector)
}
KotlinClassHeader.Kind.UNKNOWN, KotlinClassHeader.Kind.SYNTHETIC_CLASS -> {
}
}
}
@@ -276,7 +269,6 @@ open class IncrementalJvmCache(
private inner class ProtoMap(storageFile: File) : BasicStringMap<ProtoMapValue>(storageFile, ProtoMapValueExternalizer) {
@Synchronized
fun process(kotlinClass: LocalFileKotlinClass, changesCollector: ChangesCollector) {
return put(kotlinClass, changesCollector)
}
@@ -288,12 +280,10 @@ open class IncrementalJvmCache(
// from files compiled during last round.
// However there is no need to compare old and new data in this case
// (also that would fail with exception).
@Synchronized
fun storeModuleMapping(className: JvmClassName, bytes: ByteArray) {
storage[className.internalName] = ProtoMapValue(isPackageFacade = false, bytes = bytes, strings = emptyArray())
}
@Synchronized
private fun put(kotlinClass: LocalFileKotlinClass, changesCollector: ChangesCollector) {
val header = kotlinClass.classHeader
@@ -316,7 +306,6 @@ open class IncrementalJvmCache(
operator fun get(className: JvmClassName): ProtoMapValue? =
storage[className.internalName]
@Synchronized
fun remove(className: JvmClassName, changesCollector: ChangesCollector) {
val key = className.internalName
val oldValue = storage[key] ?: return
@@ -333,8 +322,6 @@ open class IncrementalJvmCache(
private inner class JavaSourcesProtoMap(storageFile: File) :
BasicStringMap<SerializedJavaClass>(storageFile, JavaClassProtoMapValueExternalizer) {
@Synchronized
fun process(jvmClassName: JvmClassName, newData: SerializedJavaClass, changesCollector: ChangesCollector) {
val key = jvmClassName.internalName
val oldData = storage[key]
@@ -346,7 +333,6 @@ open class IncrementalJvmCache(
)
}
@Synchronized
fun remove(className: JvmClassName, changesCollector: ChangesCollector) {
val key = className.internalName
val oldValue = storage[key] ?: return
@@ -386,7 +372,6 @@ open class IncrementalJvmCache(
operator fun contains(className: JvmClassName): Boolean =
className.internalName in storage
@Synchronized
fun process(kotlinClass: LocalFileKotlinClass, changesCollector: ChangesCollector) {
val key = kotlinClass.className.internalName
val oldMap = storage[key] ?: emptyMap()
@@ -403,7 +388,6 @@ open class IncrementalJvmCache(
}
}
@Synchronized
fun remove(className: JvmClassName) {
storage.remove(className.internalName)
}
@@ -429,8 +413,6 @@ open class IncrementalJvmCache(
private inner class MultifileClassFacadeMap(storageFile: File) :
BasicStringMap<Collection<String>>(storageFile, StringCollectionExternalizer) {
@Synchronized
operator fun set(className: JvmClassName, partNames: Collection<String>) {
storage[className.internalName] = partNames
}
@@ -441,7 +423,6 @@ open class IncrementalJvmCache(
operator fun contains(className: JvmClassName): Boolean =
className.internalName in storage
@Synchronized
fun remove(className: JvmClassName) {
storage.remove(className.internalName)
}
@@ -451,8 +432,6 @@ open class IncrementalJvmCache(
private inner class MultifileClassPartMap(storageFile: File) :
BasicStringMap<String>(storageFile, EnumeratorStringDescriptor.INSTANCE) {
@Synchronized
fun set(partName: String, facadeName: String) {
storage[partName] = facadeName
}
@@ -460,7 +439,6 @@ open class IncrementalJvmCache(
fun get(partName: JvmClassName): String? =
storage[partName.internalName]
@Synchronized
fun remove(className: JvmClassName) {
storage.remove(className.internalName)
}
@@ -542,7 +520,6 @@ open class IncrementalJvmCache(
return result
}
@Synchronized
fun process(kotlinClass: LocalFileKotlinClass, changesCollector: ChangesCollector) {
val key = kotlinClass.className.internalName
val oldMap = storage[key] ?: emptyMap()
@@ -568,7 +545,6 @@ open class IncrementalJvmCache(
private fun functionNameBySignature(signature: String): String =
signature.substringBefore("(")
@Synchronized
fun remove(className: JvmClassName) {
storage.remove(className.internalName)
}
@@ -590,7 +566,6 @@ sealed class ChangeInfo(val fqName: FqName) {
class SignatureChanged(fqName: FqName, val areSubclassesAffected: Boolean) : ChangeInfo(fqName)
class ParentsChanged(fqName: FqName, val parentsChanged: Collection<FqName>) : ChangeInfo(fqName)
protected open fun toStringProperties(): String = "fqName = $fqName"

View File

@@ -21,7 +21,6 @@ data class IncrementalModuleEntry(
class IncrementalModuleInfo(
val projectRoot: File,
val rootProjectBuildDir: File,
val dirToModule: Map<File, IncrementalModuleEntry>,
val nameToModules: Map<String, Set<IncrementalModuleEntry>>,
val jarToClassListFile: Map<File, File>,
@@ -29,6 +28,6 @@ class IncrementalModuleInfo(
val jarToModule: Map<File, IncrementalModuleEntry>
) : Serializable {
companion object {
private const val serialVersionUID = 1L
private const val serialVersionUID = 0L
}
}

View File

@@ -17,7 +17,7 @@
package org.jetbrains.kotlin.incremental
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.load.java.JavaDescriptorVisibilities
import org.jetbrains.kotlin.load.java.JavaVisibilities
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.deserialization.BinaryVersion
import org.jetbrains.kotlin.metadata.java.JavaClassProtoBuf
@@ -41,7 +41,7 @@ class JavaClassesSerializerExtension : KotlinSerializerExtensionBase(BuiltInSeri
childSerializer: DescriptorSerializer
) {
super.serializeClass(descriptor, proto, versionRequirementTable, childSerializer)
if (descriptor.visibility == JavaDescriptorVisibilities.PACKAGE_VISIBILITY) {
if (descriptor.visibility == JavaVisibilities.PACKAGE_VISIBILITY) {
proto.setExtension(JavaClassProtoBuf.isPackagePrivateClass, true)
}
}
@@ -50,7 +50,7 @@ class JavaClassesSerializerExtension : KotlinSerializerExtensionBase(BuiltInSeri
proto: ProtoBuf.Constructor.Builder,
childSerializer: DescriptorSerializer) {
super.serializeConstructor(descriptor, proto, childSerializer)
if (descriptor.visibility == JavaDescriptorVisibilities.PACKAGE_VISIBILITY) {
if (descriptor.visibility == JavaVisibilities.PACKAGE_VISIBILITY) {
proto.setExtension(JavaClassProtoBuf.isPackagePrivateConstructor, true)
}
}
@@ -62,7 +62,7 @@ class JavaClassesSerializerExtension : KotlinSerializerExtensionBase(BuiltInSeri
childSerializer: DescriptorSerializer
) {
super.serializeFunction(descriptor, proto, versionRequirementTable, childSerializer)
if (descriptor.visibility == JavaDescriptorVisibilities.PACKAGE_VISIBILITY) {
if (descriptor.visibility == JavaVisibilities.PACKAGE_VISIBILITY) {
proto.setExtension(JavaClassProtoBuf.isPackagePrivateMethod, true)
}
@@ -78,7 +78,7 @@ class JavaClassesSerializerExtension : KotlinSerializerExtensionBase(BuiltInSeri
childSerializer: DescriptorSerializer
) {
super.serializeProperty(descriptor, proto, versionRequirementTable, childSerializer)
if (descriptor.visibility == JavaDescriptorVisibilities.PACKAGE_VISIBILITY) {
if (descriptor.visibility == JavaVisibilities.PACKAGE_VISIBILITY) {
proto.setExtension(JavaClassProtoBuf.isPackagePrivateField, true)
}

View File

@@ -23,12 +23,12 @@ import org.jetbrains.kotlin.resolve.jvm.JvmClassName
import java.io.File
class LocalFileKotlinClass private constructor(
private val file: File,
private val fileContents: ByteArray,
className: ClassId,
classVersion: Int,
classHeader: KotlinClassHeader,
innerClasses: InnerClassesInfo
private val file: File,
private val fileContents: ByteArray,
className: ClassId,
classVersion: Int,
classHeader: KotlinClassHeader,
innerClasses: InnerClassesInfo
) : FileBasedKotlinClass(className, classVersion, classHeader, innerClasses) {
companion object {

View File

@@ -17,18 +17,19 @@
package org.jetbrains.kotlin.incremental
import com.intellij.util.containers.MultiMap
import com.intellij.util.containers.StringInterner
import org.jetbrains.annotations.TestOnly
import org.jetbrains.kotlin.incremental.components.LookupTracker
import org.jetbrains.kotlin.incremental.components.Position
import org.jetbrains.kotlin.incremental.components.ScopeKind
import org.jetbrains.kotlin.incremental.storage.*
import org.jetbrains.kotlin.utils.Printer
import org.jetbrains.kotlin.utils.createStringInterner
import org.jetbrains.kotlin.utils.keysToMap
import java.io.File
import java.io.IOException
import java.util.*
open class LookupStorage(
targetDataDir: File,
pathConverter: FileToPathConverter
@@ -79,7 +80,7 @@ open class LookupStorage(
for (lookupSymbol in lookups.keySet().sorted()) {
val key = LookupSymbolKey(lookupSymbol.name, lookupSymbol.scope)
val paths = lookups[lookupSymbol]
val paths = lookups[lookupSymbol]!!
val fileIds = paths.mapTo(TreeSet()) { pathToId[it]!! }
fileIds.addAll(lookupMap[key] ?: emptySet())
lookupMap[key] = fileIds
@@ -211,8 +212,8 @@ open class LookupStorage(
class LookupTrackerImpl(private val delegate: LookupTracker) : LookupTracker {
val lookups = MultiMap.createSet<LookupSymbol, String>()
val pathInterner = createStringInterner()
private val interner = createStringInterner()
val pathInterner = StringInterner()
private val interner = StringInterner()
override val requiresPosition: Boolean
get() = delegate.requiresPosition

View File

@@ -14,8 +14,6 @@
* limitations under the License.
*/
@file:Suppress("UNUSED_PARAMETER")
package org.jetbrains.kotlin.incremental
import org.jetbrains.kotlin.library.metadata.KlibMetadataProtoBuf
@@ -182,21 +180,6 @@ open class ProtoCompareGenerated(
if (!checkEqualsClassSealedSubclassFqName(old, new)) return false
if (old.hasInlineClassUnderlyingPropertyName() != new.hasInlineClassUnderlyingPropertyName()) return false
if (old.hasInlineClassUnderlyingPropertyName()) {
if (!checkStringEquals(old.inlineClassUnderlyingPropertyName, new.inlineClassUnderlyingPropertyName)) return false
}
if (old.hasInlineClassUnderlyingType() != new.hasInlineClassUnderlyingType()) return false
if (old.hasInlineClassUnderlyingType()) {
if (!checkEquals(old.inlineClassUnderlyingType, new.inlineClassUnderlyingType)) return false
}
if (old.hasInlineClassUnderlyingTypeId() != new.hasInlineClassUnderlyingTypeId()) return false
if (old.hasInlineClassUnderlyingTypeId()) {
if (!checkEquals(oldTypeTable.getType(old.inlineClassUnderlyingTypeId), newTypeTable.getType(new.inlineClassUnderlyingTypeId))) return false
}
if (!checkEqualsClassVersionRequirement(old, new)) return false
if (old.hasVersionRequirementTable() != new.hasVersionRequirementTable()) return false
@@ -281,9 +264,6 @@ open class ProtoCompareGenerated(
TYPE_ALIAS_LIST,
ENUM_ENTRY_LIST,
SEALED_SUBCLASS_FQ_NAME_LIST,
INLINE_CLASS_UNDERLYING_PROPERTY_NAME,
INLINE_CLASS_UNDERLYING_TYPE,
INLINE_CLASS_UNDERLYING_TYPE_ID,
VERSION_REQUIREMENT_LIST,
VERSION_REQUIREMENT_TABLE,
JVM_EXT_CLASS_MODULE_NAME,
@@ -332,21 +312,6 @@ open class ProtoCompareGenerated(
if (!checkEqualsClassSealedSubclassFqName(old, new)) result.add(ProtoBufClassKind.SEALED_SUBCLASS_FQ_NAME_LIST)
if (old.hasInlineClassUnderlyingPropertyName() != new.hasInlineClassUnderlyingPropertyName()) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_PROPERTY_NAME)
if (old.hasInlineClassUnderlyingPropertyName()) {
if (!checkStringEquals(old.inlineClassUnderlyingPropertyName, new.inlineClassUnderlyingPropertyName)) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_PROPERTY_NAME)
}
if (old.hasInlineClassUnderlyingType() != new.hasInlineClassUnderlyingType()) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE)
if (old.hasInlineClassUnderlyingType()) {
if (!checkEquals(old.inlineClassUnderlyingType, new.inlineClassUnderlyingType)) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE)
}
if (old.hasInlineClassUnderlyingTypeId() != new.hasInlineClassUnderlyingTypeId()) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE_ID)
if (old.hasInlineClassUnderlyingTypeId()) {
if (!checkEquals(oldTypeTable.getType(old.inlineClassUnderlyingTypeId), newTypeTable.getType(new.inlineClassUnderlyingTypeId))) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE_ID)
}
if (!checkEqualsClassVersionRequirement(old, new)) result.add(ProtoBufClassKind.VERSION_REQUIREMENT_LIST)
if (old.hasVersionRequirementTable() != new.hasVersionRequirementTable()) result.add(ProtoBufClassKind.VERSION_REQUIREMENT_TABLE)
@@ -1761,18 +1726,6 @@ fun ProtoBuf.Class.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) ->
hashCode = 31 * hashCode + fqNameIndexes(getSealedSubclassFqName(i))
}
if (hasInlineClassUnderlyingPropertyName()) {
hashCode = 31 * hashCode + stringIndexes(inlineClassUnderlyingPropertyName)
}
if (hasInlineClassUnderlyingType()) {
hashCode = 31 * hashCode + inlineClassUnderlyingType.hashCode(stringIndexes, fqNameIndexes, typeById)
}
if (hasInlineClassUnderlyingTypeId()) {
hashCode = 31 * hashCode + typeById(inlineClassUnderlyingTypeId).hashCode(stringIndexes, fqNameIndexes, typeById)
}
for(i in 0..versionRequirementCount - 1) {
hashCode = 31 * hashCode + getVersionRequirement(i)
}

View File

@@ -20,7 +20,6 @@ import org.jetbrains.kotlin.build.GeneratedFile
import org.jetbrains.kotlin.build.GeneratedJvmClass
import org.jetbrains.kotlin.build.JvmSourceRoot
import org.jetbrains.kotlin.build.isModuleMappingFile
import org.jetbrains.kotlin.build.report.ICReporter
import org.jetbrains.kotlin.config.Services
import org.jetbrains.kotlin.incremental.components.LookupTracker
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCache
@@ -32,7 +31,6 @@ import org.jetbrains.kotlin.progress.CompilationCanceledStatus
import org.jetbrains.kotlin.resolve.sam.SAM_LOOKUP_NAME
import org.jetbrains.kotlin.utils.addToStdlib.flattenTo
import java.io.File
import java.nio.file.Files
import java.util.*
import kotlin.collections.HashSet
import kotlin.collections.LinkedHashSet
@@ -68,7 +66,7 @@ fun makeModuleFile(
friendDirs
)
val scriptFile = Files.createTempFile("kjps", sanitizeJavaIdentifier(name) + ".script.xml").toFile()
val scriptFile = File.createTempFile("kjps", sanitizeJavaIdentifier(name) + ".script.xml")
scriptFile.writeText(builder.asText().toString())
return scriptFile
}
@@ -136,8 +134,7 @@ fun LookupStorage.update(
data class DirtyData(
val dirtyLookupSymbols: Collection<LookupSymbol> = emptyList(),
val dirtyClassesFqNames: Collection<FqName> = emptyList(),
val dirtyClassesFqNamesForceRecompile: Collection<FqName> = emptyList()
val dirtyClassesFqNames: Collection<FqName> = emptyList()
)
fun ChangesCollector.getDirtyData(
@@ -147,9 +144,6 @@ fun ChangesCollector.getDirtyData(
val dirtyLookupSymbols = HashSet<LookupSymbol>()
val dirtyClassesFqNames = HashSet<FqName>()
val sealedParents = HashMap<FqName, MutableSet<FqName>>()
val notSealedParents = HashSet<FqName>()
for (change in changes()) {
reporter.reportVerbose { "Process $change" }
@@ -174,35 +168,10 @@ fun ChangesCollector.getDirtyData(
}
fqNames.mapTo(dirtyLookupSymbols) { LookupSymbol(SAM_LOOKUP_NAME.asString(), it.asString()) }
} else if (change is ChangeInfo.ParentsChanged) {
fun FqName.isSealed(): Boolean {
if (notSealedParents.contains(this)) return false
if (sealedParents.containsKey(this)) return true
return isSealed(this, caches).also { sealed ->
if (sealed) {
sealedParents[this] = HashSet()
} else {
notSealedParents.add(this)
}
}
}
change.parentsChanged.forEach { parent ->
if (parent.isSealed()) {
sealedParents.getOrPut(parent) { HashSet() }.add(change.fqName)
}
}
}
}
val forceRecompile = HashSet<FqName>().apply {
addAll(sealedParents.keys)
//we should recompile all inheritors with parent sealed class: add known subtypes
addAll(sealedParents.keys.flatMap { withSubtypes(it, caches) })
//we should recompile all inheritors with parent sealed class: add new subtypes
addAll(sealedParents.values.flatten())
}
return DirtyData(dirtyLookupSymbols, dirtyClassesFqNames, forceRecompile)
return DirtyData(dirtyLookupSymbols, dirtyClassesFqNames)
}
fun mapLookupSymbolsToFiles(
@@ -246,11 +215,6 @@ fun mapClassesFqNamesToFiles(
return fqNameToAffectedFiles.values.flattenTo(HashSet())
}
fun isSealed(
fqName: FqName,
caches: Iterable<IncrementalCacheCommon>
): Boolean = caches.any { it.isSealed(fqName) ?: false }
fun withSubtypes(
typeFqName: FqName,
caches: Iterable<IncrementalCacheCommon>

View File

@@ -16,7 +16,7 @@
package org.jetbrains.kotlin.incremental
import org.jetbrains.kotlin.descriptors.DescriptorVisibilities
import org.jetbrains.kotlin.descriptors.Visibilities
import org.jetbrains.kotlin.incremental.ProtoCompareGenerated.ProtoBufClassKind
import org.jetbrains.kotlin.incremental.ProtoCompareGenerated.ProtoBufPackageKind
import org.jetbrains.kotlin.incremental.storage.ProtoMapValue
@@ -27,15 +27,12 @@ import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmProtoBufUtil
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.protobuf.MessageLite
import org.jetbrains.kotlin.serialization.deserialization.ProtoEnumFlags
import org.jetbrains.kotlin.serialization.deserialization.descriptorVisibility
import org.jetbrains.kotlin.serialization.deserialization.getClassId
import java.util.*
data class Difference(
val isClassAffected: Boolean = false,
val areSubclassesAffected: Boolean = false,
val changedMembersNames: Set<String> = emptySet(),
val changedSupertypes: Set<FqName> = emptySet()
val changedMembersNames: Set<String> = emptySet()
)
sealed class ProtoData
@@ -52,8 +49,8 @@ fun ProtoMapValue.toProtoData(packageFqName: FqName): ProtoData =
}
internal val MessageLite.isPrivate: Boolean
get() = DescriptorVisibilities.isPrivate(
ProtoEnumFlags.descriptorVisibility(
get() = Visibilities.isPrivate(
ProtoEnumFlags.visibility(
when (this) {
is ProtoBuf.Constructor -> Flags.VISIBILITY.get(flags)
is ProtoBuf.Function -> Flags.VISIBILITY.get(flags)
@@ -189,7 +186,6 @@ class DifferenceCalculatorForClass(
var isClassAffected = false
var areSubclassesAffected = false
val changedSupertypes = HashSet<FqName>()
val names = hashSetOf<String>()
val classIsSealed = newProto.isSealed && oldProto.isSealed
@@ -250,21 +246,12 @@ class DifferenceCalculatorForClass(
ProtoBufClassKind.FLAGS,
ProtoBufClassKind.FQ_NAME,
ProtoBufClassKind.TYPE_PARAMETER_LIST,
ProtoBufClassKind.SUPERTYPE_LIST,
ProtoBufClassKind.SUPERTYPE_ID_LIST,
ProtoBufClassKind.JS_EXT_CLASS_ANNOTATION_LIST -> {
isClassAffected = true
areSubclassesAffected = true
}
ProtoBufClassKind.SUPERTYPE_LIST,
ProtoBufClassKind.SUPERTYPE_ID_LIST -> {
isClassAffected = true
areSubclassesAffected = true
val oldSupertypes = oldProto.supertypeList.map { oldNameResolver.getClassId(it.className).asSingleFqName() }
val newSupertypes = newProto.supertypeList.map { newNameResolver.getClassId(it.className).asSingleFqName() }
val changed = (oldSupertypes union newSupertypes) subtract (oldSupertypes intersect newSupertypes)
changedSupertypes.addAll(changed)
}
ProtoBufClassKind.JVM_EXT_CLASS_MODULE_NAME,
ProtoBufClassKind.JS_EXT_CLASS_CONTAINING_FILE_ID -> {
// TODO
@@ -290,15 +277,10 @@ class DifferenceCalculatorForClass(
isClassAffected = true
areSubclassesAffected = true
}
ProtoBufClassKind.INLINE_CLASS_UNDERLYING_PROPERTY_NAME,
ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE,
ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE_ID -> {
isClassAffected = true
}
}
}
return Difference(isClassAffected, areSubclassesAffected, names, changedSupertypes)
return Difference(isClassAffected, areSubclassesAffected, names)
}
}
@@ -364,4 +346,4 @@ val ProtoBuf.Class.typeTableOrNull: ProtoBuf.TypeTable?
get() = if (hasTypeTable()) typeTable else null
val ProtoBuf.Package.typeTableOrNull: ProtoBuf.TypeTable?
get() = if (hasTypeTable()) typeTable else null
get() = if (hasTypeTable()) typeTable else null

View File

@@ -30,7 +30,6 @@ open class BasicMapsOwner(val cachesDir: File) {
protected val String.storageFile: File
get() = File(cachesDir, this + "." + CACHE_EXTENSION)
@Synchronized
protected fun <K, V, M : BasicMap<K, V>> registerMap(map: M): M {
maps.add(map)
return map
@@ -48,7 +47,6 @@ open class BasicMapsOwner(val cachesDir: File) {
forEachMapSafe("flush") { it.flush(memoryCachesOnly) }
}
@Synchronized
private fun forEachMapSafe(actionName: String, action: (BasicMap<*, *>) -> Unit) {
val actionExceptions = LinkedHashMap<String, Exception>()
maps.forEach {
@@ -68,6 +66,5 @@ open class BasicMapsOwner(val cachesDir: File) {
}
@TestOnly
@Synchronized
fun dump(): String = maps.joinToString("\n\n") { it.dump() }
}

View File

@@ -17,11 +17,9 @@
package org.jetbrains.kotlin.incremental.storage
import com.intellij.util.io.DataExternalizer
import com.intellij.util.io.IOUtil
import com.intellij.util.io.KeyDescriptor
import com.intellij.util.io.PersistentHashMap
import java.io.File
import java.io.IOException
/**
@@ -32,6 +30,7 @@ class CachingLazyStorage<K, V>(
private val keyDescriptor: KeyDescriptor<K>,
private val valueExternalizer: DataExternalizer<V>
) : LazyStorage<K, V> {
@Volatile
private var storage: PersistentHashMap<K, V>? = null
@Synchronized
@@ -81,10 +80,8 @@ class CachingLazyStorage<K, V>(
try {
storage?.close()
} finally {
PersistentHashMap.deleteFilesStartingWith(storageFile)
storage = null
if (!IOUtil.deleteAllFilesStartingWith(storageFile)) {
throw IOException("Could not delete internal storage: ${storageFile.absolutePath}")
}
}
}

View File

@@ -1,51 +0,0 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.incremental.storage
import com.intellij.util.io.DataExternalizer
import org.jetbrains.kotlin.name.FqName
import java.io.DataInput
import java.io.DataOutput
import java.io.File
internal data class ICClassesAttributes(val isSealed: Boolean)
internal object ICClassesAttributesExternalizer : DataExternalizer<ICClassesAttributes> {
override fun read(input: DataInput): ICClassesAttributes {
return ICClassesAttributes(input.readBoolean())
}
override fun save(output: DataOutput, value: ICClassesAttributes) {
output.writeBoolean(value.isSealed)
}
}
internal open class ClassAttributesMap(
storageFile: File
) : BasicStringMap<ICClassesAttributes>(storageFile, ICClassesAttributesExternalizer) {
override fun dumpValue(value: ICClassesAttributes): String = value.toString()
operator fun set(key: FqName, value: ICClassesAttributes) {
storage[key.asString()] = value
}
operator fun get(key: FqName): ICClassesAttributes? = storage[key.asString()]
fun remove(key: FqName) {
storage.remove(key.asString())
}
}

View File

@@ -20,18 +20,18 @@ import org.jetbrains.kotlin.incremental.dumpCollection
import org.jetbrains.kotlin.name.FqName
import java.io.File
internal open class ClassOneToManyMap(storageFile: File) : BasicStringMap<Collection<String>>(storageFile, StringCollectionExternalizer) {
internal open class ClassOneToManyMap(
storageFile: File
) : BasicStringMap<Collection<String>>(storageFile, StringCollectionExternalizer) {
override fun dumpValue(value: Collection<String>): String = value.dumpCollection()
@Synchronized
fun add(key: FqName, value: FqName) {
storage.append(key.asString(), listOf(value.asString()))
}
operator fun get(key: FqName): Collection<FqName> =
storage[key.asString()]?.map(::FqName) ?: setOf()
storage[key.asString()]?.map(::FqName) ?: setOf()
@Synchronized
operator fun set(key: FqName, values: Collection<FqName>) {
if (values.isEmpty()) {
remove(key)
@@ -41,14 +41,10 @@ internal open class ClassOneToManyMap(storageFile: File) : BasicStringMap<Collec
storage[key.asString()] = values.map(FqName::asString)
}
@Synchronized
fun remove(key: FqName) {
storage.remove(key.asString())
}
// Access to caches could be done from multiple threads (e.g. JPS worker and RMI). The underlying collection is already synchronized,
// thus we need synchronization of this method and all modification methods.
@Synchronized
fun removeValues(key: FqName, removed: Set<FqName>) {
val notRemoved = this[key].filter { it !in removed }
this[key] = notRemoved

View File

@@ -25,7 +25,8 @@ internal class DirtyClassesJvmNameMap(storageFile: File) : AbstractDirtyClassesM
internal class DirtyClassesFqNameMap(storageFile: File) : AbstractDirtyClassesMap<FqName>(FqNameTransformer, storageFile)
internal abstract class AbstractDirtyClassesMap<Name>(
private val nameTransformer: NameTransformer<Name>, storageFile: File
private val nameTransformer: NameTransformer<Name>,
storageFile: File
) : BasicStringMap<Boolean>(storageFile, BooleanDataDescriptor.INSTANCE) {
fun markDirty(className: Name) {
storage[nameTransformer.asString(className)] = true
@@ -36,10 +37,10 @@ internal abstract class AbstractDirtyClassesMap<Name>(
}
fun getDirtyOutputClasses(): Collection<Name> =
storage.keys.map { nameTransformer.asName(it) }
storage.keys.map { nameTransformer.asName(it) }
fun isDirty(className: Name): Boolean =
storage.contains(nameTransformer.asString(className))
storage.contains(nameTransformer.asString(className))
override fun dumpValue(value: Boolean) = ""
}

View File

@@ -1,34 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.incremental.storage
import java.io.File
open class IncrementalFileToPathConverter(val rootProjectDir: File?) : FileToPathConverter {
//project root dir
private val projectDirPath = rootProjectDir?.normalize()?.absolutePath
override fun toPath(file: File): String {
val path = file.normalize().absolutePath
return when {
projectDirPath == null || !path.startsWith(projectDirPath) -> path
else -> PROJECT_DIR_PLACEHOLDER + path.substring(projectDirPath.length)
}
}
override fun toFile(path: String): File =
when {
rootProjectDir != null && path.startsWith(PROJECT_DIR_PLACEHOLDER) -> rootProjectDir.resolve(path.substring(PATH_PREFIX.length))
else -> File(path)
}
private companion object {
private const val PROJECT_DIR_PLACEHOLDER = "${'$'}PROJECT_DIR$"
//use only for prefix length because it OS dependent
private const val PATH_PREFIX = "$PROJECT_DIR_PLACEHOLDER/"
}
}

View File

@@ -17,11 +17,9 @@
package org.jetbrains.kotlin.incremental.storage
import com.intellij.util.io.DataExternalizer
import com.intellij.util.io.IOUtil
import com.intellij.util.io.KeyDescriptor
import com.intellij.util.io.PersistentHashMap
import com.intellij.util.io.JpsPersistentHashMap
import java.io.File
import java.io.IOException
class NonCachingLazyStorage<K, V>(
@@ -29,10 +27,11 @@ class NonCachingLazyStorage<K, V>(
private val keyDescriptor: KeyDescriptor<K>,
private val valueExternalizer: DataExternalizer<V>
) : LazyStorage<K, V> {
private var storage: PersistentHashMap<K, V>? = null
@Volatile
private var storage: JpsPersistentHashMap<K, V>? = null
@Synchronized
private fun getStorageIfExists(): PersistentHashMap<K, V>? {
private fun getStorageIfExists(): JpsPersistentHashMap<K, V>? {
if (storage != null) return storage
if (storageFile.exists()) {
@@ -44,7 +43,7 @@ class NonCachingLazyStorage<K, V>(
}
@Synchronized
private fun getStorageOrCreateNew(): PersistentHashMap<K, V> {
private fun getStorageOrCreateNew(): JpsPersistentHashMap<K, V> {
if (storage == null) {
storage = createMap()
}
@@ -70,19 +69,18 @@ class NonCachingLazyStorage<K, V>(
}
override fun append(key: K, value: V) {
getStorageOrCreateNew().appendData(key) { dataOutput -> valueExternalizer.save(dataOutput, value) }
getStorageOrCreateNew().appendDataWithoutCache(key, value)
}
@Synchronized
override fun clean() {
try {
storage?.close()
} finally {
storage = null
if (!IOUtil.deleteAllFilesStartingWith(storageFile)) {
throw IOException("Could not delete internal storage: ${storageFile.absolutePath}")
}
} catch (ignored: Throwable) {
}
JpsPersistentHashMap.deleteFilesStartingWith(storageFile)
storage = null
}
@Synchronized
@@ -103,6 +101,6 @@ class NonCachingLazyStorage<K, V>(
storage?.close()
}
private fun createMap(): PersistentHashMap<K, V> =
PersistentHashMap(storageFile, keyDescriptor, valueExternalizer)
private fun createMap(): JpsPersistentHashMap<K, V> =
JpsPersistentHashMap(storageFile, keyDescriptor, valueExternalizer)
}

View File

@@ -0,0 +1,106 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.incremental.storage
import com.intellij.util.io.DataExternalizer
import com.intellij.util.io.KeyDescriptor
import com.intellij.util.io.PersistentHashMap
import java.io.File
class NonCachingLazyStorage<K, V>(
private val storageFile: File,
private val keyDescriptor: KeyDescriptor<K>,
private val valueExternalizer: DataExternalizer<V>
) : LazyStorage<K, V> {
@Volatile
private var storage: PersistentHashMap<K, V>? = null
@Synchronized
private fun getStorageIfExists(): PersistentHashMap<K, V>? {
if (storage != null) return storage
if (storageFile.exists()) {
storage = createMap()
return storage
}
return null
}
@Synchronized
private fun getStorageOrCreateNew(): PersistentHashMap<K, V> {
if (storage == null) {
storage = createMap()
}
return storage!!
}
override val keys: Collection<K>
get() = getStorageIfExists()?.allKeysWithExistingMapping ?: listOf()
override operator fun contains(key: K): Boolean =
getStorageIfExists()?.containsMapping(key) ?: false
override operator fun get(key: K): V? =
getStorageIfExists()?.get(key)
override operator fun set(key: K, value: V) {
getStorageOrCreateNew().put(key, value)
}
override fun remove(key: K) {
getStorageIfExists()?.remove(key)
}
override fun append(key: K, value: V) {
getStorageOrCreateNew().appendData(key) { dataOutput -> valueExternalizer.save(dataOutput, value) }
}
@Synchronized
override fun clean() {
try {
storage?.close()
} catch (ignored: Throwable) {
}
PersistentHashMap.deleteFilesStartingWith(storageFile)
storage = null
}
@Synchronized
override fun flush(memoryCachesOnly: Boolean) {
val existingStorage = storage ?: return
if (memoryCachesOnly) {
if (existingStorage.isDirty) {
existingStorage.dropMemoryCaches()
}
} else {
existingStorage.force()
}
}
@Synchronized
override fun close() {
storage?.close()
}
private fun createMap(): PersistentHashMap<K, V> =
PersistentHashMap(storageFile, keyDescriptor, valueExternalizer)
}

View File

@@ -17,6 +17,7 @@
package org.jetbrains.kotlin.build
import junit.framework.TestCase
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
import org.junit.Assert.assertNotEquals
import org.junit.Test
@@ -33,7 +34,10 @@ class BuildMetaInfoTest : TestCase() {
"bytecodeVersionMinor",
"bytecodeVersionPatch",
"compilerBuildVersion",
"coroutinesEnable",
"coroutinesError",
"coroutinesVersion",
"coroutinesWarn",
"isEAP",
"languageVersionString",
"metadataVersionMajor",
@@ -67,12 +71,14 @@ class BuildMetaInfoTest : TestCase() {
@Test
fun testJvmEquals() {
val args1 = K2JVMCompilerArguments()
args1.coroutinesState = CommonCompilerArguments.ENABLE
val info1 = JvmBuildMetaInfo.create(args1)
val args2 = K2JVMCompilerArguments()
args2.coroutinesState = CommonCompilerArguments.WARN
val info2 = JvmBuildMetaInfo.create(args2)
assertEquals(info1, info2)
assertEquals(info1, info2.copy())
assertNotEquals(info1, info2)
assertEquals(info1, info2.copy(coroutinesEnable = true, coroutinesWarn = false))
}
}

View File

@@ -1,62 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.incremental.storage
import org.jetbrains.kotlin.TestWithWorkingDir
import org.junit.Test
import java.io.File
internal class IncrementalFileToPathConverterTest : TestWithWorkingDir() {
val separator: String = File.separator
@Test
fun testPathTransform() {
val relativeFilePath = "testFile.txt"
val transformedPath = testPathTransformation(workingDir.resolve("testDir"), relativeFilePath)
assertEquals("${'$'}PROJECT_DIR${'$'}$separator$relativeFilePath", transformedPath)
}
@Test
fun testComplicatedProjectRootPath() {
val relativeFilePath = "testFile.txt"
val transformedPath = testPathTransformation(workingDir.resolve("first$separator..${separator}testDir"), relativeFilePath)
assertEquals("${'$'}PROJECT_DIR${'$'}$separator$relativeFilePath", transformedPath)
}
@Test
fun testInccorectProjectRootPath() {
val relativeFilePath = "testFile.txt"
val transformedPath = testPathTransformation(workingDir.resolve("testDir$separator"), relativeFilePath)
assertEquals("${'$'}PROJECT_DIR${'$'}$separator$relativeFilePath", transformedPath)
}
@Test
fun testFileOutOfProject() {
val relativeFilePath = "..${separator}testFile.txt"
val transformedPath = testPathTransformation(workingDir.resolve("testDir"), relativeFilePath)
assertEquals("${workingDir.absolutePath}${separator}testFile.txt", transformedPath)
}
@Test
fun testFileWithExtraSlash() {
val relativeFilePath = "testFile.txt$separator"
val transformedPath = testPathTransformation(workingDir.resolve("testDir"), relativeFilePath)
assertEquals("${'$'}PROJECT_DIR${'$'}${separator}testFile.txt", transformedPath)
}
private fun testPathTransformation(projectRoot: File, relativeFilePath: String): String {
val pathConverter = IncrementalFileToPathConverter(projectRoot)
val testFile = projectRoot.resolve(relativeFilePath)
val transformedPath = pathConverter.toPath(testFile)
assertEquals(testFile.normalize().absolutePath, pathConverter.toFile(transformedPath).normalize().absolutePath)
return transformedPath
}
}

View File

@@ -22,12 +22,12 @@ data class BuildLogFinder(
private val isDataContainerBuildLogEnabled: Boolean = false,
private val isGradleEnabled: Boolean = false,
private val isJsEnabled: Boolean = false,
private val isScopeExpansionEnabled: Boolean = false,
private val isKlibEnabled: Boolean = false
private val isJsIrEnabled: Boolean = false, // TODO rename as it is used for metadata-only test
private val isScopeExpansionEnabled: Boolean = false
) {
companion object {
private const val JS_LOG = "js-build.log"
private const val KLIB_LOG = "klib-build.log"
private const val JS_IR_LOG = "js-ir-build.log"
private const val SCOPE_EXPANDING_LOG = "build-with-scope-expansion.log"
private const val GRADLE_LOG = "gradle-build.log"
private const val DATA_CONTAINER_LOG = "data-container-version-build.log"
@@ -43,7 +43,7 @@ data class BuildLogFinder(
val files = names.filter { File(dir, it).isFile }.toSet()
val matchedName = when {
isScopeExpansionEnabled && SCOPE_EXPANDING_LOG in files -> SCOPE_EXPANDING_LOG
isKlibEnabled && KLIB_LOG in files -> KLIB_LOG
isJsIrEnabled && JS_IR_LOG in files -> JS_IR_LOG
isJsEnabled && JS_LOG in files -> JS_LOG
isGradleEnabled && GRADLE_LOG in files -> GRADLE_LOG
isJsEnabled && JS_JPS_LOG in files -> JS_JPS_LOG

View File

@@ -151,35 +151,29 @@ private fun classFileToString(classFile: File): String {
val traceVisitor = TraceClassVisitor(PrintWriter(out))
ClassReader(classFile.readBytes()).accept(traceVisitor, 0)
val classHeader = LocalFileKotlinClass.create(classFile)?.classHeader ?: return ""
if (!classHeader.metadataVersion.isCompatible()) {
error("Incompatible class ($classHeader): $classFile")
}
val classHeader = LocalFileKotlinClass.create(classFile)?.classHeader
when (classHeader.kind) {
KotlinClassHeader.Kind.FILE_FACADE, KotlinClassHeader.Kind.CLASS, KotlinClassHeader.Kind.MULTIFILE_CLASS_PART -> {
ByteArrayInputStream(BitEncoding.decodeBytes(classHeader.data!!)).use { input ->
out.write("\n------ string table types proto -----\n${DebugJvmProtoBuf.StringTableTypes.parseDelimitedFrom(input)}")
val annotationDataEncoded = classHeader?.data
if (annotationDataEncoded != null) {
ByteArrayInputStream(BitEncoding.decodeBytes(annotationDataEncoded)).use {
input ->
when (classHeader.kind) {
KotlinClassHeader.Kind.FILE_FACADE ->
out.write("\n------ file facade proto -----\n${DebugProtoBuf.Package.parseFrom(input, getExtensionRegistry())}")
KotlinClassHeader.Kind.CLASS ->
out.write("\n------ class proto -----\n${DebugProtoBuf.Class.parseFrom(input, getExtensionRegistry())}")
KotlinClassHeader.Kind.MULTIFILE_CLASS_PART ->
out.write("\n------ multi-file part proto -----\n${DebugProtoBuf.Package.parseFrom(input, getExtensionRegistry())}")
else -> error(classHeader.kind)
}
out.write("\n------ string table types proto -----\n${DebugJvmProtoBuf.StringTableTypes.parseDelimitedFrom(input)}")
if (!classHeader.metadataVersion.isCompatible()) {
error("Incompatible class ($classHeader): $classFile")
}
when (classHeader.kind) {
KotlinClassHeader.Kind.FILE_FACADE ->
out.write("\n------ file facade proto -----\n${DebugProtoBuf.Package.parseFrom(input, getExtensionRegistry())}")
KotlinClassHeader.Kind.CLASS ->
out.write("\n------ class proto -----\n${DebugProtoBuf.Class.parseFrom(input, getExtensionRegistry())}")
KotlinClassHeader.Kind.MULTIFILE_CLASS_PART ->
out.write("\n------ multi-file part proto -----\n${DebugProtoBuf.Package.parseFrom(input, getExtensionRegistry())}")
else -> throw IllegalStateException()
}
}
KotlinClassHeader.Kind.MULTIFILE_CLASS -> {
out.write("\n------ multi-file facade data -----\n")
out.write(classHeader.data!!.joinToString("\n"))
}
KotlinClassHeader.Kind.SYNTHETIC_CLASS -> {
// Synthetic class has no metadata, thus there can be no differences in it.
}
KotlinClassHeader.Kind.UNKNOWN -> error("Should not meet unknown classes here: $classFile")
}
return out.toString()

View File

@@ -4656,8 +4656,7 @@ public final class DebugJvmProtoBuf {
* <code>extend .org.jetbrains.kotlin.metadata.Class { ... }</code>
*
* <pre>
* first bit: isFunctionBodyInInterface: 0 if actual body generated in DefaultImpl, 1 - otherwise (in interface default method)
* second bit: is all-compatibility mode or not, 1 - yes, 0 - no
* isFunctionBodyInInterface: 0 if actual body generated in DefaultImpl, 1 - otherwise (in interface default method)
* </pre>
*/
public static final

View File

@@ -7,7 +7,7 @@ import proguard.gradle.ProGuardTask
buildscript {
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
kotlinBootstrapFrom(BootstrapOption.SpaceBootstrap(kotlinBuildProperties.kotlinBootstrapVersion!!, cacheRedirectorEnabled))
kotlinBootstrapFrom(BootstrapOption.BintrayBootstrap(kotlinBuildProperties.kotlinBootstrapVersion!!, cacheRedirectorEnabled))
repositories {
bootstrapKotlinRepo?.let(::maven)
@@ -27,11 +27,10 @@ buildscript {
dependencies {
bootstrapCompilerClasspath(kotlin("compiler-embeddable", bootstrapKotlinVersion))
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.21")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.17")
classpath("com.gradle.publish:plugin-publish-plugin:0.11.0")
classpath(kotlin("gradle-plugin", bootstrapKotlinVersion))
classpath(kotlin("serialization", bootstrapKotlinVersion))
classpath("org.jetbrains.dokka:dokka-gradle-plugin:0.9.17")
classpath("org.jfrog.buildinfo:build-info-extractor-gradle:4.17.2")
}
}
@@ -74,7 +73,7 @@ val kotlinVersion by extra(
} ?: buildNumber
)
val kotlinLanguageVersion by extra("1.5")
val kotlinLanguageVersion by extra("1.4")
allprojects {
group = "org.jetbrains.kotlin"
@@ -154,7 +153,6 @@ rootProject.apply {
from(rootProject.file("gradle/jps.gradle.kts"))
from(rootProject.file("gradle/checkArtifacts.gradle.kts"))
from(rootProject.file("gradle/checkCacheability.gradle.kts"))
from(rootProject.file("gradle/retryPublishing.gradle.kts"))
}
IdeVersionConfigurator.setCurrentIde(project)
@@ -166,19 +164,21 @@ extra["versions.jansi"] = "1.16"
extra["versions.jline"] = "3.3.1"
extra["versions.junit"] = "4.12"
extra["versions.javaslang"] = "2.0.6"
extra["versions.ant"] = "1.10.7"
extra["versions.ant"] = "1.8.2"
extra["versions.android"] = "2.3.1"
extra["versions.kotlinx-coroutines-core"] = "1.3.8"
extra["versions.kotlinx-coroutines-jdk8"] = "1.3.8"
val coroutinesVersion = if (Platform[192].orHigher()) "1.3.7" else "1.1.1"
extra["versions.kotlinx-coroutines-core"] = coroutinesVersion
extra["versions.kotlinx-coroutines-jdk8"] = coroutinesVersion
extra["versions.json"] = "20160807"
extra["versions.native-platform"] = "0.14"
extra["versions.ant-launcher"] = "1.8.0"
extra["versions.robolectric"] = "4.0"
extra["versions.org.springframework"] = "4.2.0.RELEASE"
extra["versions.jflex"] = "1.7.0"
extra["versions.markdown"] = "0.1.25"
extra["versions.trove4j"] = "1.0.20181211"
extra["versions.completion-ranking-kotlin"] = "0.1.3"
extra["versions.r8"] = "2.1.75"
extra["versions.completion-ranking-kotlin"] = "0.1.2"
extra["versions.r8"] = "1.5.70"
val immutablesVersion = "0.3.1"
extra["versions.kotlinx-collections-immutable"] = immutablesVersion
extra["versions.kotlinx-collections-immutable-jvm"] = immutablesVersion
@@ -187,14 +187,12 @@ extra["versions.kotlinx-collections-immutable-jvm"] = immutablesVersion
extra["versions.ktor-network"] = "1.0.1"
if (!project.hasProperty("versions.kotlin-native")) {
extra["versions.kotlin-native"] = "1.5-rc1-41"
extra["versions.kotlin-native"] = "1.4.10"
}
val intellijUltimateEnabled by extra(project.kotlinBuildProperties.intellijUltimateEnabled)
val effectSystemEnabled by extra(project.getBooleanProperty("kotlin.compiler.effectSystemEnabled") ?: false)
val newInferenceEnabled by extra(project.getBooleanProperty("kotlin.compiler.newInferenceEnabled") ?: false)
val useJvmIrBackend by extra(project.kotlinBuildProperties.useIR)
val useJvmFir by extra(project.kotlinBuildProperties.useFir)
val intellijSeparateSdks = project.getBooleanProperty("intellijSeparateSdks") ?: false
@@ -204,7 +202,8 @@ extra["IntellijCoreDependencies"] =
listOf(
when {
Platform[202].orHigher() -> "asm-all-8.0.1"
else -> "asm-all-7.0.1"
Platform[191].orHigher() -> "asm-all-7.0.1"
else -> "asm-all"
},
"guava",
"jdom",
@@ -222,8 +221,6 @@ extra["compilerModules"] = arrayOf(
":compiler:config",
":compiler:config.jvm",
":compiler:container",
":compiler:resolution.common",
":compiler:resolution.common.jvm",
":compiler:resolution",
":compiler:serialization",
":compiler:psi",
@@ -232,8 +229,6 @@ extra["compilerModules"] = arrayOf(
":compiler:frontend.java",
":compiler:cli-common",
":compiler:ir.tree",
":compiler:ir.tree.impl",
":compiler:ir.tree.persistent",
":compiler:ir.psi2ir",
":compiler:ir.backend.common",
":compiler:backend.jvm",
@@ -242,7 +237,6 @@ extra["compilerModules"] = arrayOf(
":compiler:ir.serialization.common",
":compiler:ir.serialization.js",
":compiler:ir.serialization.jvm",
":compiler:ir.interpreter",
":kotlin-util-io",
":kotlin-util-klib",
":kotlin-util-klib-metadata",
@@ -268,22 +262,17 @@ extra["compilerModules"] = arrayOf(
":kotlin-build-common",
":core:metadata",
":core:metadata.jvm",
":core:deserialization.common",
":core:deserialization.common.jvm",
":core:compiler.common",
":core:compiler.common.jvm",
":compiler:backend.common.jvm",
":core:descriptors",
":core:descriptors.jvm",
":core:descriptors.runtime",
":core:deserialization",
":core:util.runtime",
":core:type-system",
":compiler:fir:cones",
":compiler:fir:resolve",
":compiler:fir:fir-serialization",
":compiler:fir:fir-deserialization",
":compiler:fir:tree",
":compiler:fir:raw-fir:raw-fir.common",
":compiler:fir:raw-fir:fir-common",
":compiler:fir:raw-fir:psi2fir",
":compiler:fir:raw-fir:light-tree2fir",
":compiler:fir:fir2ir",
@@ -291,13 +280,11 @@ extra["compilerModules"] = arrayOf(
":compiler:fir:java",
":compiler:fir:jvm",
":compiler:fir:checkers",
":compiler:fir:entrypoint",
":compiler:fir:analysis-tests",
":compiler:fir:analysis-tests:legacy-fir-tests",
":wasm:wasm.ir"
":compiler:fir:analysis-tests"
)
extra["compilerModulesForJps"] = listOf(
":core:type-system",
":kotlin-build-common",
":kotlin-util-io",
":kotlin-util-klib",
@@ -306,8 +293,6 @@ extra["compilerModulesForJps"] = listOf(
":kotlin-compiler-runner",
":daemon-common",
":daemon-common-new",
":core:compiler.common",
":core:compiler.common.jvm",
":core:descriptors",
":core:descriptors.jvm",
":idea:idea-jps-common",
@@ -320,32 +305,13 @@ extra["compilerModulesForJps"] = listOf(
":compiler:compiler.version"
)
// TODO: fix remaining warnings and remove this property.
extra["tasksWithWarnings"] = listOf(
":kotlin-stdlib:compileTestKotlin",
":kotlin-stdlib-jdk7:compileTestKotlin",
":kotlin-stdlib-jdk8:compileTestKotlin",
":compiler:cli:compileKotlin",
":compiler:frontend:compileKotlin",
":compiler:fir:tree:compileKotlin",
":compiler:fir:resolve:compileKotlin",
":compiler:fir:checkers:compileKotlin",
":compiler:fir:java:compileKotlin",
":kotlin-scripting-compiler:compileKotlin",
":plugins:uast-kotlin:compileKotlin",
":plugins:uast-kotlin:compileTestKotlin",
":plugins:uast-kotlin-idea:compileKotlin"
)
val tasksWithWarnings: List<String> by extra
val coreLibProjects = listOfNotNull(
":kotlin-stdlib",
":kotlin-stdlib-common",
":kotlin-stdlib-js",
":kotlin-stdlib-js-ir",
":kotlin-stdlib-jdk7",
":kotlin-stdlib-jdk8",
":kotlin-test",
":kotlin-test:kotlin-test-annotations-common",
":kotlin-test:kotlin-test-common",
":kotlin-test:kotlin-test-jvm",
@@ -353,17 +319,22 @@ val coreLibProjects = listOfNotNull(
":kotlin-test:kotlin-test-junit5",
":kotlin-test:kotlin-test-testng",
":kotlin-test:kotlin-test-js".takeIf { !kotlinBuildProperties.isInJpsBuildIdeaSync },
":kotlin-reflect"
":kotlin-test:kotlin-test-js-ir".takeIf { !kotlinBuildProperties.isInJpsBuildIdeaSync },
":kotlin-reflect",
":kotlin-coroutines-experimental-compat"
)
val gradlePluginProjects = listOf(
":kotlin-gradle-plugin",
":kotlin-gradle-plugin:plugin-marker",
":kotlin-gradle-plugin-api",
// ":kotlin-gradle-plugin-integration-tests", // TODO: build fails
":kotlin-allopen",
":kotlin-allopen:plugin-marker",
":kotlin-annotation-processing-gradle",
":kotlin-noarg",
":kotlin-sam-with-receiver",
":kotlin-parcelize-compiler"
":kotlin-noarg:plugin-marker",
":kotlin-sam-with-receiver"
)
apply {
@@ -387,28 +358,12 @@ fun Task.listConfigurationContents(configName: String) {
}
val defaultJvmTarget = "1.8"
val defaultJavaHome = jdkPath(if (Platform[203].orHigher()) "11" else defaultJvmTarget)
val defaultJavaHome = jdkPath(defaultJvmTarget)
val ignoreTestFailures by extra(project.kotlinBuildProperties.ignoreTestFailures)
allprojects {
configurations.maybeCreate("embedded").apply {
isCanBeConsumed = false
isCanBeResolved = true
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME))
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements.JAR))
}
}
configurations.maybeCreate("embeddedElements").apply {
extendsFrom(configurations["embedded"])
isCanBeConsumed = true
isCanBeResolved = false
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named("embedded-java-runtime"))
}
}
configurations.maybeCreate("embedded")
jvmTarget = defaultJvmTarget
javaHome = defaultJavaHome
@@ -424,19 +379,15 @@ allprojects {
repositories {
kotlinBuildLocalRepo(project)
mirrorRepo?.let(::maven)
internalBootstrapRepo?.let(::maven)
bootstrapKotlinRepo?.let(::maven)
maven(protobufRepo)
maven(intellijRepo)
mavenCentral()
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
maven("https://dl.google.com/dl/android/maven2")
maven("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies")
jcenter()
maven(protobufRepo)
maven(intellijRepo)
maven("https://dl.bintray.com/kotlin/ktor")
maven("https://kotlin.bintray.com/kotlin-dependencies")
maven("https://jetbrains.bintray.com/intellij-third-party-dependencies")
maven("https://dl.google.com/dl/android/maven2")
bootstrapKotlinRepo?.let(::maven)
internalBootstrapRepo?.let(::maven)
}
configureJvmProject(javaHome!!, jvmTarget!!)
@@ -444,6 +395,9 @@ allprojects {
val commonCompilerArgs = listOfNotNull(
"-Xopt-in=kotlin.RequiresOptIn",
"-Xread-deserialized-contracts",
"-Xjvm-default=compatibility",
"-Xno-optimized-callable-references",
"-Xno-kotlin-nothing-value-exception",
"-progressive".takeIf { hasProperty("test.progressive.mode") }
)
@@ -455,40 +409,9 @@ allprojects {
}
}
val jvmCompilerArgs = listOf(
"-Xjvm-default=compatibility",
"-Xno-optimized-callable-references",
"-Xno-kotlin-nothing-value-exception",
"-Xnormalize-constructor-calls=enable"
)
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile> {
kotlinOptions {
freeCompilerArgs = commonCompilerArgs + jvmCompilerArgs
if (useJvmIrBackend) {
useIR = true
}
if (useJvmFir) {
freeCompilerArgs += "-Xuse-fir"
freeCompilerArgs += "-Xabi-stability=stable"
}
}
}
if (!kotlinBuildProperties.isInJpsBuildIdeaSync && !kotlinBuildProperties.useFir && !kotlinBuildProperties.disableWerror) {
// For compiler and stdlib, allWarningsAsErrors is configured in the corresponding "root" projects
// (compiler/build.gradle.kts and libraries/commonConfiguration.gradle).
val projectsWithWarningsAsErrors = listOf("core", "plugins").map { File(it).absoluteFile }
if (projectsWithWarningsAsErrors.any(projectDir::startsWith)) {
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile> {
if (path !in tasksWithWarnings) {
kotlinOptions {
allWarningsAsErrors = true
}
}
}
freeCompilerArgs = commonCompilerArgs + listOf("-Xnormalize-constructor-calls=enable")
}
}
@@ -510,7 +433,7 @@ allprojects {
}
tasks.withType<Test> {
outputs.doNotCacheIf("https://youtrack.jetbrains.com/issue/KTI-112") { true }
outputs.doNotCacheIf("https://youtrack.jetbrains.com/issue/KT-37089") { true }
}
normalization {
@@ -518,7 +441,6 @@ allprojects {
ignore("META-INF/MANIFEST.MF")
ignore("META-INF/compiler.version")
ignore("META-INF/plugin.xml")
ignore("kotlin/KotlinVersionCurrentValue.class")
}
}
@@ -568,23 +490,6 @@ allprojects {
}
apply(from = "$rootDir/gradle/cacheRedirector.gradle.kts")
apply(from = "$rootDir/gradle/testRetry.gradle.kts")
}
}
gradle.buildFinished {
val taskGraph = gradle?.taskGraph
if (taskGraph != null) {
taskGraph.allTasks
.filterIsInstance<SourceTask>()
.filter { it.didWork }
.forEach {
it.source.visit {
if (file.isDirectory && file.listFiles()?.isEmpty() == true) {
logger.warn("Empty source directories may cause build cache misses: " + file.absolutePath)
}
}
}
}
}
@@ -592,13 +497,9 @@ gradle.taskGraph.whenReady {
fun Boolean.toOnOff(): String = if (this) "on" else "off"
val profile = if (isTeamcityBuild) "CI" else "Local"
val proguardMessage = "proguard is ${kotlinBuildProperties.proguard.toOnOff()}"
val jarCompressionMessage = "jar compression is ${kotlinBuildProperties.jarCompression.toOnOff()}"
logger.warn(
"$profile build profile is active ($proguardMessage, $jarCompressionMessage). " +
"Use -Pteamcity=<true|false> to reproduce CI/local build"
)
logger.warn("$profile build profile is active (proguard is ${kotlinBuildProperties.proguard.toOnOff()}" +
", jar compression is ${kotlinBuildProperties.jarCompression.toOnOff()})." +
" Use -Pteamcity=<true|false> to reproduce CI/local build")
allTasks.filterIsInstance<org.gradle.jvm.tasks.Jar>().forEach { task ->
task.entryCompression = if (kotlinBuildProperties.jarCompression)
@@ -612,10 +513,6 @@ val dist = tasks.register("dist") {
dependsOn(":kotlin-compiler:dist")
}
val syncMutedTests = tasks.register("syncMutedTests") {
dependsOn(":compiler:tests-mutes:tc-integration:run")
}
val copyCompilerToIdeaPlugin by task<Copy> {
dependsOn(dist)
into(ideaPluginDir)
@@ -641,20 +538,15 @@ tasks {
}
}
listOf("clean", "assemble", "install").forEach { taskName ->
listOf("clean", "assemble", "install", "dist").forEach { taskName ->
register("coreLibs${taskName.capitalize()}") {
for (projectName in coreLibProjects) {
if (projectName.startsWith(":kotlin-test:") && taskName == "install") continue
dependsOn("$projectName:$taskName")
}
coreLibProjects.forEach { projectName -> dependsOn("$projectName:$taskName") }
}
}
register("coreLibsTest") {
(coreLibProjects + listOf(
":kotlin-stdlib:samples",
":kotlin-stdlib-js-ir",
":kotlin-test:kotlin-test-js-ir".takeIf { !kotlinBuildProperties.isInJpsBuildIdeaSync },
":kotlin-test:kotlin-test-js:kotlin-test-js-it".takeIf { !kotlinBuildProperties.isInJpsBuildIdeaSync },
":kotlinx-metadata-jvm",
":tools:binary-compatibility-validator"
@@ -677,7 +569,6 @@ tasks {
dependsOn("dist")
dependsOn(
":compiler:test",
":compiler:tests-common-new:test",
":compiler:container:test",
":compiler:tests-java8:test",
":compiler:tests-spec:test",
@@ -699,11 +590,8 @@ tasks {
}
register("wasmCompilerTest") {
dependsOn(":js:js.tests:wasmTest")
// Windows WABT release requires Visual C++ Redistributable
if (!kotlinBuildProperties.isTeamcityBuild || !org.gradle.internal.os.OperatingSystem.current().isWindows) {
dependsOn(":wasm:wasm.ir:test")
}
// TODO: fix once
// dependsOn(":js:js.tests:wasmTest")
}
register("nativeCompilerTest") {
@@ -714,7 +602,6 @@ tasks {
dependsOn(":compiler:fir:raw-fir:psi2fir:test")
dependsOn(":compiler:fir:raw-fir:light-tree2fir:test")
dependsOn(":compiler:fir:analysis-tests:test")
dependsOn(":compiler:fir:analysis-tests:legacy-fir-tests:test")
dependsOn(":compiler:fir:fir2ir:test")
}
@@ -724,8 +611,8 @@ tasks {
":compiler:fir:raw-fir:psi2fir:test",
":compiler:fir:raw-fir:light-tree2fir:test",
":compiler:fir:analysis-tests:test",
":compiler:fir:analysis-tests:legacy-fir-tests:test",
":compiler:fir:fir2ir:test",
":idea:idea-fir:test",
":plugins:fir:fir-plugin-prototype:test"
)
}
@@ -737,12 +624,10 @@ tasks {
register("scriptingTest") {
dependsOn("dist")
dependsOn(":kotlin-script-util:test")
dependsOn(":kotlin-scripting-compiler:test")
dependsOn(":kotlin-scripting-compiler:testWithIr")
dependsOn(":kotlin-scripting-compiler-embeddable:test")
dependsOn(":kotlin-scripting-common:test")
dependsOn(":kotlin-scripting-jvm:test")
dependsOn(":kotlin-scripting-jvm-host-test:test")
dependsOn(":kotlin-scripting-jvm-host-test:testWithIr")
dependsOn(":kotlin-scripting-dependencies:test")
dependsOn(":kotlin-scripting-dependencies-maven:test")
dependsOn(":kotlin-scripting-jsr223-test:test")
@@ -750,9 +635,7 @@ tasks {
// dependsOn(":kotlin-scripting-jvm-host-test:embeddableTest")
dependsOn(":kotlin-scripting-jsr223-test:embeddableTest")
dependsOn(":kotlin-main-kts-test:test")
dependsOn(":kotlin-main-kts-test:testWithIr")
dependsOn(":kotlin-scripting-ide-services-test:test")
dependsOn(":kotlin-scripting-ide-services-test:embeddableTest")
dependsOn(":kotlin-scripting-js-test:test")
}
@@ -763,18 +646,17 @@ tasks {
}
register("miscCompilerTest") {
dependsOn("wasmCompilerTest")
dependsOn("nativeCompilerTest")
dependsOn("firCompilerTest")
dependsOn(":kotlin-daemon-tests:test")
dependsOn("scriptingTest")
dependsOn(":kotlin-build-common:test")
dependsOn(":compiler:incremental-compilation-impl:test")
dependsOn(":compiler:incremental-compilation-impl:testJvmICWithJdk11")
dependsOn(":core:descriptors.runtime:test")
dependsOn("jvmCompilerIntegrationTest")
dependsOn(":plugins:parcelize:parcelize-compiler:test")
}
register("toolsTest") {
@@ -810,9 +692,16 @@ tasks {
dependsOn(":jps-plugin:test")
}
register("idea-plugin-main-tests") {
dependsOn("dist")
dependsOn(":idea:test")
}
register("idea-plugin-additional-tests") {
dependsOn("dist")
dependsOn(
":idea:idea-gradle:test",
":idea:idea-gradle-native:test",
":idea:idea-maven:test",
":j2k:test",
":nj2k:test",
@@ -820,12 +709,14 @@ tasks {
":idea:jvm-debugger:jvm-debugger-evaluation:test",
":idea:jvm-debugger:jvm-debugger-sequence:test",
":idea:jvm-debugger:eval4j:test",
":idea:scripting-support:test"
":idea:scripting-support:test",
":idea:idea-fir:test"
)
}
if (Ide.IJ()) {
register("idea-new-project-wizard-tests") {
dependsOn("dist")
dependsOn(
":libraries:tools:new-project-wizard:test",
":libraries:tools:new-project-wizard:new-project-wizard-cli:test",
@@ -834,57 +725,37 @@ tasks {
}
}
register("idea-plugin-tests") {
dependsOn("dist")
dependsOn(
"idea-plugin-main-tests",
"idea-plugin-additional-tests"
)
if (Ide.IJ()) {
dependsOn("idea-new-project-wizard-tests")
}
}
register("idea-plugin-performance-tests") {
dependsOn(
"dist",
":idea:performanceTests:performanceTest",
":idea:performanceTests:aggregateResults"
)
}
register("idea-fir-plugin-performance-tests") {
dependsOn("dist")
dependsOn(
":idea:idea-fir-performance-tests:ideaFirPerformanceTest"
":idea:performanceTests:performanceTest"
)
}
register("idea-fir-plugin-tests") {
dependsOn("dist")
dependsOn(
":idea:idea-fir:test",
":idea:idea-frontend-api:test",
":idea:idea-frontend-fir:test",
":idea:idea-frontend-fir:idea-fir-low-level-api:test"
)
}
register("android-ide-tests") {
dependsOn("dist")
dependsOn(
":plugins:android-extensions-ide:test",
":idea:idea-android:test",
":kotlin-annotation-processing:test"
)
}
register("plugins-tests") {
dependsOn("dist")
dependsOn(
":kotlin-annotation-processing:test",
":plugins:parcelize:parcelize-ide:test"
)
}
register("ideaPluginTest") {
dependsOn(
"mainIdeTests",
"gradleIdeTest",
"kaptIdeTest",
"miscIdeTests"
)
}
register("mainIdeTests") {
dependsOn(":idea:test")
}
register("miscIdeTests") {
dependsOn(
":kotlin-allopen-compiler-plugin:test",
":kotlin-noarg-compiler-plugin:test",
":kotlin-sam-with-receiver-compiler-plugin:test",
@@ -892,55 +763,52 @@ tasks {
":kotlin-annotation-processing-gradle:test",
":kotlinx-serialization-compiler-plugin:test",
":kotlinx-serialization-ide-plugin:test",
":idea:jvm-debugger:jvm-debugger-test:test",
"idea-plugin-additional-tests",
":idea:jvm-debugger:jvm-debugger-test:test"
)
}
register("ideaPluginTest") {
dependsOn(
"idea-plugin-tests",
"jps-tests",
"plugins-tests",
"android-ide-tests",
":generators:test"
)
if (Ide.IJ()) {
}
register("publishIdeArtifacts") {
idePluginDependency {
dependsOn(
":libraries:tools:new-project-wizard:test",
":libraries:tools:new-project-wizard:new-project-wizard-cli:test",
":idea:idea-new-project-wizard:test" // Temporary here. Remove after enabling builds for ideaIntegrationsTests
":prepare:ide-plugin-dependencies:android-extensions-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:allopen-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:allopen-compiler-plugin-tests-for-ide:publish",
":prepare:ide-plugin-dependencies:incremental-compilation-impl-tests-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlin-build-common-tests-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlin-compiler-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlin-dist-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlin-gradle-statistics-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlinx-serialization-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:noarg-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:sam-with-receiver-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:compiler-components-for-jps:publish",
":kotlin-script-runtime:publish",
":kotlin-script-util:publish",
":kotlin-scripting-common:publish",
":kotlin-scripting-jvm:publish",
":kotlin-scripting-compiler:publish",
":kotlin-scripting-compiler-impl:publish",
":kotlin-android-extensions-runtime:publish",
":kotlin-stdlib-common:publish",
":kotlin-stdlib:publish",
":kotlin-stdlib-jdk7:publish",
":kotlin-stdlib-jdk8:publish",
":kotlin-reflect:publish"
)
}
}
register("ideaIntegrationsTests") {
if (Ide.IJ()) {
dependsOn(":idea:idea-new-project-wizard:test")
}
}
register("kaptIdeTest") {
dependsOn(":kotlin-annotation-processing:test")
dependsOn(":kotlin-annotation-processing-base:test")
dependsOn(":kotlin-annotation-processing-cli:test")
}
register("gradleIdeTest") {
dependsOn(
":idea:idea-gradle:test",
":idea:idea-gradle-native:test"
)
}
register("kmmTest", AggregateTest::class) {
dependsOn(
":idea:idea-gradle:test",
":idea:test",
":compiler:test",
":compiler:container:test",
":js:js.tests:test"
)
dependsOn(":kotlin-gradle-plugin-integration-tests:test")
if (Ide.AS40.orHigher())
dependsOn(":kotlin-ultimate:ide:android-studio-native:test")
testPatternFile = file("tests/mpp/kmm-patterns.csv")
}
register("test") {
doLast {
throw GradleException("Don't use directly, use aggregate tasks *-check instead")
@@ -958,37 +826,6 @@ tasks {
}
}
}
register("publishIdeArtifacts") {
idePluginDependency {
dependsOn(
":prepare:ide-plugin-dependencies:android-extensions-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:allopen-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:incremental-compilation-impl-tests-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlin-build-common-tests-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlin-compiler-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlin-gradle-statistics-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlinx-serialization-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:noarg-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:sam-with-receiver-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:compiler-components-for-jps:publish",
":prepare:ide-plugin-dependencies:parcelize-compiler-plugin-for-ide:publish",
":kotlin-script-runtime:publish",
":kotlin-script-util:publish",
":kotlin-scripting-common:publish",
":kotlin-scripting-jvm:publish",
":kotlin-scripting-compiler:publish",
":kotlin-scripting-compiler-impl:publish",
":kotlin-android-extensions-runtime:publish",
":kotlin-stdlib-common:publish",
":kotlin-stdlib:publish",
":kotlin-stdlib-jdk7:publish",
":kotlin-stdlib-jdk8:publish",
":kotlin-reflect:publish",
":kotlin-main-kts:publish"
)
}
}
}
fun CopySpec.setExecutablePermissions() {
@@ -1052,7 +889,7 @@ val zipPlugin by task<Zip> {
setExecutablePermissions()
doLast {
logger.lifecycle("Plugin artifacts packed to ${archiveFile.get()}")
logger.lifecycle("Plugin artifacts packed to $archiveFile")
}
}
@@ -1210,15 +1047,3 @@ val Jar.outputFile: File
val Project.sourceSetsOrNull: SourceSetContainer?
get() = convention.findPlugin(JavaPluginConvention::class.java)?.sourceSets
val disableVerificationTasks = System.getProperty("disable.verification.tasks") == "true"
if (disableVerificationTasks) {
gradle.taskGraph.whenReady {
allTasks.forEach {
if (it is VerificationTask) {
logger.info("DISABLED: '$it'")
it.enabled = false
}
}
}
}

View File

@@ -1,5 +1,3 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
extra["versions.native-platform"] = "0.14"
buildscript {
@@ -7,15 +5,15 @@ buildscript {
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
extra["defaultSnapshotVersion"] = kotlinBuildProperties.defaultSnapshotVersion
kotlinBootstrapFrom(BootstrapOption.SpaceBootstrap(kotlinBuildProperties.kotlinBootstrapVersion!!, cacheRedirectorEnabled))
kotlinBootstrapFrom(BootstrapOption.BintrayBootstrap(kotlinBuildProperties.kotlinBootstrapVersion!!, cacheRedirectorEnabled))
repositories {
if (cacheRedirectorEnabled) {
maven("https://cache-redirector.jetbrains.com/jcenter.bintray.com")
maven("https://cache-redirector.jetbrains.com/maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
maven("https://cache-redirector.jetbrains.com/kotlin.bintray.com/kotlin-dependencies")
} else {
jcenter()
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
maven("https://kotlin.bintray.com/kotlin-dependencies")
}
project.bootstrapKotlinRepo?.let {
@@ -24,7 +22,7 @@ buildscript {
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.21")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.17")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.bootstrapKotlinVersion}")
classpath("org.jetbrains.kotlin:kotlin-sam-with-receiver:${project.bootstrapKotlinVersion}")
}
@@ -87,8 +85,8 @@ extra["customDepsOrg"] = "kotlin.build"
repositories {
jcenter()
maven("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies")
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
maven("https://jetbrains.bintray.com/intellij-third-party-dependencies/")
maven("https://kotlin.bintray.com/kotlin-dependencies")
gradlePluginPortal()
extra["bootstrapKotlinRepo"]?.let {
@@ -98,9 +96,7 @@ repositories {
dependencies {
implementation(kotlin("stdlib", embeddedKotlinVersion))
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.bootstrapKotlinVersion}")
implementation("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.21")
implementation("com.gradle.publish:plugin-publish-plugin:0.12.0")
implementation("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.17")
implementation("net.rubygrapefruit:native-platform:${property("versions.native-platform")}")
implementation("net.rubygrapefruit:native-platform-windows-amd64:${property("versions.native-platform")}")
@@ -112,9 +108,6 @@ dependencies {
implementation("org.jetbrains.intellij.deps:asm-all:8.0.1")
implementation("gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext:0.5")
implementation("org.gradle:test-retry-gradle-plugin:1.1.9")
implementation("com.gradle.enterprise:test-distribution-gradle-plugin:1.2.1")
}
samWithReceiver {
@@ -129,11 +122,6 @@ java {
targetCompatibility = JavaVersion.VERSION_1_8
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions.freeCompilerArgs +=
listOf("-Xopt-in=kotlin.RequiresOptIn", "-Xskip-runtime-version-check")
}
tasks["build"].dependsOn(":prepare-deps:build")
allprojects {

View File

@@ -1,16 +1,17 @@
@file:Suppress("PropertyName", "HasPlatformType", "UnstableApiUsage")
import org.gradle.internal.os.OperatingSystem
import org.jetbrains.kotlin.gradle.tasks.internal.CleanableStore
import java.io.Closeable
import java.io.OutputStreamWriter
import java.net.URI
import java.text.SimpleDateFormat
import java.time.Duration
import java.time.Instant
import java.util.*
import javax.xml.stream.XMLOutputFactory
import org.jetbrains.kotlin.gradle.tasks.internal.CleanableStore
import java.time.Duration
import java.time.Instant
plugins {
base
}
@@ -65,11 +66,28 @@ repositories {
artifact()
}
}
ivy {
url = URI("https://dl.bintray.com/kotlin/as/")
patternLayout {
artifact("[artifact]-[revision]-$androidStudioOs.[ext]")
}
credentials {
username = System.getenv("AS_BINTRAY_USER_NAME") ?: findProperty("bintray.user") as String?
password = System.getenv("AS_BINTRAY_API_KEY") ?: findProperty("bintray.apikey") as String?
}
metadataSources {
artifact()
}
}
}
maven("https://www.jetbrains.com/intellij-repository/$intellijReleaseType")
maven("https://plugins.jetbrains.com/maven")
maven("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies")
maven("https://jetbrains.bintray.com/intellij-third-party-dependencies/")
}
val intellij by configurations.creating
@@ -162,7 +180,6 @@ val mergeSources by tasks.creating(Jar::class.java) {
dependsOn(sources)
isPreserveFileTimestamps = false
isReproducibleFileOrder = true
isZip64 = true
if (!kotlinBuildProperties.isTeamcityBuild) {
from(provider { sources.map(::zipTree) })
}
@@ -238,8 +255,9 @@ fun buildIvyRepositoryTask(
inputs.files(configuration)
outputs.upToDateWhen {
val repoMarker = configuration.resolvedConfiguration.resolvedArtifacts.single().moduleDirectory().resolve(".marker")
repoMarker.exists()
configuration.resolvedConfiguration.resolvedArtifacts.single()
.moduleDirectory()
.exists()
}
doFirst {
@@ -248,9 +266,8 @@ fun buildIvyRepositoryTask(
artifact.storeDirectory().cleanStore()
val repoMarker = File(moduleDirectory, ".marker")
if (repoMarker.exists()) {
logger.info("Path ${repoMarker.absolutePath} already exists, skipping unpacking.")
if (moduleDirectory.exists()) {
logger.info("Path ${moduleDirectory.absolutePath} already exists, skipping unpacking.")
return@doFirst
}
@@ -309,8 +326,6 @@ fun buildIvyRepositoryTask(
)
}
}
repoMarker.createNewFile()
}
}
}

View File

@@ -14,13 +14,13 @@ pluginManagement {
buildscript {
repositories {
if (cacheRedirectorEnabled == 'true') {
maven { url "https://cache-redirector.jetbrains.com/maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies" }
maven { url "https://cache-redirector.jetbrains.com/kotlin.bintray.com/kotlin-dependencies" }
} else {
maven { url "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies" }
maven { url "https://kotlin.bintray.com/kotlin-dependencies" }
}
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.21")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.17")
}
}
@@ -46,12 +46,12 @@ if (target_AppCode_Clion) {
} else if (target_AndroidStudio) {
logger.info("Including modules for AS (mobile plugin) in buildSrc/settings.gradle")
include ":prepare-deps:appcode-binaries"
include ":prepare-deps:cocoa-common-binaries"
include ":prepare-deps:lldb-framework"
include ":prepare-deps:lldb-frontend"
project(":prepare-deps:appcode-binaries").projectDir =
file("${buildProperties.propertiesProvider.rootProjectDir}/kotlin-ultimate/buildSrc/prepare-deps/appcode-binaries")
project(":prepare-deps:cocoa-common-binaries").projectDir =
file("${buildProperties.propertiesProvider.rootProjectDir}/kotlin-ultimate/buildSrc/prepare-deps/cocoa-common-binaries")
project(":prepare-deps:lldb-framework").projectDir =
file("${buildProperties.propertiesProvider.rootProjectDir}/kotlin-ultimate/buildSrc/prepare-deps/lldb-framework")
project(":prepare-deps:lldb-frontend").projectDir =
@@ -69,4 +69,4 @@ if (target_AppCode_Clion) {
} else {
logger.info("Not including extra modules in buildSrc/settings.gradle")
}
}

View File

@@ -1,72 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
import org.gradle.api.GradleException
import org.gradle.api.tasks.*
import org.gradle.api.tasks.testing.Test
import java.io.File
// You can see "How To" via link: https://jetbrains.quip.com/xQ2WAUy9bZmy/How-to-use-AggregateTest-task
open class AggregateTest : Test() { // Inherit from Test to see test results in IDEA Test viewer
private var patterns: MutableMap<String, MutableList<String>> = mutableMapOf()
@InputFile
lateinit var testPatternFile: File
init {
// Set empty FileCollection to avoid NPE when initializing a base 'Test' class
classpath = project.objects.fileCollection()
testClassesDirs = project.objects.fileCollection()
project.gradle.taskGraph.whenReady {
if (allTasks.filterIsInstance<AggregateTest>().isNotEmpty()) {
initPatterns()
allTasks.filterIsInstance<Test>().forEach { testTask -> subTaskConfigure(testTask) }
if (!project.gradle.startParameter.taskNames.all { project.tasks.findByPath(it) is AggregateTest }) {
logger.warn("Please, don't use AggregateTest and non-AggregateTest test tasks together. You can get incorrect results.")
}
}
}
}
private fun initPatterns() {
if (!testPatternFile.exists())
throw GradleException("File with test patterns is not found")
testPatternFile
.readLines()
.asSequence()
.filter { it.isNotEmpty() }
.forEach { line ->
// patternType is exclude or include value
val (pattern, patternType) = line.split(',').map { it.trim() }
patterns.getOrPut(patternType) { mutableListOf() }.add(pattern)
}
}
private fun subTaskConfigure(testTask: Test) {
testTask.outputs.upToDateWhen { false }
testTask.ignoreFailures = true
testTask.filter {
isFailOnNoMatchingTests = false
patterns["include"]?.let {
it.forEach { pattern ->
includeTestsMatching(pattern)
}
}
patterns["exclude"]?.let {
it.forEach { pattern ->
excludeTestsMatching(pattern)
}
}
}
}
@Override
@TaskAction
override fun executeTests() {
// Do nothing
}
}

View File

@@ -18,5 +18,3 @@ val KotlinBuildProperties.proguard: Boolean get() = postProcessing && getBoolean
val KotlinBuildProperties.jarCompression: Boolean get() = getBoolean("kotlin.build.jar.compression", isTeamcityBuild)
val KotlinBuildProperties.ignoreTestFailures: Boolean get() = getBoolean("ignoreTestFailures", isTeamcityBuild)
val KotlinBuildProperties.disableWerror: Boolean get() = getBoolean("kotlin.build.disable.werror", isTeamcityBuild)

View File

@@ -54,12 +54,11 @@ var Project.javaHome: String?
extra["javaHome"] = v
}
fun Project.generator(fqName: String, sourceSet: SourceSet? = null, configure: JavaExec.() -> Unit = {}) = smartJavaExec {
fun Project.generator(fqName: String, sourceSet: SourceSet? = null) = smartJavaExec {
classpath = (sourceSet ?: testSourceSet).runtimeClasspath
mainClass.set(fqName)
main = fqName
workingDir = rootDir
systemProperty("line.separator", "\n")
configure()
}
fun Project.getBooleanProperty(name: String): Boolean? = this.findProperty(name)?.let {

View File

@@ -26,7 +26,7 @@ fun CompatibilityPredicate.or(other: CompatibilityPredicate): CompatibilityPredi
}
enum class Platform : CompatibilityPredicate {
P183, P191, P192, P193, P201, P202, P203;
P183, P191, P192, P193, P201, P202;
val version: Int = name.drop(1).toInt()
@@ -48,7 +48,6 @@ enum class Ide(val platform: Platform) : CompatibilityPredicate {
IJ193(Platform.P193),
IJ201(Platform.P201),
IJ202(Platform.P202),
IJ203(Platform.P203),
AS35(Platform.P183),
AS36(Platform.P192),

View File

@@ -23,10 +23,6 @@ fun JavaExec.passClasspathInJar() {
dependsOn(classpath)
inputs.files(classpath)
inputs.property("main", main)
archiveFileName.set("$main.${this@passClasspathInJar.name}.classpath.container.jar")
destinationDirectory.set(temporaryDir)
doFirst {
val classPathString = classpath.joinToString(" ") { project.file(it).toURI().toString() }
manifest {
@@ -38,11 +34,16 @@ fun JavaExec.passClasspathInJar() {
)
}
}
archiveName = "$main.${this@passClasspathInJar.name}.classpath.container.$extension"
destinationDir = temporaryDir
}
dependsOn(jarTask)
main = "-jar"
classpath = project.files()
args = listOf(jarTask.outputs.files.singleFile.path) + args.orEmpty()
doFirst {
main = "-jar"
classpath = project.files()
args = listOf(jarTask.outputs.files.singleFile.path) + args.orEmpty()
}
}

View File

@@ -6,29 +6,16 @@ import org.gradle.api.Task
import org.gradle.api.artifacts.ConfigurablePublishArtifact
import org.gradle.api.artifacts.Configuration
import org.gradle.api.artifacts.ConfigurationContainer
import org.gradle.api.artifacts.PublishArtifact
import org.gradle.api.artifacts.component.ProjectComponentIdentifier
import org.gradle.api.attributes.Bundling
import org.gradle.api.attributes.Category
import org.gradle.api.attributes.LibraryElements
import org.gradle.api.attributes.Usage
import org.gradle.api.component.AdhocComponentWithVariants
import org.gradle.api.file.DuplicatesStrategy
import org.gradle.api.plugins.BasePluginConvention
import org.gradle.api.plugins.JavaPlugin
import org.gradle.api.plugins.JavaPlugin.*
import org.gradle.api.plugins.JavaPluginExtension
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.publish.tasks.GenerateModuleMetadata
import org.gradle.api.tasks.TaskProvider
import org.gradle.api.tasks.Upload
import org.gradle.api.tasks.javadoc.Javadoc
import org.gradle.jvm.tasks.Jar
import org.gradle.api.artifacts.dsl.DependencyHandler
import org.gradle.kotlin.dsl.*
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetContainer
import plugins.KotlinBuildPublishingPlugin
private const val MAGIC_DO_NOT_CHANGE_TEST_JAR_TASK_NAME = "testJar"
@@ -41,7 +28,7 @@ fun Project.testsJar(body: Jar.() -> Unit = {}): Jar {
pluginManager.withPlugin("java") {
from(testSourceSet.output)
}
archiveClassifier.set("tests")
classifier = "tests"
body()
project.addArtifact(testsJarCfg, this, this)
}
@@ -71,14 +58,20 @@ fun Project.noDefaultJar() {
}
}
fun Project.runtimeJar(body: Jar.() -> Unit = {}): TaskProvider<Jar> = runtimeJar(getOrCreateTask("jar", body)) { }
fun Project.runtimeJarArtifactBy(task: Task, artifactRef: Any, body: ConfigurablePublishArtifact.() -> Unit = {}) {
addArtifact("archives", task, artifactRef, body)
addArtifact("runtimeJar", task, artifactRef, body)
configurations.findByName("runtime")?.let {
addArtifact(it, task, artifactRef, body)
}
}
fun Project.runtimeJar(body: Jar.() -> Unit = {}): TaskProvider<Jar> = runtimeJar(getOrCreateTask("jar", body), { })
fun <T : Jar> Project.runtimeJar(task: TaskProvider<T>, body: T.() -> Unit = {}): TaskProvider<T> {
tasks.named<Jar>("jar").configure {
removeArtifacts(configurations.getOrCreate("archives"), this)
}
task.configure {
configurations.findByName("embedded")?.let { embedded ->
dependsOn(embedded)
@@ -87,51 +80,19 @@ fun <T : Jar> Project.runtimeJar(task: TaskProvider<T>, body: T.() -> Unit = {})
}
}
setupPublicJar(project.the<BasePluginConvention>().archivesBaseName)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE)
body()
project.runtimeJarArtifactBy(this, this)
}
project.addArtifact("archives", task, task)
project.addArtifact("runtimeJar", task, task)
project.configurations.findByName("runtime")?.let {
project.addArtifact(it.name, task, task)
}
val runtimeJar = configurations.maybeCreate("runtimeJar").apply {
isCanBeConsumed = true
isCanBeResolved = false
attributes {
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.LIBRARY))
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME))
attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling.EXTERNAL))
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements.JAR))
}
}
configurePublishedComponent {
withVariantsFromConfiguration(configurations[RUNTIME_ELEMENTS_CONFIGURATION_NAME]) { skip() }
addVariantsFromConfiguration(runtimeJar) { }
}
return task
}
fun Project.sourcesJar(body: Jar.() -> Unit = {}): TaskProvider<Jar> {
configure<JavaPluginExtension> {
withSourcesJar()
}
val sourcesJar = getOrCreateTask<Jar>("sourcesJar") {
fun Project.mainJavaPluginSourceSet() = findJavaPluginConvention()?.sourceSets?.findByName("main")
fun Project.mainKotlinSourceSet() =
(extensions.findByName("kotlin") as? KotlinSourceSetContainer)?.sourceSets?.findByName("main")
fun Project.sources() = mainJavaPluginSourceSet()?.allSource ?: mainKotlinSourceSet()?.kotlin
val task = tasks.register<Jar>("sourcesJar") {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archiveClassifier.set("sources")
from(project.sources())
from(project.mainSourceSet.allSource)
project.configurations.findByName("embedded")?.let { embedded ->
from(provider {
@@ -140,7 +101,10 @@ fun Project.sourcesJar(body: Jar.() -> Unit = {}): TaskProvider<Jar> {
.map { it.id.componentIdentifier }
.filterIsInstance<ProjectComponentIdentifier>()
.mapNotNull {
project(it.projectPath).sources()
project(it.projectPath)
.findJavaPluginConvention()
?.mainSourceSet
?.allSource
}
})
}
@@ -148,21 +112,13 @@ fun Project.sourcesJar(body: Jar.() -> Unit = {}): TaskProvider<Jar> {
body()
}
addArtifact("archives", sourcesJar)
addArtifact("sources", sourcesJar)
addArtifact("archives", task)
addArtifact("sources", task)
configurePublishedComponent {
addVariantsFromConfiguration(configurations[SOURCES_ELEMENTS_CONFIGURATION_NAME]) { }
}
return sourcesJar
return task
}
fun Project.javadocJar(body: Jar.() -> Unit = {}): TaskProvider<Jar> {
configure<JavaPluginExtension> {
withJavadocJar()
}
val javadocTask = getOrCreateTask<Jar>("javadocJar") {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archiveClassifier.set("javadoc")
@@ -174,40 +130,9 @@ fun Project.javadocJar(body: Jar.() -> Unit = {}): TaskProvider<Jar> {
}
addArtifact("archives", javadocTask)
configurePublishedComponent {
addVariantsFromConfiguration(configurations[JAVADOC_ELEMENTS_CONFIGURATION_NAME]) { }
}
return javadocTask
}
fun Project.modularJar(body: Jar.() -> Unit): TaskProvider<Jar> {
val modularJar = configurations.maybeCreate("modularJar").apply {
isCanBeConsumed = true
isCanBeResolved = false
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME))
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named("modular-jar"))
}
}
val modularJarTask = getOrCreateTask<Jar>("modularJar") {
archiveClassifier.set("modular")
body()
}
addArtifact("modularJar", modularJarTask)
addArtifact("archives", modularJarTask)
configurePublishedComponent {
addVariantsFromConfiguration(modularJar) { mapToMavenScope("runtime") }
}
return modularJarTask
}
fun Project.standardPublicJars() {
runtimeJar()
@@ -215,22 +140,7 @@ fun Project.standardPublicJars() {
javadocJar()
}
fun Project.publish(moduleMetadata: Boolean = false, configure: MavenPublication.() -> Unit = { }) {
apply<KotlinBuildPublishingPlugin>()
if (!moduleMetadata) {
tasks.withType<GenerateModuleMetadata> {
enabled = false
}
}
val publication = extensions.findByType<PublishingExtension>()
?.publications
?.findByName(KotlinBuildPublishingPlugin.PUBLICATION_NAME) as MavenPublication
publication.configure()
}
fun Project.publishWithLegacyMavenPlugin(body: Upload.() -> Unit = {}): Upload {
fun Project.publish(body: Upload.() -> Unit = {}): Upload {
apply<plugins.PublishedKotlinModule>()
if (artifactsRemovedDiagnosticFlag) {
@@ -326,8 +236,8 @@ fun ConfigurationContainer.getOrCreate(name: String): Configuration = findByName
fun Jar.setupPublicJar(baseName: String, classifier: String = "") {
val buildNumber = project.rootProject.extra["buildNumber"] as String
this.archiveBaseName.set(baseName)
this.archiveClassifier.set(classifier)
this.baseName = baseName
this.classifier = classifier
manifest.attributes.apply {
put("Implementation-Vendor", "JetBrains")
put("Implementation-Title", baseName)
@@ -346,26 +256,9 @@ fun Project.addArtifact(configuration: Configuration, task: Task, artifactRef: A
fun Project.addArtifact(configurationName: String, task: Task, artifactRef: Any, body: ConfigurablePublishArtifact.() -> Unit = {}) =
addArtifact(configurations.getOrCreate(configurationName), task, artifactRef, body)
fun <T : Task> Project.addArtifact(
configurationName: String,
task: TaskProvider<T>,
body: ConfigurablePublishArtifact.() -> Unit = {}
): PublishArtifact {
fun <T : Task> Project.addArtifact(configurationName: String, task: TaskProvider<T>, body: ConfigurablePublishArtifact.() -> Unit = {}) {
configurations.maybeCreate(configurationName)
return artifacts.add(configurationName, task, body)
}
fun <T : Task> Project.addArtifact(
configurationName: String,
task: TaskProvider<T>,
artifactRef: Any,
body: ConfigurablePublishArtifact.() -> Unit = {}
): PublishArtifact {
configurations.maybeCreate(configurationName)
return artifacts.add(configurationName, artifactRef) {
builtBy(task)
body()
}
artifacts.add(configurationName, task, body)
}
fun Project.cleanArtifacts() {
@@ -375,6 +268,3 @@ fun Project.cleanArtifacts() {
}
}
}
fun Project.configurePublishedComponent(configure: AdhocComponentWithVariants.() -> Unit) =
(components.findByName(KotlinBuildPublishingPlugin.ADHOC_COMPONENT_NAME) as AdhocComponentWithVariants?)?.apply(configure)

View File

@@ -9,13 +9,10 @@
import org.gradle.api.GradleException
import org.gradle.api.Project
import org.gradle.api.artifacts.Dependency
import org.gradle.api.artifacts.ExternalModuleDependency
import org.gradle.api.artifacts.ProjectDependency
import org.gradle.api.artifacts.dsl.DependencyHandler
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.file.FileCollection
import org.gradle.kotlin.dsl.accessors.runtime.addDependencyTo
import org.gradle.kotlin.dsl.extra
import org.gradle.kotlin.dsl.project
import java.io.File
@@ -115,50 +112,6 @@ fun DependencyHandler.projectTests(name: String): ProjectDependency = project(na
fun DependencyHandler.projectRuntimeJar(name: String): ProjectDependency = project(name, configuration = "runtimeJar")
fun DependencyHandler.projectArchives(name: String): ProjectDependency = project(name, configuration = "archives")
fun Project.testApiJUnit5(
vintageEngine: Boolean = false,
runner: Boolean = false,
suiteApi: Boolean = false
) {
with(dependencies) {
val platformVersion = commonVer("org.junit", "junit-bom")
testApi(platform("org.junit:junit-bom:$platformVersion"))
testApi("org.junit.jupiter:junit-jupiter")
if (vintageEngine) {
testApi("org.junit.vintage:junit-vintage-engine:$platformVersion")
}
val componentsVersion = commonVer("org.junit.platform", "")
val components = mutableListOf(
"org.junit.platform:junit-platform-commons",
"org.junit.platform:junit-platform-launcher"
)
if (runner) {
components += "org.junit.platform:junit-platform-runner"
}
if (suiteApi) {
components += "org.junit.platform:junit-platform-suite-api"
}
for (component in components) {
testApi("$component:$componentsVersion")
}
addDependencyTo<ExternalModuleDependency>(this, "testImplementation", intellijDep()) {
// This dependency is needed only for FileComparisonFailure
includeJars("idea_rt", rootProject = rootProject)
isTransitive = false
}
// This is needed only for using FileComparisonFailure, which relies on JUnit 3 classes
add("testRuntimeOnly", commonDep("junit:junit"))
}
}
private fun DependencyHandler.testApi(dependencyNotation: Any) {
add("testApi", dependencyNotation)
}
val Project.protobufVersion: String get() = findProperty("versions.protobuf") as String
val Project.protobufRepo: String

View File

@@ -5,13 +5,10 @@ import org.gradle.api.Project
import org.gradle.api.file.DuplicatesStrategy
import org.gradle.api.tasks.TaskProvider
import org.gradle.jvm.tasks.Jar
import org.gradle.kotlin.dsl.named
import org.gradle.kotlin.dsl.project
import org.gradle.kotlin.dsl.provideDelegate
import org.gradle.kotlin.dsl.register
import org.gradle.kotlin.dsl.*
import java.io.File
const val kotlinEmbeddableRootPackage = "org.jetbrains.kotlin"
val kotlinEmbeddableRootPackage = "org.jetbrains.kotlin"
val packagesToRelocate =
listOf(
@@ -25,7 +22,6 @@ val packagesToRelocate =
"org.fusesource",
"net.jpountz",
"one.util.streamex",
"it.unimi.dsi.fastutil",
"kotlinx.collections.immutable"
)
@@ -35,23 +31,21 @@ val packagesToRelocate =
// But due to the shadow plugin bug (https://github.com/johnrengelman/shadow/issues/262) it is not possible to use
// packagesToRelocate list to for the include list. Therefore the exclude list has to be created.
val packagesToExcludeFromDummy =
listOf(
"org/jetbrains/kotlin/**",
"org/intellij/lang/annotations/**",
"org/jetbrains/jps/**",
"META-INF/**",
"com/sun/jna/**",
"com/thoughtworks/xstream/**",
"javaslang/**",
"*.proto",
"messages/**",
"net/sf/cglib/**",
"one/util/streamex/**",
"org/iq80/snappy/**",
"org/jline/**",
"org/xmlpull/**",
"*.txt"
)
listOf("org/jetbrains/kotlin/**",
"org/intellij/lang/annotations/**",
"org/jetbrains/jps/**",
"META-INF/**",
"com/sun/jna/**",
"com/thoughtworks/xstream/**",
"javaslang/**",
"*.proto",
"messages/**",
"net/sf/cglib/**",
"one/util/streamex/**",
"org/iq80/snappy/**",
"org/jline/**",
"org/xmlpull/**",
"*.txt")
private fun ShadowJar.configureEmbeddableCompilerRelocation(withJavaxInject: Boolean = true) {
relocate("com.google.protobuf", "org.jetbrains.kotlin.protobuf")
@@ -73,8 +67,8 @@ private fun Project.compilerShadowJar(taskName: String, body: ShadowJar.() -> Un
dependencies.add(compilerJar.name, dependencies.project(":kotlin-compiler", configuration = "runtimeJar"))
return tasks.register<ShadowJar>(taskName) {
destinationDirectory.set(project.file(File(buildDir, "libs")))
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
destinationDir = File(buildDir, "libs")
setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE)
from(compilerJar)
body()
}
@@ -113,8 +107,8 @@ fun Project.embeddableCompilerDummyForDependenciesRewriting(
)
return tasks.register<ShadowJar>(taskName) {
destinationDirectory.set(project.file(File(buildDir, "libs")))
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
destinationDir = File(buildDir, "libs")
setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE)
from(compilerDummyJar)
configureEmbeddableCompilerRelocation(withJavaxInject = false)
body()
@@ -125,7 +119,7 @@ fun Project.rewriteDepsToShadedJar(
originalJarTask: TaskProvider<out Jar>, shadowJarTask: TaskProvider<out Jar>, body: Jar.() -> Unit = {}
): TaskProvider<out Jar> {
originalJarTask.configure {
archiveClassifier.set("original")
classifier = "original"
}
val compilerDummyJarFile by lazy { configurations.getAt("compilerDummyJar").singleFile }
@@ -138,7 +132,7 @@ fun Project.rewriteDepsToShadedJar(
// which leads to the content of that JAR being excluded as well:
exclude { it.file == compilerDummyJarFile }
archiveClassifier.set("original")
classifier = ""
body()
}
return shadowJarTask

View File

@@ -101,12 +101,8 @@ fun MutableCollection<JdkId>.discoverJdks(project: Project) {
}
}
private val macOsJavaHomeOutRegexes =
listOf(
Regex("""\s+(\S+),\s+(\S+):\s+".*?"\s+(.+)"""),
Regex("""\s+(\S+)\s+\((.*?)\):\s+(.+)"""),
Regex("""\s+(\S+)\s+\((.*?)\)\s+"[^"]*"\s+-\s+"[^"]*"\s(.+)""")
)
private val macOsJavaHomeOutRegexes = listOf(Regex("""\s+(\S+),\s+(\S+):\s+".*?"\s+(.+)"""),
Regex("""\s+(\S+)\s+\((.*?)\):\s+(.+)"""))
fun MutableCollection<JdkId>.discoverJdksOnMacOS(project: Project) {
val procBuilder = ProcessBuilder("/usr/libexec/java_home", "-V").redirectErrorStream(true)

View File

@@ -80,8 +80,6 @@ fun Project.androidDxJar() = "org.jetbrains.kotlin:android-dx:${rootProject.extr
fun Project.jpsBuildTest() = "com.jetbrains.intellij.idea:jps-build-test:${rootProject.extra["versions.intellijSdk"]}"
fun Project.kotlinxCollectionsImmutable() = "org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:${rootProject.extra["versions.kotlinx-collections-immutable"]}"
/**
* Runtime version of annotations that are already in Kotlin stdlib (historically Kotlin has older version of this one).
*
@@ -132,10 +130,12 @@ object IntellijRootUtils {
}
}
@Suppress("UNCHECKED_CAST")
fun ModuleDependency.includeIntellijCoreJarDependencies(project: Project, jarsFilterPredicate: (String) -> Boolean = { true }): Unit =
fun ModuleDependency.includeIntellijCoreJarDependencies(project: Project) =
includeJars(*(project.rootProject.extra["IntellijCoreDependencies"] as List<String>).toTypedArray(), rootProject = project.rootProject)
fun ModuleDependency.includeIntellijCoreJarDependencies(project: Project, jarsFilterPredicate: (String) -> Boolean) =
includeJars(
*(project.rootProject.extra["IntellijCoreDependencies"] as List<String>).filter(jarsFilterPredicate).toTypedArray(),
*(project.rootProject.extra["IntellijCoreDependencies"] as List<String>).filter { jarsFilterPredicate(it) }.toTypedArray(),
rootProject = project.rootProject
)
@@ -165,7 +165,7 @@ fun Project.runIdeTask(name: String, ideaPluginDir: File, ideaSandboxDir: File,
classpath = mainSourceSet.runtimeClasspath
mainClass.set("com.intellij.idea.Main")
main = "com.intellij.idea.Main"
workingDir = File(intellijRootDir(), "bin")
@@ -178,14 +178,13 @@ fun Project.runIdeTask(name: String, ideaPluginDir: File, ideaSandboxDir: File,
"-Didea.system.path=$ideaSandboxDir",
"-Didea.config.path=$ideaSandboxConfigDir",
"-Didea.tooling.debug=true",
"-Dfus.internal.test.mode=true",
"-Dapple.laf.useScreenMenuBar=true",
"-Dapple.awt.graphics.UseQuartz=true",
"-Dsun.io.useCanonCaches=false",
"-Dplugin.path=${ideaPluginDir.absolutePath}"
)
if (Platform[201].orHigher() && !isIntellijUltimateSdkAvailable()) {
if (Platform[201].orHigher()) {
jvmArgs("-Didea.platform.prefix=Idea")
}

View File

@@ -1,85 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
import com.gradle.publish.PluginBundleExtension
import com.gradle.publish.PluginConfig
import org.gradle.api.Project
import org.gradle.api.publish.PublicationContainer
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.publish.maven.tasks.PublishToMavenRepository
import org.gradle.api.tasks.bundling.Jar
import org.gradle.kotlin.dsl.*
import plugins.KotlinBuildPublishingPlugin
import plugins.configureRepository
import java.util.*
internal const val PLUGIN_MARKER_SUFFIX = ".gradle.plugin"
@OptIn(ExperimentalStdlibApi::class)
fun Project.publishPluginMarkers(withEmptyJars: Boolean = true) {
fun Project.isSonatypePublish(): Boolean =
hasProperty("isSonatypePublish") && property("isSonatypePublish") as Boolean
val pluginDevelopment = extensions.getByType<PluginBundleExtension>()
val publishingExtension = extensions.getByType<PublishingExtension>()
val mainPublication = publishingExtension.publications[KotlinBuildPublishingPlugin.PUBLICATION_NAME] as MavenPublication
pluginDevelopment.plugins.forEach { declaration ->
val markerPublication = createMavenMarkerPublication(declaration, mainPublication, publishingExtension.publications)
if (withEmptyJars) {
addEmptyJarArtifacts(markerPublication)
}
tasks.named<PublishToMavenRepository>(
"publish${markerPublication.name.capitalize(Locale.ROOT)}PublicationTo${KotlinBuildPublishingPlugin.REPOSITORY_NAME}Repository"
).apply {
configureRepository()
configure {
onlyIf { !isSonatypePublish() }
}
}
}
}
fun Project.addEmptyJarArtifacts(publication: MavenPublication) {
val emptyJar = getOrCreateTask<Jar>("emptyJar") {
archiveBaseName.set("empty")
}
publication.artifact(emptyJar.get()) { }
publication.artifact(emptyJar.get()) { classifier = "sources" }
publication.artifact(emptyJar.get()) { classifier = "javadoc" }
}
// Based on code from `java-gradle-plugin`
// https://github.com/gradle/gradle/blob/v6.4.0/subprojects/plugin-development/src/main/java/org/gradle/plugin/devel/plugins/MavenPluginPublishPlugin.java#L84
private fun createMavenMarkerPublication(
declaration: PluginConfig,
coordinates: MavenPublication,
publications: PublicationContainer
): MavenPublication {
return publications.create<MavenPublication>(declaration.name.toString() + "PluginMarkerMaven") {
val pluginId: String = declaration.id
artifactId = pluginId + PLUGIN_MARKER_SUFFIX
groupId = pluginId
pom.withXml {
val root = asElement()
val document = root.ownerDocument
val dependencies = root.appendChild(document.createElement("dependencies"))
val dependency = dependencies.appendChild(document.createElement("dependency"))
val groupId = dependency.appendChild(document.createElement("groupId"))
groupId.textContent = coordinates.groupId
val artifactId = dependency.appendChild(document.createElement("artifactId"))
artifactId.textContent = coordinates.artifactId
val version = dependency.appendChild(document.createElement("version"))
version.textContent = coordinates.version
}
pom.name.set(declaration.displayName)
pom.description.set(declaration.description)
}
}

View File

@@ -41,7 +41,7 @@ open class DexMethodCount : DefaultTask() {
dependsOn(jar)
}
@Internal // plain output properties are not supported, mark as internal to suppress warning from validatePlugins
@Internal // plain output properties are not supported, mark as internal to suppress warning from validateTaskProperties
lateinit var counts: Counts
@get:OutputFile

View File

@@ -1,184 +0,0 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package plugins
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.attributes.Usage
import org.gradle.api.component.SoftwareComponentFactory
import org.gradle.api.plugins.JavaBasePlugin
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin
import org.gradle.api.publish.maven.tasks.PublishToMavenRepository
import org.gradle.api.tasks.TaskProvider
import org.gradle.kotlin.dsl.*
import org.gradle.plugins.signing.Sign
import org.gradle.plugins.signing.SigningExtension
import org.gradle.plugins.signing.SigningPlugin
import java.util.*
import javax.inject.Inject
class KotlinBuildPublishingPlugin @Inject constructor(
private val componentFactory: SoftwareComponentFactory
) : Plugin<Project> {
override fun apply(target: Project): Unit = with(target) {
apply<MavenPublishPlugin>()
apply<SigningPlugin>()
val publishedRuntime = configurations.maybeCreate(RUNTIME_CONFIGURATION).apply {
isCanBeConsumed = false
isCanBeResolved = false
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME))
}
}
val publishedCompile = configurations.maybeCreate(COMPILE_CONFIGURATION).apply {
isCanBeConsumed = false
isCanBeResolved = false
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_API))
}
}
val kotlinLibraryComponent = componentFactory.adhoc(ADHOC_COMPONENT_NAME)
components.add(kotlinLibraryComponent)
kotlinLibraryComponent.addVariantsFromConfiguration(publishedCompile) { mapToMavenScope("compile") }
kotlinLibraryComponent.addVariantsFromConfiguration(publishedRuntime) { mapToMavenScope("runtime") }
pluginManager.withPlugin("java-base") {
val runtimeElements by configurations
val apiElements by configurations
publishedRuntime.extendsFrom(runtimeElements)
publishedCompile.extendsFrom(apiElements)
kotlinLibraryComponent.addVariantsFromConfiguration(runtimeElements) {
mapToMavenScope("runtime")
if (configurationVariant.artifacts.any { JavaBasePlugin.UNPUBLISHABLE_VARIANT_ARTIFACTS.contains(it.type) }) {
skip()
}
}
}
configure<PublishingExtension> {
publications {
create<MavenPublication>(PUBLICATION_NAME) {
from(kotlinLibraryComponent)
configureKotlinPomAttributes(project)
}
}
}
configureDefaultPublishing()
}
companion object {
const val PUBLICATION_NAME = "Main"
const val REPOSITORY_NAME = "Maven"
const val ADHOC_COMPONENT_NAME = "kotlinLibrary"
const val COMPILE_CONFIGURATION = "publishedCompile"
const val RUNTIME_CONFIGURATION = "publishedRuntime"
}
}
@OptIn(ExperimentalStdlibApi::class)
private fun humanReadableName(name: String) =
name.split("-").joinToString(separator = " ") { it.capitalize(Locale.ROOT) }
fun MavenPublication.configureKotlinPomAttributes(project: Project, explicitDescription: String? = null) {
val publication = this
pom {
packaging = "jar"
name.set(humanReadableName(publication.artifactId))
description.set(explicitDescription ?: project.description ?: humanReadableName(publication.artifactId))
url.set("https://kotlinlang.org/")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
scm {
url.set("https://github.com/JetBrains/kotlin")
connection.set("scm:git:https://github.com/JetBrains/kotlin.git")
developerConnection.set("scm:git:https://github.com/JetBrains/kotlin.git")
}
developers {
developer {
name.set("Kotlin Team")
organization.set("JetBrains")
organizationUrl.set("https://www.jetbrains.com")
}
}
}
}
fun Project.configureDefaultPublishing() {
configure<PublishingExtension> {
repositories {
maven {
name = KotlinBuildPublishingPlugin.REPOSITORY_NAME
url = file("${project.rootDir}/build/repo").toURI()
}
}
}
configureSigning()
tasks.register("install") {
dependsOn(tasks.named("publishToMavenLocal"))
}
tasks.withType<PublishToMavenRepository>()
.matching { it.name.endsWith("PublicationTo${KotlinBuildPublishingPlugin.REPOSITORY_NAME}Repository") }
.all { configureRepository() }
}
private fun Project.configureSigning() {
val signingRequired = provider {
project.findProperty("signingRequired")?.toString()?.toBoolean()
?: project.property("isSonatypeRelease") as Boolean
}
configure<SigningExtension> {
setRequired(signingRequired)
sign(extensions.getByType<PublishingExtension>().publications) // all publications
useGpgCmd()
}
tasks.withType<Sign>().configureEach {
setOnlyIf { signingRequired.get() }
}
}
fun TaskProvider<PublishToMavenRepository>.configureRepository() =
configure { configureRepository() }
private fun PublishToMavenRepository.configureRepository() {
dependsOn(project.rootProject.tasks.named("preparePublication"))
doFirst {
val preparePublication = project.rootProject.tasks.named("preparePublication").get()
val username: String? by preparePublication.extra
val password: String? by preparePublication.extra
val repoUrl: String by preparePublication.extra
repository.apply {
url = project.uri(repoUrl)
if (url.scheme != "file" && username != null && password != null) {
credentials {
this.username = username
this.password = password
}
}
}
}
}

View File

@@ -1,4 +1,3 @@
@file:Suppress("DEPRECATION")
package plugins
import org.codehaus.groovy.runtime.InvokerHelper
@@ -17,8 +16,10 @@ import org.gradle.plugins.signing.Sign
import org.gradle.plugins.signing.SigningExtension
import kotlin.properties.Delegates
/**
* Configures a Kotlin module for publication.
*
*/
open class PublishedKotlinModule : Plugin<Project> {
@@ -30,18 +31,12 @@ open class PublishedKotlinModule : Plugin<Project> {
plugins.apply("maven")
configurations.maybeCreate("publishedRuntime").apply {
val publishedRuntime by configurations.creating {
the<MavenPluginConvention>()
.conf2ScopeMappings
.addMapping(0, this, Conf2ScopeMappingContainer.RUNTIME)
}
configurations.maybeCreate("publishedCompile").apply {
the<MavenPluginConvention>()
.conf2ScopeMappings
.addMapping(0, this, Conf2ScopeMappingContainer.COMPILE)
}
if (!project.hasProperty("prebuiltJar")) {
plugins.apply("signing")

View File

@@ -23,15 +23,3 @@ fun DependencyHandler.publishedRuntime(
): ExternalModuleDependency =
addDependencyTo(this, "publishedRuntime", dependencyNotation, dependencyConfiguration)
val NamedDomainObjectContainer<Configuration>.publishedCompile: NamedDomainObjectProvider<Configuration> get() = named("publishedCompile")
fun DependencyHandler.publishedCompile(dependencyNotation: Any): Dependency? =
add("publishedCompile", dependencyNotation)
fun DependencyHandler.publishedCompile(
dependencyNotation: String,
dependencyConfiguration: Action<ExternalModuleDependency>
): ExternalModuleDependency =
addDependencyTo(this, "publishedCompile", dependencyNotation, dependencyConfiguration)

View File

@@ -30,7 +30,6 @@ val SourceSet.projectDefault: Project.() -> Unit
}
"test" -> {
java.srcDirs("test", "tests")
this@projectDefault.resources.srcDir("testResources")
}
}
}

View File

@@ -1,6 +1,17 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -20,48 +31,10 @@ import java.lang.Character.isUpperCase
import java.nio.file.Files
import java.nio.file.Path
fun Task.dependsOnKotlinPluginInstall() {
dependsOn(
":kotlin-allopen:install",
":kotlin-noarg:install",
":kotlin-sam-with-receiver:install",
":kotlin-android-extensions:install",
":kotlin-parcelize-compiler:install",
":kotlin-build-common:install",
":kotlin-compiler-embeddable:install",
":native:kotlin-native-utils:install",
":kotlin-util-klib:install",
":kotlin-util-io:install",
":kotlin-compiler-runner:install",
":kotlin-daemon-embeddable:install",
":kotlin-daemon-client:install",
":kotlin-gradle-plugin-api:install",
":kotlin-gradle-plugin:install",
":kotlin-gradle-plugin-model:install",
":kotlin-reflect:install",
":kotlin-annotation-processing-gradle:install",
":kotlin-test:install",
":kotlin-gradle-subplugin-example:install",
":kotlin-stdlib-common:install",
":kotlin-stdlib:install",
":kotlin-stdlib-jdk8:install",
":kotlin-stdlib-js:install",
":examples:annotation-processor-example:install",
":kotlin-script-runtime:install",
":kotlin-scripting-common:install",
":kotlin-scripting-jvm:install",
":kotlin-scripting-compiler-embeddable:install",
":kotlin-scripting-compiler-impl-embeddable:install",
":kotlin-test-js-runner:install",
":native:kotlin-klib-commonizer-embeddable:install"
)
}
fun Project.projectTest(
taskName: String = "test",
parallel: Boolean = false,
shortenTempRootName: Boolean = false,
jUnit5Enabled: Boolean = false,
body: Test.() -> Unit = {}
): TaskProvider<Test> = getOrCreateTask(taskName) {
doFirst {
@@ -95,48 +68,32 @@ fun Project.projectTest(
}
}
val parentNames = if (jUnit5Enabled) {
/*
* If we run test from inner test class with junit 5 we need
* to include all containing classes of our class
*/
val nestedNames = classFileNameWithoutExtension.split("$")
mutableListOf(nestedNames.first()).also {
for (s in nestedNames.subList(1, nestedNames.size)) {
it += "${it.last()}\$$s"
}
}
} else emptyList()
include { treeElement ->
val path = treeElement.path
if (treeElement.isDirectory) {
include {
val path = it.path
if (it.isDirectory) {
classFileNameWithoutExtension.startsWith(path)
} else {
if (jUnit5Enabled) {
path == classFileName || (path.endsWith(".class") && parentNames.any { path.startsWith(it) })
} else {
path == classFileName || (path.endsWith(".class") && path.startsWith("$classFileNameWithoutExtension$"))
}
path == classFileName || (path.endsWith(".class") && path.startsWith("$classFileNameWithoutExtension$"))
}
}
}
}
if (project.findProperty("kotlin.test.instrumentation.disable")?.toString()?.toBoolean() != true) {
doFirst {
val agent = tasks.findByPath(":test-instrumenter:jar")!!.outputs.files.singleFile
val args = project.findProperty("kotlin.test.instrumentation.args")?.let { "=$it" }.orEmpty()
jvmArgs("-javaagent:$agent$args")
}
dependsOn(":test-instrumenter:jar")
doFirst {
val agent = tasks.findByPath(":test-instrumenter:jar")!!.outputs.files.singleFile
val args = project.findProperty("kotlin.test.instrumentation.args")?.let { "=$it" }.orEmpty()
jvmArgs("-javaagent:$agent$args")
}
dependsOn(":test-instrumenter:jar")
jvmArgs(
"-ea",
"-XX:+HeapDumpOnOutOfMemoryError",
"-XX:+UseCodeCacheFlushing",
"-XX:ReservedCodeCacheSize=256m",
"-XX:ReservedCodeCacheSize=128m",
"-Djna.nosys=true"
)
@@ -157,7 +114,7 @@ fun Project.projectTest(
var subProjectTempRoot: Path? = null
doFirst {
val teamcity = rootProject.findProperty("teamcity") as? Map<*, *>
val teamcity = rootProject.findProperty("teamcity") as? Map<Any?, *>
val systemTempRoot =
// TC by default doesn't switch `teamcity.build.tempDir` to 'java.io.tmpdir' so it could cause to wasted disk space
// Should be fixed soon on Teamcity side
@@ -183,7 +140,7 @@ fun Project.projectTest(
if (parallel) {
maxParallelForks =
project.findProperty("kotlin.test.maxParallelForks")?.toString()?.toInt()
?: (Runtime.getRuntime().availableProcessors() / if (kotlinBuildProperties.isTeamcityBuild) 2 else 4).coerceAtLeast(1)
?: Math.max(Runtime.getRuntime().availableProcessors() / if (kotlinBuildProperties.isTeamcityBuild) 2 else 4, 1)
}
body()
}

View File

@@ -1,30 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
import com.gradle.enterprise.gradleplugin.testdistribution.TestDistributionExtension
import org.gradle.api.tasks.testing.Test
import org.gradle.internal.os.OperatingSystem
fun Test.configureTestDistribution(configure: TestDistributionExtension.() -> Unit = {}) {
val isTeamcityBuild = project.kotlinBuildProperties.isTeamcityBuild
val testDistributionEnabled = project.findProperty("kotlin.build.test.distribution.enabled")?.toString()?.toBoolean()
?: isTeamcityBuild
useJUnitPlatform()
extensions.configure(TestDistributionExtension::class.java) {
enabled.set(testDistributionEnabled)
maxRemoteExecutors.set(20)
if (isTeamcityBuild) {
requirements.set(setOf("os=${OperatingSystem.current().familyName}"))
} else {
maxLocalExecutors.set(0)
}
configure()
}
}
fun Test.isTestDistributionEnabled(): Boolean =
extensions.findByType(TestDistributionExtension::class.java)?.enabled?.orNull ?: false

View File

@@ -1,11 +1,14 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
ext {
isD8Enabled = project.findProperty('android.enableD8').toBoolean()
}
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
classpath 'com.android.tools.build:gradle:3.5.3'
}
}
apply plugin: 'com.android.application'
@@ -17,7 +20,7 @@ repositories {
android {
compileSdkVersion 26
buildToolsVersion "29.0.3"
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "org.jetbrains.kotlin.android.tests"
@@ -57,9 +60,11 @@ android {
resultsDir = "build/test/results"
}
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
if (isD8Enabled) {
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
}
flavorDimensions "box"
@@ -81,12 +86,15 @@ android {
dimension "box"
}
jvm80 {
dimension "box"
}
reflectjvm80 {
dimension "box"
if (isD8Enabled) {
jvm80 {
dimension "box"
}
reflectjvm80 {
dimension "box"
}
}
}

View File

@@ -1,2 +1,3 @@
#don't try to download android specific tools within gradle: licence acceptance will be required
android.builder.sdkDownload=false
android.builder.sdkDownload=false
android.enableD8=true

View File

@@ -6,27 +6,25 @@ plugins {
}
dependencies {
compile(project(":compiler:util"))
compile(project(":compiler:cli"))
compile(project(":compiler:frontend"))
compile(project(":compiler:backend"))
compile(kotlinStdlib())
compile(project(":kotlin-reflect"))
compile(projectTests(":compiler:tests-common"))
compile(commonDep("junit:junit"))
Platform[193].orLower {
compileOnly(intellijDep()) { includeJars("openapi") }
}
testCompile(project(":compiler:incremental-compilation-impl"))
testCompile(project(":core:descriptors"))
testCompile(project(":core:descriptors.jvm"))
testCompile(project(":compiler:util"))
testCompile(project(":compiler:cli"))
testCompile(project(":compiler:frontend"))
testCompile(project(":compiler:backend"))
testCompile(project(":compiler:incremental-compilation-impl"))
testCompile(project(":compiler:frontend.java"))
testCompile(kotlinStdlib())
testCompile(project(":kotlin-reflect"))
testCompile(projectTests(":compiler:tests-common"))
testCompile(commonDep("junit:junit"))
testApi(projectTests(":compiler:test-infrastructure"))
testApi(projectTests(":compiler:test-infrastructure-utils"))
testApi(projectTests(":compiler:tests-compiler-utils"))
testApi(projectTests(":compiler:tests-common-new"))
testCompile(projectTests(":jps-plugin"))
testCompile(commonDep("junit:junit"))
Platform[193].orLower {
testCompile(intellijDep()) { includeJars("openapi", rootProject = rootProject) }
}
@@ -38,15 +36,18 @@ dependencies {
Platform[201].orLower {
testCompile(intellijDep()) { includeJars("groovy-all", rootProject = rootProject) }
}
testCompile(intellijPluginDep("java")) { includeJars("jps-builders") }
Platform[191].orLower {
testCompile(intellijDep()) { includeJars("jps-builders") }
}
Platform[192].orHigher {
testCompile(intellijPluginDep("java")) { includeJars("jps-builders") }
}
testCompile(jpsStandalone()) { includeJars("jps-model") }
testCompile(jpsBuildTest())
testCompile("org.junit.platform:junit-platform-launcher:${commonVer("org.junit.platform", "")}")
}
sourceSets {
"main" { }
"main" { projectDefault() }
"test" { projectDefault() }
}

View File

@@ -55,6 +55,16 @@ class CodegenTestsOnAndroidRunner private constructor(private val pathManager: P
runTestsOnEmulator(gradleRunner, TestSuite("D8")).apply {
rootSuite.addTest(this)
}
renameFlavorFolder()
enableD8(false)
runTestsOnEmulator(gradleRunner, TestSuite("DX")).apply {
(0 until this.countTestCases()).forEach {
val testCase = testAt(it) as TestCase
testCase.name += "_DX"
}
rootSuite.addTest(this)
}
} catch (e: RuntimeException) {
e.printStackTrace()
throw e
@@ -71,6 +81,16 @@ class CodegenTestsOnAndroidRunner private constructor(private val pathManager: P
return rootSuite
}
private fun enableD8(enable: Boolean) {
val file = File(pathManager.androidTmpFolder, "gradle.properties")
val lines = file.readLines().map {
if (it.startsWith("android.enableD8=")) {
"android.enableD8=$enable"
} else it
}
file.writeText(lines.joinToString("\n"))
}
private fun processReport(suite: TestSuite, resultOutput: String) {
val reportFolder = File(flavorFolder())
try {
@@ -140,6 +160,7 @@ class CodegenTestsOnAndroidRunner private constructor(private val pathManager: P
val item = testCases.item(i) as Element
val failure = item.getElementsByTagName("failure")
val name = item.getAttribute("name")
val clazz = item.getAttribute("classname")
if (failure.length == 0) {
object : TestCase(name) {

View File

@@ -16,7 +16,7 @@
package org.jetbrains.kotlin.android.tests;
import org.jetbrains.kotlin.test.util.KtTestUtil;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import java.io.File;
@@ -69,7 +69,7 @@ public class PathManager {
}
public String getAndroidSdkRoot() {
return KtTestUtil.getAndroidSdkSystemIndependentPath();
return KotlinTestUtils.getAndroidSdkSystemIndependentPath();
}
public String getAndroidModuleRoot() {

View File

@@ -121,11 +121,8 @@ public class Emulator {
public void startEmulator() {
startServer();
System.out.println("Starting emulator with ANDROID_HOME/ANDROID_SDK_ROOT: " + pathManager.getAndroidSdkRoot());
GeneralCommandLine startCommand = getStartCommand();
startCommand.withEnvironment("ANDROID_SDK_ROOT", pathManager.getAndroidSdkRoot());
startCommand.withEnvironment("ANDROID_HOME", pathManager.getAndroidSdkRoot());
RunUtils.executeOnSeparateThread(new RunUtils.RunSettings(startCommand, null, false, "START: ", true));
System.out.println("Starting emulator...");
RunUtils.executeOnSeparateThread(new RunUtils.RunSettings(getStartCommand(), null, false, "START: ", true));
printLog();
}
@@ -147,7 +144,6 @@ public class Emulator {
bootCheckCommand.addParameter("shell");
bootCheckCommand.addParameter("getprop");
bootCheckCommand.addParameter("sys.boot_completed");
int counter = 0;
RunResult execute = RunUtils.execute(bootCheckCommand);
while (counter < 20) {

Some files were not shown because too many files have changed in this diff Show More