You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.
View groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
I am using the build.gradle provided by you . The issue I am facing is that the source files are not being picked up. The clover directory is not getting created and hence the report is not getting generated. The command I am using is ./gradlew clean test cloverInstr cloverReport.
Could you please help me . My project structure is:
Root Project A (child) B (child) C (child)
apply plugin: 'java' apply plugin: 'maven' repositories { jcenter() maven { url "Our internal repo" } } dependencies { testCompile 'junit:junit:4.12' } buildscript { repositories { jcenter() // mavenCentral() //mavenLocal() maven { url "our internal repo" } } dependencies { classpath 'com.atlassian.clover:clover:4.1.1' } } sourceSets { clover { java { srcDir "$buildDir/sources-instr" } } } dependencies { cloverCompile 'com.atlassian.clover:clover:4.1.1' } configurations { cloverRuntime cloverRuntime.extendsFrom cloverCompile } task cloverInstr() { inputs.files sourceSets.main.allJava println "The source set is" println "${sourceSets.main}" outputs.dir "$buildDir/sources-instr" doFirst { def argsList = ["--initstring", "${buildDir}/clover/clover.db", "-d", "${buildDir}/sources-instr"] argsList.addAll(inputs.files.files.collect({ file -> file.absolutePath println "In doFirts" })) String[] args = argsList.toArray() println "the args list is" println "${args}" com.atlassian.clover.CloverInstr.mainImpl(args) } } cloverClasses.dependsOn cloverInstr test { def cloverClasspath = configurations.testRuntime + configurations.cloverRuntime + sourceSets.test.output + sourceSets.clover.output classpath = cloverClasspath } allprojects { task cloverReport { inputs.dir "${buildDir}/clover" outputs.dir "${reportsDir}/clover" onlyIf { file("${buildDir}/clover/clover.db").exists() } doFirst { def argsList = ["--initstring", "${buildDir}/clover/clover.db", "-o", "${reportsDir}/clover"] String[] args = argsList.toArray() com.atlassian.clover.reporters.html.HtmlReporter.runReport(args) } } }
Hi, you should do the source instrumentation before testing it. I think the implicit dependencies between outputs of cloverInstr and inputs of test should handle it, but potentially they don't
I would try running
./gradlew clean cloverInstr test cloverReport
Hi Grzegorz
Thanks for your response. I ve been trying with
./gradlew clean cloverInstr test cloverReport
The clover.db is created and the instrumentation is done.
The issue that Im facing now is compilation fails for the files at source-instr files. The failure is due to the packages missing , like the import statements are not fetching the packages in the source-instr folder.
test {
def cloverClasspath = configurations.testRuntime + configurations.cloverRuntime + sourceSets.test.output + sourceSets.clover.output
classpath = cloverClasspath
}
Is there a way to to add the source-instr to the classpath
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I guess none of the main sources dependencies are picked up when you try to compile Clover sources set. So when Gradle compiles cloverSourceSet, it takes cloverCompile configuration.
And as far I can see, you don't configure any dependencies on that configuration. I think you're missing the following code snippet:
configurations {
cloverCompile.extendsFrom compile
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello everyone, I am a product manager in the Jira Cloud team focused on making sure our customers have a delightful experience using our products. Towards that goal, one of the areas which is extr...
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.