@@ -54,7 +54,7 @@ class ScoverageExtension {
54
54
description = ' Scoverage dependencies'
55
55
}
56
56
57
- def mainSourceSet = project. sourceSets. create(' scoverage' ) {
57
+ def instrumentedSourceSet = project. sourceSets. create(' scoverage' ) {
58
58
def original = project. sourceSets. getByName(SourceSet . MAIN_SOURCE_SET_NAME )
59
59
60
60
resources. source(original. resources)
@@ -65,35 +65,23 @@ class ScoverageExtension {
65
65
runtimeClasspath = it. output + project. configurations. scoverage + original. runtimeClasspath
66
66
}
67
67
68
- def testSourceSet = project. sourceSets. create(' testScoverage' ) {
69
- def original = project. sourceSets. getByName(SourceSet . TEST_SOURCE_SET_NAME )
70
-
71
- java. source(original. java)
72
- resources. source(original. resources)
73
- scala. source(original. scala)
74
-
75
- compileClasspath = mainSourceSet. output + original. compileClasspath
76
- runtimeClasspath = it. output + mainSourceSet. output + project. configurations. scoverage + original. runtimeClasspath
77
- }
78
-
79
68
def scoverageJar = project. tasks. create(' jarScoverage' , Jar . class) {
80
69
dependsOn(' scoverageClasses' )
81
70
classifier = ScoveragePlugin . CONFIGURATION_NAME
82
- from mainSourceSet . output
71
+ from instrumentedSourceSet . output
83
72
}
84
73
project. artifacts {
85
74
scoverage scoverageJar
86
75
}
87
76
88
77
project. tasks. create(ScoveragePlugin . TEST_NAME , Test . class) {
89
- conventionMapping. map(" testClassesDir" , new Callable<Object > () {
90
- Object call () throws Exception {
91
- return testSourceSet. output. classesDir
92
- }
93
- })
94
78
conventionMapping. map(" classpath" , new Callable<Object > () {
95
79
Object call () throws Exception {
96
- return testSourceSet. runtimeClasspath
80
+ def testSourceSet = project. sourceSets. getByName(SourceSet . TEST_SOURCE_SET_NAME )
81
+ return testSourceSet. output +
82
+ instrumentedSourceSet. output +
83
+ project. configurations. scoverage +
84
+ testSourceSet. runtimeClasspath
97
85
}
98
86
})
99
87
}
0 commit comments