Skip to content

Commit

Permalink
Format build.gradle.kts files (open-telemetry#3427)
Browse files Browse the repository at this point in the history
  • Loading branch information
trask authored Jul 29, 2021
1 parent 614668a commit 60c3c5c
Show file tree
Hide file tree
Showing 63 changed files with 1,539 additions and 1,539 deletions.
130 changes: 65 additions & 65 deletions all/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,94 +1,94 @@
plugins {
id("otel.java-conventions")
id("otel.java-conventions")
}

description = "OpenTelemetry All"
otelJava.moduleName.set("io.opentelemetry.all")

tasks {
// 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.
withType(JavaCompile::class) {
options.release.set(11)
}
// 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.
withType(JavaCompile::class) {
options.release.set(11)
}

val testJavaVersion: String? by project
if (testJavaVersion == "8") {
test {
enabled = false
}
val testJavaVersion: String? by project
if (testJavaVersion == "8") {
test {
enabled = false
}
}
}

dependencies {
rootProject.subprojects.forEach { subproject ->
// Generate aggregate coverage report for published modules that enable jacoco.
subproject.plugins.withId("jacoco") {
subproject.plugins.withId("maven-publish") {
implementation(project(subproject.path)) {
isTransitive = false
}
}
rootProject.subprojects.forEach { subproject ->
// Generate aggregate coverage report for published modules that enable jacoco.
subproject.plugins.withId("jacoco") {
subproject.plugins.withId("maven-publish") {
implementation(project(subproject.path)) {
isTransitive = false
}
}
}
testImplementation("com.tngtech.archunit:archunit-junit4")
}
testImplementation("com.tngtech.archunit:archunit-junit4")
}

// https://docs.gradle.org/current/samples/sample_jvm_multi_project_with_code_coverage.html

val sourcesPath by configurations.creating {
isVisible = false
isCanBeResolved = true
isCanBeConsumed = false
extendsFrom(configurations.implementation.get())
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME))
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.DOCUMENTATION))
attribute(DocsType.DOCS_TYPE_ATTRIBUTE, objects.named("source-folders"))
}
isVisible = false
isCanBeResolved = true
isCanBeConsumed = false
extendsFrom(configurations.implementation.get())
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME))
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.DOCUMENTATION))
attribute(DocsType.DOCS_TYPE_ATTRIBUTE, objects.named("source-folders"))
}
}

val coverageDataPath by configurations.creating {
isVisible = false
isCanBeResolved = true
isCanBeConsumed = false
extendsFrom(configurations.implementation.get())
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME))
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.DOCUMENTATION))
attribute(DocsType.DOCS_TYPE_ATTRIBUTE, objects.named("jacoco-coverage-data"))
}
isVisible = false
isCanBeResolved = true
isCanBeConsumed = false
extendsFrom(configurations.implementation.get())
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME))
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.DOCUMENTATION))
attribute(DocsType.DOCS_TYPE_ATTRIBUTE, objects.named("jacoco-coverage-data"))
}
}

tasks.named<JacocoReport>("jacocoTestReport") {
enabled = true
enabled = true

configurations.runtimeClasspath.get().forEach {
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/semconv/trace/attributes/") &&
!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() })
configurations.runtimeClasspath.get().forEach {
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/semconv/trace/attributes/") &&
!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.required.set(true)
reports {
// xml is usually used to integrate code coverage with
// other tools like SonarQube, Coveralls or Codecov
xml.required.set(true)

// HTML reports can be used to see code coverage
// without any external tools
html.required.set(true)
}
// HTML reports can be used to see code coverage
// without any external tools
html.required.set(true)
}
}
16 changes: 8 additions & 8 deletions api/all/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
plugins {
id("otel.java-conventions")
id("otel.publish-conventions")
id("otel.java-conventions")
id("otel.publish-conventions")

id("otel.jmh-conventions")
id("otel.animalsniffer-conventions")
id("otel.jmh-conventions")
id("otel.animalsniffer-conventions")
}

description = "OpenTelemetry API"
otelJava.moduleName.set("io.opentelemetry.api")
base.archivesBaseName = "opentelemetry-api"

