Commit Graph

1554 Commits

Author SHA1 Message Date
Dmitry Gridin 4450368c42 [jps][tests] make test compatible with ide plugin
testModuleRebuildOnPluginClasspathsChange

^KTIJ-20456
2022-05-12 12:46:54 +07:00
Yahor Berdnikau c345f01a79 Fix IDEA Gradle import error 2022-05-02 12:02:30 +02:00
Nikita Bobko c1f2d66ed8 Kotlin JPS plugin: drop intellij-core dependency
Drop dependency because
https://youtrack.jetbrains.com/issue/IDEA-292483/UnsupportedClassVersionError-when-trying-to-run-JUnit5-unit-test#focus=Comments-27-6034750.0-0

IDEA plans to drop `PathUtil` from JPS classpath, we should prepare to
that

`KotlinFacetSettingsProvider` isn't used in jps so it was moved into
intellij repo. It was moved to
`community/plugins/kotlin/idea/src/org/jetbrains/kotlin/config/KotlinFacetSettingsProvider.kt`
path (so you can find it git history)

Review: KT-MR-6195
2022-04-29 14:51:03 +02:00
Dmitry Gridin e5bfb8295e [jps][tests] migrate from 1.6 to 1.8 jdk
^KTIJ-20456
2022-04-26 21:41:36 +07:00
Dmitry Gridin 0be0627e34 [jps][tests] remove hardcoded js-ir-runtime path
^KTIJ-20456
2022-04-26 13:19:35 +07:00
Aleksei.Cherepanov 3d8f140d6b [JPS] Fix incremental build after changing Java enum used in Kotlin when
EnumWhenTracker implemented for tracking changed java enum class items, that used in kotlin when expression.

#KT-47824 Fixed
2022-04-19 18:39:41 +00:00
Aleksei.Cherepanov bdf229bc5c [JPS] Ignore classpath from facets to exclude jars from gradle build
Reimport after `./gradlew build` adds jars from gradle's `build/libs` to facet's classpath. That causes problems with JPS build, because it doesn't see changes in out folder, but see unchanged jar, so changes don't apply.

#KT-51873 Fixed

Merge-request: KT-MR-6018
Merged-by: Aleksei Cherepanov <aleksei.cherepanov@jetbrains.com>
2022-04-18 11:20:40 +00:00
Aleksei.Cherepanov e0029b14ee Rebuild module on plugin classpaths change
Add another one reason for rebuild: if pluginClasspaths was changed or even its jar content, module will be marked for rebuild

Merge-request: KT-MR-5839
Merged-by: Aleksei Cherepanov <aleksei.cherepanov@jetbrains.com>
2022-04-18 11:06:15 +00:00
Dmitry Gridin bc3514feae [jps][tests] AbstractLookupTrackerTest.kt: cleanup code
^KTIJ-20456
2022-04-15 22:00:20 +07:00
Dmitry Gridin e737015d5f [jps][tests] remove hardcoded dist path
^KTIJ-20456
2022-04-15 22:00:19 +07:00
Dmitry Gridin d9bab7dd96 [jps][tests] fix property name
^KTIJ-20456
2022-04-14 19:16:52 +07:00
Dmitry Gridin 57b9648041 make jps-plugin testable from IJ infrastructure
^KTIJ-20456
2022-04-14 11:17:47 +07:00
Ilya Chernikov c4a29651b0 FIR IC: fix test with behavior different from non-tight cycle variants 2022-03-30 08:34:51 +00:00
Ilya Chernikov 5abdf93d3b IC: Add IC test with fix on rename file with only class inside
"fails" on JS and JPS tests - the IC logic there is less precise.
2022-03-30 08:32:17 +00:00
Yahor Berdnikau 4aa6d984fc Restore "Drop tasks inheritance from 'AbstractCompile' and 'SourceTask'"
This reverts commit 2c5d817633.
2022-03-24 19:02:54 +01:00
Yahor Berdnikau 2c5d817633 Revert "Drop tasks inheritance from 'AbstractCompile' and 'SourceTask'"
This reverts commit e9498c8978.
2022-03-23 19:03:32 +01:00
Yahor Berdnikau e9498c8978 Drop tasks inheritance from 'AbstractCompile' and 'SourceTask'
'AbstractCompile' task has inputs that are related only to Java
compilation and should not used for Kotlin compile tasks.

