[KAPT] KT-64303 Dispose resources allocated by Standalone Analysis API; re-enable Kapt4IT
Merge-request: KT-MR-13510 Merged-by: Pavel Mikhailovskii <Pavel.Mikhailovskii@jetbrains.com>
This commit is contained in:
committed by
Space Team
parent
c66370bf93
commit
7b841d90e6
-1
@@ -14,7 +14,6 @@ import kotlin.io.path.name
|
|||||||
import kotlin.io.path.walk
|
import kotlin.io.path.walk
|
||||||
|
|
||||||
@DisplayName("Kapt 4 base checks")
|
@DisplayName("Kapt 4 base checks")
|
||||||
@Disabled("Causes OOM on Windows")
|
|
||||||
class Kapt4IT : Kapt3IT() {
|
class Kapt4IT : Kapt3IT() {
|
||||||
override val defaultBuildOptions = super.defaultBuildOptions.copyEnsuringK2()
|
override val defaultBuildOptions = super.defaultBuildOptions.copyEnsuringK2()
|
||||||
|
|
||||||
|
|||||||
-2
@@ -4,7 +4,6 @@ import org.gradle.api.logging.LogLevel
|
|||||||
import org.gradle.testkit.runner.BuildResult
|
import org.gradle.testkit.runner.BuildResult
|
||||||
import org.gradle.util.GradleVersion
|
import org.gradle.util.GradleVersion
|
||||||
import org.jetbrains.kotlin.gradle.testbase.*
|
import org.jetbrains.kotlin.gradle.testbase.*
|
||||||
import org.junit.jupiter.api.Disabled
|
|
||||||
import org.junit.jupiter.api.DisplayName
|
import org.junit.jupiter.api.DisplayName
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
@@ -15,7 +14,6 @@ import kotlin.io.path.deleteRecursively
|
|||||||
import kotlin.io.path.writeText
|
import kotlin.io.path.writeText
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
@Disabled("Causes OOM on Windows")
|
|
||||||
@DisplayName("Kapt incremental compilation")
|
@DisplayName("Kapt incremental compilation")
|
||||||
@OtherGradlePluginTests
|
@OtherGradlePluginTests
|
||||||
open class KaptIncrementalIT : KGPBaseTest() {
|
open class KaptIncrementalIT : KGPBaseTest() {
|
||||||
|
|||||||
-2
@@ -12,7 +12,6 @@ import org.jetbrains.kotlin.gradle.incapt.IncrementalBinaryIsolatingProcessor
|
|||||||
import org.jetbrains.kotlin.gradle.incapt.IncrementalIsolatingProcessor
|
import org.jetbrains.kotlin.gradle.incapt.IncrementalIsolatingProcessor
|
||||||
import org.jetbrains.kotlin.gradle.incapt.IncrementalProcessor
|
import org.jetbrains.kotlin.gradle.incapt.IncrementalProcessor
|
||||||
import org.jetbrains.kotlin.gradle.testbase.*
|
import org.jetbrains.kotlin.gradle.testbase.*
|
||||||
import org.junit.jupiter.api.Disabled
|
|
||||||
import org.junit.jupiter.api.DisplayName
|
import org.junit.jupiter.api.DisplayName
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import kotlin.io.path.createDirectories
|
import kotlin.io.path.createDirectories
|
||||||
@@ -21,7 +20,6 @@ import kotlin.io.path.writeText
|
|||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
import kotlin.test.assertTrue
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
@Disabled("Causes OOM on Windows")
|
|
||||||
@DisplayName("Kapt incremental tests with aggregating apt")
|
@DisplayName("Kapt incremental tests with aggregating apt")
|
||||||
open class KaptIncrementalWithAggregatingApt : KaptIncrementalIT() {
|
open class KaptIncrementalWithAggregatingApt : KaptIncrementalIT() {
|
||||||
|
|
||||||
|
|||||||
-2
@@ -12,7 +12,6 @@ import org.jetbrains.kotlin.gradle.incapt.IncrementalBinaryIsolatingProcessor
|
|||||||
import org.jetbrains.kotlin.gradle.incapt.IncrementalProcessor
|
import org.jetbrains.kotlin.gradle.incapt.IncrementalProcessor
|
||||||
import org.jetbrains.kotlin.gradle.incapt.IncrementalProcessorReferencingClasspath
|
import org.jetbrains.kotlin.gradle.incapt.IncrementalProcessorReferencingClasspath
|
||||||
import org.jetbrains.kotlin.gradle.testbase.*
|
import org.jetbrains.kotlin.gradle.testbase.*
|
||||||
import org.junit.jupiter.api.Disabled
|
|
||||||
import org.junit.jupiter.api.DisplayName
|
import org.junit.jupiter.api.DisplayName
|
||||||
import org.junit.jupiter.api.condition.DisabledOnOs
|
import org.junit.jupiter.api.condition.DisabledOnOs
|
||||||
import org.junit.jupiter.api.condition.OS
|
import org.junit.jupiter.api.condition.OS
|
||||||
@@ -24,7 +23,6 @@ import java.util.zip.ZipOutputStream
|
|||||||
import kotlin.io.path.*
|
import kotlin.io.path.*
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
@Disabled("Causes OOM on Windows")
|
|
||||||
@DisplayName("Kapt incremental tests with isolating apt")
|
@DisplayName("Kapt incremental tests with isolating apt")
|
||||||
open class KaptIncrementalWithIsolatingApt : KaptIncrementalIT() {
|
open class KaptIncrementalWithIsolatingApt : KaptIncrementalIT() {
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.kapt4
|
package org.jetbrains.kotlin.kapt4
|
||||||
|
|
||||||
|
import com.intellij.openapi.util.Disposer
|
||||||
import com.intellij.psi.PsiFile
|
import com.intellij.psi.PsiFile
|
||||||
import com.intellij.psi.PsiJavaFile
|
import com.intellij.psi.PsiJavaFile
|
||||||
import org.jetbrains.kotlin.analysis.api.KtAnalysisApiInternals
|
import org.jetbrains.kotlin.analysis.api.KtAnalysisApiInternals
|
||||||
@@ -64,8 +65,12 @@ private class Kapt4AnalysisHandlerExtension : FirAnalysisHandlerExtension() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val projectDisposable = Disposer.newDisposable("StandaloneAnalysisAPISession.project")
|
||||||
|
try {
|
||||||
val standaloneAnalysisAPISession =
|
val standaloneAnalysisAPISession =
|
||||||
buildStandaloneAnalysisAPISession(classLoader = Kapt4AnalysisHandlerExtension::class.java.classLoader) {
|
buildStandaloneAnalysisAPISession(
|
||||||
|
projectDisposable = projectDisposable,
|
||||||
|
classLoader = Kapt4AnalysisHandlerExtension::class.java.classLoader) {
|
||||||
@Suppress("DEPRECATION") // TODO: KT-61319 Kapt: remove usages of deprecated buildKtModuleProviderByCompilerConfiguration
|
@Suppress("DEPRECATION") // TODO: KT-61319 Kapt: remove usages of deprecated buildKtModuleProviderByCompilerConfiguration
|
||||||
buildKtModuleProviderByCompilerConfiguration(updatedConfiguration)
|
buildKtModuleProviderByCompilerConfiguration(updatedConfiguration)
|
||||||
|
|
||||||
@@ -115,6 +120,9 @@ private class Kapt4AnalysisHandlerExtension : FirAnalysisHandlerExtension() {
|
|||||||
logger.exception(e)
|
logger.exception(e)
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
Disposer.dispose(projectDisposable)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun generateAndSaveStubs(
|
private fun generateAndSaveStubs(
|
||||||
|
|||||||
Reference in New Issue
Block a user