From 39b3db94179e8fb99041fb0d303140697c091585 Mon Sep 17 00:00:00 2001 From: Jonas Herzig Date: Fri, 22 May 2020 12:00:34 +0200 Subject: Properly dispose of root Disposable once done --- src/main/kotlin/com/replaymod/gradle/remap/Transformer.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/main/kotlin/com/replaymod/gradle/remap/Transformer.kt') diff --git a/src/main/kotlin/com/replaymod/gradle/remap/Transformer.kt b/src/main/kotlin/com/replaymod/gradle/remap/Transformer.kt index 3849483..ed3b53c 100644 --- a/src/main/kotlin/com/replaymod/gradle/remap/Transformer.kt +++ b/src/main/kotlin/com/replaymod/gradle/remap/Transformer.kt @@ -44,6 +44,7 @@ class Transformer(private val map: MappingSet) { @Throws(IOException::class) fun remap(sources: Map): Map>>> { val tmpDir = Files.createTempDirectory("remap") + val disposable = Disposer.newDisposable() try { for ((unitName, source) in sources) { val path = tmpDir.resolve(unitName) @@ -59,7 +60,7 @@ class Transformer(private val map: MappingSet) { config.put(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, PrintingMessageCollector(System.err, MessageRenderer.GRADLE_STYLE, true)) val environment = KotlinCoreEnvironment.createForProduction( - Disposer.newDisposable(), + disposable, config, EnvironmentConfigFiles.JVM_CONFIG_FILES ) @@ -100,6 +101,7 @@ class Transformer(private val map: MappingSet) { return results } finally { Files.walk(tmpDir).map { it.toFile() }.sorted(Comparator.reverseOrder()).forEach { it.delete() } + Disposer.dispose(disposable) } } -- cgit