'SourceTask' most probably will be deprecated in future Gradle releases
- https://github.com/gradle/gradle/issues/9040. Plus it has
old 'sources' with 'FileTree' type which is not stable
for task inputs snapshotting.

Another breaking change - 'destinationDir' task property is not longer
available. It is replaced by 'destinationDirectory' which uses Gradle
Provider API type.

^KT-32805 In Progress
2022-03-22 15:29:05 +00:00
Nikita Bobko a471ddf059 Kotlin JPS: Inject KOTLIN_BUNDLED macro into JPS
KTIJ-21292
2022-03-14 13:53:15 +00:00
Ilya Chernikov aa0386276d Fix FIR incremental compilation failure with inlines and lambdas
#KT-51546 fixed
2022-03-14 13:37:50 +03:00
Aleksei.Cherepanov ee756638a0 Fix creation of temp file in case of bad parent dir for Gradle
newTmpFile can fail, if you pass non-existent path as temp parent directory or java.io.tmpdir is empty or invalid. Now we try to create non-existent dirs and provide more info if it also fails. Also fix error throwing in JPS part(46c0c4f9)

#KT-51374 Fixed
2022-02-28 08:50:02 +00:00
Nikolay Krasko cd08b26518 Drop KannotatorJpsTest.java 2022-02-22 21:43:25 +03:00
Aleksei.Cherepanov 46c0c4f9d9 Fix creation of temp file in case of bad parent dir
createTempFile can fail, if you pass non-existent path to kotlin.jps.dir.for.module.files or java.io.tmpdir. Now we try to create non-existent dirs and provide more info if it also fails

#KTIJ-17280 Fixed
2022-02-21 08:34:11 +00:00
Aleksei.Cherepanov a80d01265a Use possible incompatible metadata as a fallback for incremental analysis
If LeverVersion is set to greater than 1 of the current compiler version, metadata became null here org.jetbrains.kotlin.load.kotlin.header.ReadKotlinClassHeaderAnnotationVisitor.createHeader, which leads to NPE during incremental analysis. Using the same incompatible data as fallback prevent it

#KTIJ-20954 Fixed

Merge-request: KT-MR-5680
Merged-by: Aleksei Cherepanov <aleksei.cherepanov@jetbrains.com>
2022-02-04 09:42:05 +00:00
Aleksei.Cherepanov 76637a8844 Fix JPS test after 9e1a771d 2022-01-31 12:55:37 +03:00
Aleksei.Cherepanov 0e0b3e6d75 Add test of Kotlin Lombok project compilation
This test checks that the project with Lombok plugin will be compiled successfully after successful import (KTIJ-20506)

#KTIJ-20641 Fixed
2022-01-28 13:30:42 +00:00
Hung Nguyen 9e1a771d57 KT-44741: Update test data to use companion object with custom name
Test: Existing IncrementalJvmCompilerRunnerTestGenerated.PureKotlin#testCompanionConstantChanged
    and similar *.PureKotlin#testCompanionConstantChanged tests
2022-01-27 02:34:42 +03:00
Aleksei.Cherepanov 9971ae4ffd Revert "Fix org.jetbrains.kotlin.jps.build.KotlinJpsBuildTest#testSourcePackageLongPrefix"
This reverts commit e3634c16
2022-01-26 10:03:06 +00:00
Aleksei.Cherepanov 44d796e850 Fix JPS tests after JPS module moved to Kotlin repo
Fix testdata of new compiler tests for JPS, as it is build-log-sensitive:
ClassHierarchyAffected.testWithIntermediateBodiesChanged
PureKotlin.testSerializedSubClassAndChangedInterfaces
WithJava.JavaUsedInKotlin.testRawErrorTypeDuringSerialization

