91 lines
3.5 KiB
Groovy
91 lines
3.5 KiB
Groovy
plugins {
|
|
id "java"
|
|
}
|
|
|
|
description = "OpenTelemetry All"
|
|
ext.moduleName = "io.opentelemetry.all"
|
|
|
|
// We don't compile much here, just some API boundary tests. This project is mostly for
|
|
// aggregating jacoco reports and it doesn't work if this isn't at least as high as the
|
|
// highest supported Java version in any of our projects. Most of our projects target
|
|
// Java 8, except for jfr-events.
|
|
tasks.withType(JavaCompile) {
|
|
it.options.release = 11
|
|
}
|
|
|
|
tasks.testJava8 {
|
|
enabled = false
|
|
}
|
|
|
|
dependencies {
|
|
rootProject.subprojects.each { subproject ->
|
|
// Generate aggregate coverage report for published modules that enable jacoco.
|
|
subproject.plugins.withId("jacoco") {
|
|
subproject.plugins.withId("maven-publish") {
|
|
implementation(subproject) {
|
|
transitive = false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
testImplementation libraries.archunit
|
|
}
|
|
|
|
// https://docs.gradle.org/current/samples/sample_jvm_multi_project_with_code_coverage.html
|
|
|
|
def sourcesPath = configurations.create("sourcesPath") {
|
|
visible = false
|
|
canBeResolved = true
|
|
canBeConsumed = false
|
|
extendsFrom(configurations.implementation)
|
|
attributes {
|
|
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, Usage.JAVA_RUNTIME))
|
|
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category, Category.DOCUMENTATION))
|
|
attribute(DocsType.DOCS_TYPE_ATTRIBUTE, objects.named(DocsType, 'source-folders'))
|
|
}
|
|
}
|
|
|
|
def coverageDataPath = configurations.create("coverageDataPath") {
|
|
visible = false
|
|
canBeResolved = true
|
|
canBeConsumed = false
|
|
extendsFrom(configurations.implementation)
|
|
attributes {
|
|
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, Usage.JAVA_RUNTIME))
|
|
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category, Category.DOCUMENTATION))
|
|
attribute(DocsType.DOCS_TYPE_ATTRIBUTE, objects.named(DocsType, 'jacoco-coverage-data'))
|
|
}
|
|
}
|
|
|
|
tasks.named('jacocoTestReport', JacocoReport) {
|
|
enabled = true
|
|
|
|
configurations.runtimeClasspath.each {
|
|
additionalClassDirs(zipTree(it).filter {
|
|
// Exclude mrjar (jacoco complains), shaded, and generated code
|
|
!it.absolutePath.contains("META-INF/versions/") &&
|
|
!it.absolutePath.contains("/internal/shaded/") &&
|
|
!it.absolutePath.contains("io/opentelemetry/proto/") &&
|
|
!it.absolutePath.contains("io/opentelemetry/exporter/jaeger/proto/") &&
|
|
!it.absolutePath.contains("io/opentelemetry/sdk/extension/trace/jaeger/proto/") &&
|
|
!it.absolutePath.contains("io/opentelemetry/api/trace/attributes/SemanticAttributes") &&
|
|
!it.absolutePath.contains("io/opentelemetry/semconv/trace/attributes/SemanticAttributes") &&
|
|
!it.absolutePath.contains("AutoValue_") &&
|
|
// TODO(anuraaga): Remove exclusion after enabling coverage for jfr-events
|
|
!it.absolutePath.contains("io/opentelemetry/sdk/extension/jfr")
|
|
})
|
|
}
|
|
additionalSourceDirs(sourcesPath.incoming.artifactView { lenient(true) }.files)
|
|
executionData(coverageDataPath.incoming.artifactView { lenient(true) }.files.filter { it.exists() })
|
|
|
|
reports {
|
|
// xml is usually used to integrate code coverage with
|
|
// other tools like SonarQube, Coveralls or Codecov
|
|
xml.enabled true
|
|
|
|
// HTML reports can be used to see code coverage
|
|
// without any external tools
|
|
html.enabled true
|
|
}
|
|
}
|