@@ -2,7 +2,8 @@ package org.scoverage
2
2
3
3
import org.gradle.api.Action
4
4
import org.gradle.api.Project
5
- import org.gradle.api.artifacts.ResolvedConfiguration
5
+ import org.gradle.api.artifacts.Configuration
6
+ import org.gradle.api.file.FileCollection
6
7
import org.gradle.api.plugins.JavaPlugin
7
8
import org.gradle.api.plugins.scala.ScalaPlugin
8
9
import org.gradle.api.tasks.JavaExec
@@ -77,13 +78,14 @@ class ScoverageExtension {
77
78
extension. dataDir. mkdirs()
78
79
extension. reportDir. mkdirs()
79
80
80
- ResolvedConfiguration s = t. configurations[ScoveragePlugin . CONFIGURATION_NAME ]. resolvedConfiguration
81
- String pluginPath = s. getFirstLevelModuleDependencies(). iterator(). next(). moduleArtifacts. iterator(). next(). file. absolutePath
81
+ Configuration configuration = t. configurations[ScoveragePlugin . CONFIGURATION_NAME ]
82
+ File pluginFile = configuration. filter { it. name. contains(' plugin' ) }. iterator(). next()
83
+ FileCollection pluginDependencies = configuration. filter { it != pluginFile }
82
84
83
85
t. tasks[ScoveragePlugin . COMPILE_NAME ]. configure {
84
86
85
87
86
- List<String > plugin = [' -Xplugin:' + pluginPath ]
88
+ List<String > plugin = [' -Xplugin:' + pluginFile . absolutePath ]
87
89
List<String > parameters = scalaCompileOptions. additionalParameters
88
90
if (parameters != null ) {
89
91
plugin. addAll(parameters)
@@ -100,19 +102,18 @@ class ScoverageExtension {
100
102
}
101
103
scalaCompileOptions. additionalParameters = plugin
102
104
// exclude the scala libraries that are added to enable scala version detection
103
- classpath + = t . configurations[ ScoveragePlugin . CONFIGURATION_NAME ]
105
+ classpath + = pluginDependencies
104
106
}
105
107
106
108
t. tasks[ScoveragePlugin . TEST_NAME ]. configure {
107
109
def existingClasspath = classpath
108
110
classpath = t. files(t. sourceSets[ScoveragePlugin . CONFIGURATION_NAME ]. output. classesDir) +
109
- project . configurations[ ScoveragePlugin . CONFIGURATION_NAME ] +
111
+ pluginDependencies +
110
112
existingClasspath
111
113
}
112
114
113
115
t. tasks[ScoveragePlugin . REPORT_NAME ]. configure {
114
- classpath = project. buildscript. configurations. classpath +
115
- project. configurations[ScoveragePlugin . CONFIGURATION_NAME ]
116
+ classpath = project. buildscript. configurations. classpath + configuration
116
117
main = ' org.scoverage.ScoverageReport'
117
118
args = [
118
119
extension. sources,
0 commit comments