Mute JavaUsedInKotlin.SamConversions tests, as it was fixed in 212 idea

Add missed part of commit 5f4be072 [JPS] Fix JS incremental compilation
Part of commit, located in JPS module, was missed during JPS relocation

Fix test MixedInheritance for non-JPS builds
Depends on commit [CHERRY PICKED FROM IJ] [testdata] Replace test IncrementalJvmJpsTest...
2022-01-26 10:03:05 +00:00
Aleksei.Cherepanov 411a0ecc38 [CHERRY PICKED FROM IJ] [testdata] Replace test IncrementalJvmJpsTestGenerated.WithJava.JavaUsedInKotlin.testMixedInheritance with new one
Replace test because JPS recompile inherited classes only in case of existence of direct use (like override or direct call of parent methods).
Tested cases:
*Add new abstract method when derived class does not abstract
*Add and remove method, when such method is present in derived class
*Change return type/access modifier

GitOrigin-RevId: 767e58ba3d3e4069838c717666329b43f1b8e936
Original commit: https://github.com/JetBrains/intellij-community/commit/d738c61aaefe95acd8130066f53f8d8bcadfa977
2022-01-26 10:03:04 +00:00
Nikita Bobko 81b4760907 Kotlin JPS plugin: set JVM bytecode target to 1.8
^KTIJ-20854 Fixed
2022-01-25 18:28:25 +00:00
Aleksei.Cherepanov b3f6b78fbe [CHERRY PICKED FROM IJ] Fix debug of incremental JPS tests in intellij repo
Create extension of "load classes by parent classloader" logic to bypass clash of the same classes with different versions, loaded by different classloaders in case of running in-process compilation in debug configuration.

#KT-49786 Fixed

GitOrigin-RevId: 173749ef1a36fdb1df44e98f3d373941e00f29ad
Original commit: https://github.com/JetBrains/intellij-community/commit/16e76333d4163c3772fa6e6ef3c1c7667a4c12f9
2022-01-12 15:25:23 +01:00
Aleksei.Cherepanov ea9422fedd [CHERRY PICKED FROM IJ] Update Kotlin caches version due to adding LookupSymbolKeyDescriptor versioning
Since versioning of LookupSymbolKeyDescriptor was added in 1.5.30: f6b428f2 "KT-34862 use abi snapshot instead of build history files", it is necessary to update version of caches for JPS, as new caches are not compatible with previous.

#KT-48399 Fixed

GitOrigin-RevId: 59b1071c1a1090f78c51824d45e6c000f4ef2f3f
Original commit: https://github.com/JetBrains/intellij-community/commit/658f4aeb603bb224a14a92933ebe519948db7745
2022-01-12 15:25:22 +01:00
Stanislav Erokhin 68e5479c95 [CHERRY PICKED FROM IJ] [kotlin:testdata] Update the asm version in AsmVersionForJpsBuildTest
GitOrigin-RevId: 5a2468edca8d1f08c11ce8419178e0e6ce91bd95
Original commit: https://github.com/JetBrains/intellij-community/commit/0a144e464e026bc1f1aa698f28f3b24f6381a890
2022-01-12 15:25:22 +01:00
Aleksei.Cherepanov 7181244129 [CHERRY PICKED FROM IJ] Fix test IncrementalJvmJpsTestGenerated$WithJava$Other.testMultifileClassFileAdded
Fix test data and also remove useless marking of multifiles in KotlinBuilder after 2ee7f2b "incremental annotation processing environment" as it makes the same thing and all results are ignored

GitOrigin-RevId: 379eb3f350539cb1ee27098eecb28931df73b626
Original commit: https://github.com/JetBrains/intellij-community/commit/ee2865c35c2dadc3651518b2760b5176835b251c
2022-01-12 15:25:22 +01:00
Aleksei.Cherepanov dc9abef6e5 [CHERRY PICKED FROM IJ] [testdata] Fix Jps tests testdata
Fix test IncrementalJvmJpsTestGenerated$PureKotlin.testPackageFileAdded
Fix test IncrementalJvmJpsTestGenerated$Custom.testCommonSourcesCompilerArg
Fix test IncrementalJvmJpsTestGenerated$WithJava$JavaUsedInKotlin$SamConversions.testMethodAddDefault

