Add coverage task ()

To be ran manually as needed.
This commit is contained in:
modmuss50 2022-11-24 15:04:21 +00:00 committed by GitHub
parent 6605894492
commit 168b712abd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,6 +9,7 @@ plugins {
id "eclipse"
id "idea"
id "maven-publish"
id 'jacoco'
id "fabric-loom" version "1.0.12" apply false
id "com.diffplug.spotless" version "6.11.0"
id "org.ajoberstar.grgit" version "3.1.0"
@ -372,10 +373,50 @@ loom {
name "Auto Test Client"
vmArg "-Dfabric.autoTest"
}
// Create duplicate tasks for this, as jacoco slows things down a bit
gametestCoverage {
inherit gametest
name "Game Test Coverage"
ideConfigGenerated = false
}
autoTestClientCoverage {
inherit autoTestClient
name "Auto Test Client Coverage"
ideConfigGenerated = false
}
}
}
test.dependsOn runGametest
def coverageTasks = [runGametestCoverage, runAutoTestClientCoverage]
jacoco {
coverageTasks.forEach {
applyTo it
}
}
task coverage(type: JacocoReport, dependsOn: coverageTasks) {
coverageTasks.forEach {
executionData it
}
// Add all source as input
allprojects { p ->
if (p.path.startsWith(":deprecated")) return
sourceSets p.sourceSets.main, p.sourceSets.client, p.sourceSets.testmod
}
// Exclude mixins
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: '**/mixin/**')
}))
}
}
configurations {
productionRuntime {
extendsFrom configurations.minecraftLibraries