[Test] JS backend recompilation tests: Dispose the test root disposable of the subordinate incremental configuration
- The incremental configuration for JS recompilation tests creates its own test root disposable. It needs to be properly handled to avoid disposable leaks. - The incremental configuration's disposable is registered with the parent configuration's disposable because it lives in its scope and should thus not be a root disposable. It's also disposed at the end of `transform` because the incremental configuration's lifetime ends there. ^KT-64099 fixed
This commit is contained in:
committed by
Space Team
parent
a4fc658fb3
commit
76a4b32c1f
+12
-3
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.js.test.converters.incremental
|
package org.jetbrains.kotlin.js.test.converters.incremental
|
||||||
|
|
||||||
|
import com.intellij.openapi.util.Disposer
|
||||||
import org.jetbrains.kotlin.test.TargetBackend
|
import org.jetbrains.kotlin.test.TargetBackend
|
||||||
import org.jetbrains.kotlin.test.TestInfrastructureInternals
|
import org.jetbrains.kotlin.test.TestInfrastructureInternals
|
||||||
import org.jetbrains.kotlin.test.TestRunner
|
import org.jetbrains.kotlin.test.TestRunner
|
||||||
@@ -50,6 +51,9 @@ abstract class CommonRecompileModuleJsBackendFacade<R : ResultingArtifact.Fronte
|
|||||||
configure(module)
|
configure(module)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The incremental configuration creates its own test root disposable. It needs to be properly handled to avoid disposable leaks.
|
||||||
|
Disposer.register(testServices.testConfiguration.rootDisposable, incrementalConfiguration.rootDisposable)
|
||||||
|
|
||||||
val moduleStructure = testServices.moduleStructure
|
val moduleStructure = testServices.moduleStructure
|
||||||
val incrementalModule = module.copy(files = filesToRecompile)
|
val incrementalModule = module.copy(files = filesToRecompile)
|
||||||
val incrementalModuleStructure = TestModuleStructureImpl(
|
val incrementalModuleStructure = TestModuleStructureImpl(
|
||||||
@@ -71,9 +75,14 @@ abstract class CommonRecompileModuleJsBackendFacade<R : ResultingArtifact.Fronte
|
|||||||
|
|
||||||
incrementalServices.register(module)
|
incrementalServices.register(module)
|
||||||
|
|
||||||
incrementalRunner.processModule(incrementalModule, incrementalDependencyProvider)
|
val incrementalArtifact = try {
|
||||||
incrementalRunner.reportFailures(incrementalServices)
|
incrementalRunner.processModule(incrementalModule, incrementalDependencyProvider)
|
||||||
val incrementalArtifact = incrementalDependencyProvider.getArtifact(incrementalModule, ArtifactKinds.Js)
|
incrementalRunner.reportFailures(incrementalServices)
|
||||||
|
incrementalDependencyProvider.getArtifact(incrementalModule, ArtifactKinds.Js)
|
||||||
|
} finally {
|
||||||
|
Disposer.dispose(incrementalConfiguration.rootDisposable)
|
||||||
|
}
|
||||||
|
|
||||||
return BinaryArtifacts.Js.IncrementalJsArtifact(inputArtifact, incrementalArtifact)
|
return BinaryArtifacts.Js.IncrementalJsArtifact(inputArtifact, incrementalArtifact)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user