GitOrigin-RevId: 63b7a47898ca42b4d7f11a01ceb0e019933f528b
Original commit: https://github.com/JetBrains/intellij-community/commit/e91bfb29e65b9eb5452c4d5f544f0bbfa3eafde3
2022-01-12 15:25:21 +01:00
Aleksei.Cherepanov a4bf7c9772 [CHERRY PICKED FROM IJ] Fix JPS compilation
GitOrigin-RevId: a799879de2add4ca719307ddf9a143605468e731
Original commit: https://github.com/JetBrains/intellij-community/commit/9746206871853f44205b31dd8757ed2a4ad586ca
2022-01-12 15:25:21 +01:00
Aleksei.Cherepanov 2ea089f0d2 [CHERRY PICKED FROM IJ] Fix incremental build after changing Java const used as class property
Report Java static final constant with InlineConstantTracker, used as class property in Kotlin for further registration in JPS. Add tests.

#KT-49177 Fixed

GitOrigin-RevId: 01a58cf10f5419d70f0d80cbaa9bcd9732ff0547
Original commit: https://github.com/JetBrains/intellij-community/commit/d077f3b3217c8d88518fec7249228cb29df2e0ff
2022-01-12 15:25:20 +01:00
Stanislav Erokhin 3b6cdb071f [CHERRY PICKED FROM IJ] [testdata] Fix testdata for IncrementalJvmJpsTestGenerated.WithJava.JavaUsedInKotlin#testConstantChanged
Previously, because the package in java file was used, generated test runner file was incorrect

GitOrigin-RevId: 3fcf599a26a0789154c550e6ac4aafe0829ce0d1
Original commit: https://github.com/JetBrains/intellij-community/commit/cbe50ad2423fbdb6e18541ecb040bdb0c67af7fd
2022-01-12 15:25:20 +01:00
Aleksei.Cherepanov 6c7a6bf3b1 [CHERRY PICKED FROM IJ] Simplify API for InlineConstTracker and add testdata
GitOrigin-RevId: b2bcde9e3102d575ca459f475c00022515b6ccba
Original commit: https://github.com/JetBrains/intellij-community/commit/f78e98d1ba5b6c142076b67f88c54282c3964c7f
2022-01-12 15:25:20 +01:00
Aleksei.Cherepanov 40dc548fec [CHERRY PICKED FROM IJ] [JPS] Fix incremental build after changing Java constant
InlineConstantTracker implemented for tracking changed java static final constants, that used in kotlin.

#KT-46506 Fixed

GitOrigin-RevId: 63830580acb09d31fe0deede9f82bc1a2847443d
Original commit: https://github.com/JetBrains/intellij-community/commit/3736c00c2c8757241e6fd217faef733421eb9e80
2022-01-12 15:25:19 +01:00
Nikita Bobko fddb205e16 KotlinJpsBuildTest#testJre9: migrate to JDK 11
Possibility to use JDK 9 was dropped in the Kotlin repo in
this commit de7fb9606a so I had to migrate this test.