dependencies {
api(project(":context"))
api(project(":context"))

annotationProcessor("com.google.auto.value:auto-value")
annotationProcessor("com.google.auto.value:auto-value")

testImplementation("edu.berkeley.cs.jqf:jqf-fuzz")
testImplementation("com.google.guava:guava-testlib")
testImplementation("edu.berkeley.cs.jqf:jqf-fuzz")
testImplementation("com.google.guava:guava-testlib")
}
14 changes: 7 additions & 7 deletions api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
subprojects {
// Workaround https://github.com/gradle/gradle/issues/847
group = "io.opentelemetry.api"
val proj = this
plugins.withId("java") {
configure<BasePluginConvention> {
archivesBaseName = "opentelemetry-api-${proj.name}"
}
// Workaround https://github.com/gradle/gradle/issues/847
group = "io.opentelemetry.api"
val proj = this
plugins.withId("java") {
configure<BasePluginConvention> {
archivesBaseName = "opentelemetry-api-${proj.name}"
}
}
}
16 changes: 8 additions & 8 deletions api/metrics/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
plugins {
id("otel.java-conventions")
id("otel.publish-conventions")
id("otel.java-conventions")
id("otel.publish-conventions")

id("otel.jmh-conventions")
id("otel.animalsniffer-conventions")
id("otel.jmh-conventions")
id("otel.animalsniffer-conventions")
}

description = "OpenTelemetry API"
otelJava.moduleName.set("io.opentelemetry.api.metrics")

dependencies {
api(project(":api:all"))
api(project(":api:all"))

annotationProcessor("com.google.auto.value:auto-value")
annotationProcessor("com.google.auto.value:auto-value")

testImplementation("edu.berkeley.cs.jqf:jqf-fuzz")
testImplementation("com.google.guava:guava-testlib")
testImplementation("edu.berkeley.cs.jqf:jqf-fuzz")
testImplementation("com.google.guava:guava-testlib")
}
32 changes: 16 additions & 16 deletions bom-alpha/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
plugins {
id("java-platform")
id("otel.publish-conventions")
id("java-platform")
id("otel.publish-conventions")
}

description = "OpenTelemetry Bill of Materials (Alpha)"
group = "io.opentelemetry"
base.archivesBaseName = "opentelemetry-bom-alpha"

rootProject.subprojects.forEach { subproject ->
if (!project.name.startsWith("bom")) {
evaluationDependsOn(subproject.path)
}
if (!project.name.startsWith("bom")) {
evaluationDependsOn(subproject.path)
}
}

afterEvaluate {
dependencies {
constraints {
rootProject.subprojects
.sortedBy { it.findProperty("archivesBaseName") as String? }
.filter { !it.name.startsWith("bom") }
.filter { it.findProperty("otel.release") == "alpha" }
.forEach { project ->
project.plugins.withId("maven-publish") {
api(project)
}
}
dependencies {
constraints {
rootProject.subprojects
.sortedBy { it.findProperty("archivesBaseName") as String? }
.filter { !it.name.startsWith("bom") }
.filter { it.findProperty("otel.release") == "alpha" }
.forEach { project ->
project.plugins.withId("maven-publish") {
api(project)
}
}
}
}
}
32 changes: 16 additions & 16 deletions bom/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
plugins {
id("java-platform")
id("otel.publish-conventions")
id("java-platform")
id("otel.publish-conventions")
}

description = "OpenTelemetry Bill of Materials"
group = "io.opentelemetry"
base.archivesBaseName = "opentelemetry-bom"

rootProject.subprojects.forEach { subproject ->
if (project != subproject) {
evaluationDependsOn(subproject.path)
}
if (project != subproject) {
evaluationDependsOn(subproject.path)
}
}

afterEvaluate {
dependencies {
constraints {
rootProject.subprojects
.sortedBy { it.findProperty("archivesBaseName") as String? }
.filter { !it.name.startsWith("bom")}
.filter { !it.hasProperty("otel.release") }
.forEach { project ->
project.plugins.withId("maven-publish") {
api(project)
}
}
dependencies {
constraints {
rootProject.subprojects
.sortedBy { it.findProperty("archivesBaseName") as String? }
.filter { !it.name.startsWith("bom") }
.filter { !it.hasProperty("otel.release") }
.forEach { project ->
project.plugins.withId("maven-publish") {
api(project)
}
}
}
}
}
Loading

0 comments on commit 60c3c5c

Please sign in to comment.