@@ -15,6 +15,8 @@ plugins {
1515 id ' org.jmailen.kotlinter' version " $kotlinLinterVer "
1616 id ' maven-publish'
1717 id ' com.github.johnrengelman.shadow' version ' 8.1.1'
18+ id ' org.sonarqube' version " 5.1.0.4882"
19+ id ' jacoco'
1820}
1921
2022allprojects {
@@ -30,6 +32,7 @@ subprojects {
3032 apply plugin : ' org.jetbrains.kotlin.jvm'
3133 apply plugin : ' org.jmailen.kotlinter'
3234 apply plugin : ' com.github.johnrengelman.shadow'
35+ apply plugin : ' jacoco'
3336
3437 publishing {
3538 publications {
@@ -53,10 +56,6 @@ subprojects {
5356 group = ' jp.co.soramitsu.iroha2-java'
5457 version = ' git rev-parse --short HEAD' . execute(). text. trim()
5558
56- test {
57- useJUnitPlatform()
58- }
59-
6059 java {
6160 toolchain {
6261 languageVersion = JavaLanguageVersion . of(8 )
@@ -96,6 +95,36 @@ subprojects {
9695 // uncomment to produce shadowJar build by default
9796 // it is disabled by default to publish original version by CI, not a fat jar
9897 tasks. shadowJar. enabled = false
98+
99+ test {
100+ useJUnitPlatform()
101+ }
102+
103+ jacocoTestReport {
104+ reports {
105+ xml. required = true
106+ }
107+ }
108+
109+ plugins. withType(JacocoPlugin ) {
110+ tasks[" test" ]. finalizedBy ' jacocoTestReport'
111+ }
112+
113+ sonar {
114+ properties {
115+ property " sonar.projectKey" , " iroha-java"
116+ property " sonar.host.url" , " https://sonar.katana.soramitsu.co.jp"
117+ property " sonar.java.coveragePlugin" , " jacoco"
118+ property " sonar.projectName" , " ${ project.group} :${ rootProject.name} .${ project.name} "
119+ property " sonar.sources" , " ${ project.projectDir} /src/main/kotlin"
120+ // exclude projects with no tests
121+ if (project. name != " codegen" && project. name != " model" && project. name != " tutorial" ) {
122+ property " sonar.tests" , " ${ project.projectDir} /src/test"
123+ }
124+ property " sonar.java.test.binaries" , " ${ project.projectDir} /build/test-results/test/binary"
125+ property " sonar.junit.reportPaths" , " ${ project.projectDir} /build/test-results/test/"
126+ }
127+ }
99128}
100129
101130task allShadowJars {
0 commit comments