Consulted with @udalov. He said that it's fine to migrate this test to JDK 11
2022-01-12 15:25:18 +01:00
Nikita Bobko 6ae534c46b org.jetbrains.kotlin.jvm.compiler.ClasspathOrderTest: drop Ignore
This ignore isn't necessary anymore because this test is returned back
to the compiler repo, so it can use compiler test data
2022-01-12 15:25:18 +01:00
Nikita Bobko fc9000d460 Adopt Kotlin JPS plugin modules Gradle model to kotlin/master
Recenlty, Kotlin repository started using Gradle 7.1.
Deprecated `compile`/`testCompile` Gradle API were dropped in that release
2022-01-12 15:25:17 +01:00
Nikita Bobko 3b1e4f63a0 Fix KotlinJpsBuildTestIncremental#testLanguageVersionChanged & KotlinJpsBuildTestIncremental#testApiVersionChanged
This commit fixes: "Kotlin:ERROR:Language version 1.3 is no longer supported; please, use version 1.4 or greater."
2022-01-12 15:25:16 +01:00
Nikita Bobko 2e9f8fff8d BaseKotlinJpsBuildTestCase: fix tests
Original fix in IJ repo: https://github.com/JetBrains/intellij-community/commit/40fb0da80ee4687a6478d43709147ea8dc5570c7
Test example: IncrementalJvmJpsTestGenerated.ClassHierarchyAffected#testEnumEntryRemoved
Test failure output example:
```
Initial make failed:
MakeResult(log=Compiling files:
  src/Enum.kt
  src/getRandomEnumEntry.kt
  src/use.kt
  src/useEnumImplicitly.kt
End of files
Exit code: ABORT
------------------------------------------
COMPILATION FAILED
Cannot access 'java.io.Serializable' which is a supertype of 'Enum'. Check your module classpath for missing or conflicting dependencies
Cannot access 'java.io.Serializable' which is a supertype of 'Enum.A'. Check your module classpath for missing or conflicting dependencies
Cannot access 'java.io.Serializable' which is a supertype of 'Enum.B'. Check your module classpath for missing or conflicting dependencies
Cannot access 'java.io.Serializable' which is a supertype of 'Enum.C'. Check your module classpath for missing or conflicting dependencies
Cannot access 'java.io.Serializable' which is a supertype of 'kotlin.Array'. Check your module classpath for missing or conflicting dependencies
Cannot access 'java.io.Serializable' which is a supertype of 'Enum'. Check your module classpath for missing or conflicting dependencies
, makeFailed=true, mappingsDump=null, name=null)junit.framework.AssertionFailedError: Initial make failed:
MakeResult(log=Compiling files:
  src/Enum.kt
  src/getRandomEnumEntry.kt
  src/use.kt
  src/useEnumImplicitly.kt
End of files
Exit code: ABORT
------------------------------------------
COMPILATION FAILED
Cannot access 'java.io.Serializable' which is a supertype of 'Enum'. Check your module classpath for missing or conflicting dependencies
Cannot access 'java.io.Serializable' which is a supertype of 'Enum.A'. Check your module classpath for missing or conflicting dependencies
Cannot access 'java.io.Serializable' which is a supertype of 'Enum.B'. Check your module classpath for missing or conflicting dependencies
Cannot access 'java.io.Serializable' which is a supertype of 'Enum.C'. Check your module classpath for missing or conflicting dependencies
Cannot access 'java.io.Serializable' which is a supertype of 'kotlin.Array'. Check your module classpath for missing or conflicting dependencies
Cannot access 'java.io.Serializable' which is a supertype of 'Enum'. Check your module classpath for missing or conflicting dependencies
, makeFailed=true, mappingsDump=null, name=null)
	at junit.framework.Assert.fail(Assert.java:57)
	at junit.framework.Assert.assertTrue(Assert.java:22)
	at junit.framework.Assert.assertFalse(Assert.java:39)
	at junit.framework.TestCase.assertFalse(TestCase.java:210)
	at org.jetbrains.kotlin.jps.build.AbstractIncrementalJpsTest.initialMake(AbstractIncrementalJpsTest.kt:240)
	at org.jetbrains.kotlin.jps.build.AbstractIncrementalJpsTest.doTest(AbstractIncrementalJpsTest.kt:333)
	at org.jetbrains.kotlin.test.KotlinTestUtils.lambda$testWithCustomIgnoreDirective$4(KotlinTestUtils.java:522)
	at org.jetbrains.kotlin.test.KotlinTestUtils.runTestImpl(KotlinTestUtils.java:492)
	at org.jetbrains.kotlin.test.KotlinTestUtils.runTest0(KotlinTestUtils.java:473)
	at org.jetbrains.kotlin.test.KotlinTestUtils.runTest(KotlinTestUtils.java:457)
	at org.jetbrains.kotlin.jps.build.IncrementalJvmJpsTestGenerated$ClassHierarchyAffected.runTest(IncrementalJvmJpsTestGenerated.java:2979)
	at org.jetbrains.kotlin.jps.build.IncrementalJvmJpsTestGenerated$ClassHierarchyAffected.testEnumEntryRemoved(IncrementalJvmJpsTestGenerated.java:3063)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:566)
	at junit.framework.TestCase.runTest(TestCase.java:176)
	at com.intellij.testFramework.UsefulTestCase.lambda$runBare$10(UsefulTestCase.java:473)
	at com.intellij.testFramework.UsefulTestCase.lambda$wrapTestRunnable$12(UsefulTestCase.java:493)
	at com.intellij.testFramework.UsefulTestCase.runTestRunnable(UsefulTestCase.java:406)
	at org.jetbrains.kotlin.jps.build.BaseKotlinJpsBuildTestCase.access$runTestRunnable$s-943794013(BaseKotlinJpsBuildTestCase.kt:34)
	at org.jetbrains.kotlin.jps.build.BaseKotlinJpsBuildTestCase$runTestRunnable$1.invoke(BaseKotlinJpsBuildTestCase.kt:73)
	at org.jetbrains.kotlin.jps.build.BaseKotlinJpsBuildTestCase$runTestRunnable$1.invoke(BaseKotlinJpsBuildTestCase.kt:72)
	at org.jetbrains.kotlin.test.MuteWithDatabaseKt.runTest(muteWithDatabase.kt:96)
	at org.jetbrains.kotlin.jps.build.BaseKotlinJpsBuildTestCase.runTestRunnable(BaseKotlinJpsBuildTestCase.kt:72)
	at com.intellij.testFramework.UsefulTestCase.defaultRunBare(UsefulTestCase.java:422)
	at com.intellij.testFramework.UsefulTestCase.lambda$runBare$11(UsefulTestCase.java:481)
	at com.intellij.testFramework.EdtTestUtil.lambda$runInEdtAndWait$1(EdtTestUtil.java:40)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:303)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
	at java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.awt.EventQueue$4.run(EventQueue.java:715)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:421)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
```
2022-01-12 15:25:16 +01:00
Nikita Bobko ca716fd226 Regenerate tests 2022-01-12 15:25:16 +01:00
Nikita Bobko 7ed2eb5c40 Drop a couple of tests from MultiplatformJpsTestWithGeneratedContentGenerated
Those tests were dropped in intellij repo (in repo JPS plugin was
located before) in this commit:
https://github.com/JetBrains/intellij-community/commit/6575a8b00a8f1797dd952c7dff5c5db44d8c45d3
2022-01-12 15:25:15 +01:00
Nikita Bobko fb01b46f6a GenerateTests.kt: restore Kotlin JPS plugin tests schema 2022-01-12 15:25:15 +01:00
Nikita Bobko 3daec9b9ce Use Java 11 in :jps:jps-plugin module in order to fix compilation
IntelliJ uses Java 11 so it forces us to use Java 11 in JPS

This commit fixes:
```
public class DataContainerVersionChangedTestGenerated extends AbstractDataContainerVersionChangedTest {
       ^
  bad class file: /home/bobko/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.platform/test-framework/203.8084.24/ba5c6b3b0eae0a083dc30e866c362094f5072853/test-framework-203.8084.24.jar(com/intellij/testFramework/UsefulTestCase.class)
    class file has wrong version 55.0, should be 52.0
    Please remove or make sure it appears in the correct subdirectory of the classpath.
```
2022-01-12 15:25:15 +01:00
Nikita Bobko aa5ad13b92 [cleanup] Drop bunch files from Kotlin JPS plugin 2022-01-12 15:25:14 +01:00