Skip to content

Commit

Permalink
Configure JaCoCo
Browse files Browse the repository at this point in the history
  • Loading branch information
hayarobi committed Oct 7, 2024
1 parent 3a6d008 commit 4186274
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 13 deletions.
2 changes: 0 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ def javaLibraryProjects = [
project('client:smart-contract')
]

apply from: 'gradle/jacoco.gradle'

subprojects {
apply plugin: 'java'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ tasks.withType(JavaCompile) {
}


// versions of commonly dependent libraries. NOTE: versions of libraries is decleared in gradle.properties
ext {
}

/* idea */
idea {
module {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {

// Apply the java-library plugin for API and implementation separation.
id 'java-library'
id 'jacoco' // coverage
id 'jacoco' // coverage
id 'checkstyle'
id 'maven-publish' // maven
id 'signing' //
Expand All @@ -19,6 +19,7 @@ def projectBaseName = 'heraj-' + project.name

// test configuration
test {

if (java.toolchain.languageVersion.get().canCompileOrRun(JavaLanguageVersion.of("9"))) {
jvmArgs('--add-opens', 'java.base/java.lang=ALL-UNNAMED')
jvmArgs('--add-opens', 'java.base/java.lang.reflect=ALL-UNNAMED')
Expand Down Expand Up @@ -181,6 +182,12 @@ jacocoTestReport {
xml.required = true
html.required = true
}

afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: ['**/types/**'])
}))
}
}

task coverage {
Expand Down
4 changes: 0 additions & 4 deletions core/protobuf/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ protobuf {
}
}

test {
enabled = false
}

// FIXME: custom disable options, it don't like it
tasks.withType(Javadoc).all { enabled = false }

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ targetJavaVersion=1.8

# build utils
checkstyleVersion=8.45.1
jacocoVersion=0.8.9
jacocoVersion=0.8.12
jmhPluginVersion=0.6.6
jmhReportVersion=0.8.0
shadowJarVersion=8.3.2
Expand Down
12 changes: 11 additions & 1 deletion report/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,27 @@ repositories {
}

dependencies {
jacocoAggregation project(':client:smart-contract'),project(':client:wallet') // <.>
jacocoAggregation([
project(':client:smart-contract'),
project(':client:wallet')
])
}

reporting {
reports {
testCodeCoverageReport(JacocoCoverageReport) { // <.>
testType = TestSuiteType.UNIT_TEST

def classDirectories = reportTask.get().classDirectories
classDirectories.setFrom(
classDirectories.files.collect {
fileTree(dir: it, exclude: ['types/**'])
})
}
}
}


tasks.named('check') {
dependsOn tasks.named('testCodeCoverageReport', JacocoReport) // <.>
}

0 comments on commit 4186274

Please sign in to comment.