Skip to content

Commit

Permalink
[release-later] Fix Jacoco reports for fat-jar projects
Browse files Browse the repository at this point in the history
  • Loading branch information
remal committed Jan 6, 2025
1 parent 7b3bac4 commit 083ff97
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions gradle/helpers.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,23 @@ allprojects {
.collect { it.source }
})
}

tasks.withType(JacocoReportBase).configureEach { JacocoReportBase task ->
task.onlyIf {
Closure filterOutIncludedFiles = { ConfigurableFileCollection fileCollection ->
fileCollection.setFrom(
fileCollection.files
.findAll { !otherProject.sourceSets.main.allSource.srcDirs.contains(it) }
.findAll { !otherProject.sourceSets.main.output.contains(it) }
.findAll { otherProject.tasks.jar.archiveFile.get().asFile != it }
)
}
filterOutIncludedFiles(task.sourceDirectories)
filterOutIncludedFiles(task.classDirectories)
filterOutIncludedFiles(task.additionalClassDirs)
return true
}
}
}

Set<Project> fatJarWithProjects = new LinkedHashSet<>()
Expand Down

0 comments on commit 083ff97

Please sign in to comment.