[GitHub] markusthoemmes commented on a change in pull request #3249: #3243 - Use gradle scoverage to collect test coverage stats

2018-04-04 Thread GitBox
markusthoemmes commented on a change in pull request #3249: #3243 - Use gradle 
scoverage to collect test coverage stats
URL: 
https://github.com/apache/incubator-openwhisk/pull/3249#discussion_r179364082
 
 

 ##
 File path: tests/build.gradle
 ##
 @@ -93,7 +102,63 @@ task createKeystore(dependsOn: deleteKeystore) {
 }
 
 afterEvaluate {
+task testCoverageLean(type:Test) {
+classpath = getScoverageClasspath(project)
+exclude leanExcludes
+}
+
+task testCoverage(type:Test){
+classpath = getScoverageClasspath(project)
+}
 tasks.withType(Test) {
 dependsOn createKeystore
 }
 }
+
+/**
+ * Task to generate coverage xml report. Requires the
+ * tests to be executed prior to its invocation
+ */
+task reportCoverage(type: ScoverageReport){
+dependsOn([
+':common:scala:reportScoverage',
+':core:controller:reportScoverage',
+':core:invoker:reportScoverage'
+])
+}
+
+/**
+ * Aggregates the scoverage xml reports from various modules into a
+ * single report
+ */
+task aggregateCoverage(type: JavaExec, dependsOn: reportCoverage) {
+//Taken from ScoverageAggregate
+main = 'org.scoverage.AggregateReportApp'
+classpath = project.extensions.scoverage.pluginClasspath
+args = [
+project.rootProject.projectDir, //Use the root project path so as 
to "see" all source paths
+new File(project.buildDir, 'scoverage-aggregate'),
+false, //Clean scoverage report post process
+true,  //coverageOutputCobertura
+true,  //coverageOutputXML
+true,  //coverageOutputHTML
+false  //coverageDebug
+]
+}
+
+/**
+ * Prepares the classpath which refer to scoverage instrumented classes from
+ * dependent projects "before" the non instrumented classes
+ */
+def getScoverageClasspath(Project project){
 
 Review comment:
   Please put a space in front of the `{` in all occurences.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] markusthoemmes commented on a change in pull request #3249: #3243 - Use gradle scoverage to collect test coverage stats

2018-04-04 Thread GitBox
markusthoemmes commented on a change in pull request #3249: #3243 - Use gradle 
scoverage to collect test coverage stats
URL: 
https://github.com/apache/incubator-openwhisk/pull/3249#discussion_r179363047
 
 

 ##
 File path: tools/travis/build.sh
 ##
 @@ -66,10 +66,12 @@ $ANSIBLE_CMD openwhisk.yml
 
 cd $ROOTDIR
 cat whisk.properties
-TERM=dumb ./gradlew :tests:testLean $GRADLE_PROJS_SKIP
+TERM=dumb ./gradlew tests:testCoverageLean :tests:reportCoverage
 
 Review comment:
   Is the leading colon not needed?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] markusthoemmes commented on a change in pull request #3249: #3243 - Use gradle scoverage to collect test coverage stats

2018-04-04 Thread GitBox
markusthoemmes commented on a change in pull request #3249: #3243 - Use gradle 
scoverage to collect test coverage stats
URL: 
https://github.com/apache/incubator-openwhisk/pull/3249#discussion_r179362526
 
 

 ##
 File path: settings.gradle
 ##
 @@ -29,3 +29,8 @@ gradle.ext.scalafmt = [
 version: '1.5.0',
 config: new File(rootProject.projectDir, '.scalafmt.conf')
 ]
+
+gradle.ext.scoverage = [
+deps: ['org.scoverage:scalac-scoverage-plugin_2.11:1.3.1',
+   'org.scoverage:scalac-scoverage-runtime_2.11:1.3.1']
+]
 
 Review comment:
   Please fix indentation of all lists, they all seem to be double-indented 
whereas the "old" code uses single-identation.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services