From f55d36414e8bbe2118da045e3381688e7c6301dd Mon Sep 17 00:00:00 2001 From: Owain van Brakel Date: Sun, 28 Jul 2019 22:16:53 +0200 Subject: [PATCH] gradle: Close URLClassLoader to prevent leaking file locks --- injector-plugin/build.gradle | 3 ++- runelite-script-assembler-plugin/build.gradle | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/injector-plugin/build.gradle b/injector-plugin/build.gradle index 745807236e..088fdf8ebd 100644 --- a/injector-plugin/build.gradle +++ b/injector-plugin/build.gradle @@ -39,7 +39,7 @@ compileJava.doLast() { into "$buildDir" } def path = sourceSets.main.runtimeClasspath - def loader = new URLClassLoader(path.collect { f -> f.toURL() } as URL[]) + def loader = new URLClassLoader(path.collect { f -> f.toURI().toURL() } as URL[]) def inject = loader.loadClass('net.runelite.injector.Injector') String[] jarPaths = [ deobfuscatedJar.toString(), @@ -47,6 +47,7 @@ compileJava.doLast() { injectedClassesPath.toString() ] inject.main(jarPaths) + loader.close() } test { diff --git a/runelite-script-assembler-plugin/build.gradle b/runelite-script-assembler-plugin/build.gradle index 165c0a3d4d..4720641d75 100644 --- a/runelite-script-assembler-plugin/build.gradle +++ b/runelite-script-assembler-plugin/build.gradle @@ -13,7 +13,7 @@ compileJava.outputs.upToDateWhen {false} compileJava.doLast { def path = sourceSets.main.runtimeClasspath - def loader = new URLClassLoader(path.collect { f -> f.toURL() } as URL[]) + def loader = new URLClassLoader(path.collect { f -> f.toURI().toURL() } as URL[]) def assemble = loader.loadClass('net.runelite.script.AssembleMojo') String[] assembleArgs = [ "${project.rootDir}/runelite-client/src/main/scripts", @@ -27,4 +27,6 @@ compileJava.doLast { "${project.rootDir}/runelite-client/src/main/resources/runelite/index" ] index.main(indexArgs) + + loader.close() }