diff options
author | Jonas Herzig <jonas@spark-squared.com> | 2020-05-22 12:00:34 +0200 |
---|---|---|
committer | Jonas Herzig <jonas@spark-squared.com> | 2020-05-22 12:00:34 +0200 |
commit | 39b3db94179e8fb99041fb0d303140697c091585 (patch) | |
tree | 4a4efa35b3612a25d53b1cf12f21fa1bb5d4c18f /src/main/kotlin | |
parent | c0cdf855f33ad27f9ea6741781a52ab37afce6be (diff) | |
download | Remap-39b3db94179e8fb99041fb0d303140697c091585.tar.gz Remap-39b3db94179e8fb99041fb0d303140697c091585.tar.bz2 Remap-39b3db94179e8fb99041fb0d303140697c091585.zip |
Properly dispose of root Disposable once done
Diffstat (limited to 'src/main/kotlin')
-rw-r--r-- | src/main/kotlin/com/replaymod/gradle/remap/Transformer.kt | 4 |
1 files changed, 3 insertions, 1 deletions
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<String, String>): Map<String, Pair<String, List<Pair<Int, String>>>> { 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<MessageCollector>(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<File> { it.toFile() }.sorted(Comparator.reverseOrder()).forEach { it.delete() } + Disposer.dispose(disposable) } } |