File tree Expand file tree Collapse file tree 2 files changed +27
-34
lines changed Expand file tree Collapse file tree 2 files changed +27
-34
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ package org.scoverage
2
+
3
+ import groovy.lang.Closure
4
+ import org.gradle.api.file.FileCollection
5
+ import org.gradle.api.tasks.Classpath
6
+ import java.net.URL
7
+ import java.net.URLClassLoader
8
+
9
+ class ScoverageRunner (@Classpath val runtimeClasspath : FileCollection ) {
10
+
11
+ fun run (action : Closure <* >) {
12
+
13
+ val cloader = Thread .currentThread().getContextClassLoader() as URLClassLoader
14
+
15
+ val method = URLClassLoader ::class .java.getDeclaredMethod(" addURL" , URL ::class .java)
16
+ method.isAccessible = true
17
+
18
+ runtimeClasspath.files.forEach { f ->
19
+ val url = f.toURI().toURL()
20
+ if (! cloader.urLs.contains(url)) {
21
+ method.invoke(cloader, url)
22
+ }
23
+ }
24
+
25
+ action.call()
26
+ }
27
+ }
You can’t perform that action at this time.
0 commit comments