@@ -54,7 +54,7 @@ class ScoverageExtension {
5454 description = ' Scoverage dependencies'
5555 }
5656
57- def mainSourceSet = project. sourceSets. create(' scoverage' ) {
57+ def instrumentedSourceSet = project. sourceSets. create(' scoverage' ) {
5858 def original = project. sourceSets. getByName(SourceSet . MAIN_SOURCE_SET_NAME )
5959
6060 resources. source(original. resources)
@@ -65,35 +65,23 @@ class ScoverageExtension {
6565 runtimeClasspath = it. output + project. configurations. scoverage + original. runtimeClasspath
6666 }
6767
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-
7968 def scoverageJar = project. tasks. create(' jarScoverage' , Jar . class) {
8069 dependsOn(' scoverageClasses' )
8170 classifier = ScoveragePlugin . CONFIGURATION_NAME
82- from mainSourceSet . output
71+ from instrumentedSourceSet . output
8372 }
8473 project. artifacts {
8574 scoverage scoverageJar
8675 }
8776
8877 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- })
9478 conventionMapping. map(" classpath" , new Callable<Object > () {
9579 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
9785 }
9886 })
9987 }
0 commit comments