Skip to content

Convert some build file to kotlin dsl #8743

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions remote-config/remote-config-api/build.gradle

This file was deleted.

7 changes: 7 additions & 0 deletions remote-config/remote-config-api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apply(from = "$rootDir/gradle/java.gradle")

val excludedClassesBranchCoverage by extra(
listOf(
"datadog.remoteconfig.ConfigurationChangesListener.PollingHinterNoop"
)
)
31 changes: 0 additions & 31 deletions remote-config/remote-config-core/build.gradle

This file was deleted.

43 changes: 43 additions & 0 deletions remote-config/remote-config-core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
plugins {
`java-library`
}

apply(from = "$rootDir/gradle/java.gradle")

val minimumBranchCoverage by extra(0.6)
val minimumInstructionCoverage by extra(0.8)
val excludedClassesCoverage by extra(
listOf(
// not used yet
"datadog.remoteconfig.tuf.RemoteConfigRequest.ClientInfo.AgentInfo",
// only half the adapter interface used
"datadog.remoteconfig.tuf.InstantJsonAdapter",
// idem
"datadog.remoteconfig.tuf.RawJsonAdapter",
"datadog.remoteconfig.ExceptionHelper",
)
)
val excludedClassesBranchCoverage by extra(
listOf(
"datadog.remoteconfig.tuf.FeaturesConfig",
"datadog.remoteconfig.PollerRequestFactory",
)
)
val excludedClassesInstructionCoverage by extra(
listOf(
"datadog.remoteconfig.ConfigurationChangesListener.PollingHinterNoop",
)
)

dependencies {
api(project(":remote-config:remote-config-api"))

implementation(libs.slf4j)
implementation(libs.okhttp)
implementation(libs.moshi)
implementation(libs.bundles.cafe.crypto)

implementation(project(":internal-api"))

testImplementation(project(":utils:test-utils"))
}
56 changes: 0 additions & 56 deletions telemetry/build.gradle

This file was deleted.

59 changes: 59 additions & 0 deletions telemetry/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
plugins {
id("me.champeau.jmh")
id("java-library")
}

apply(from = "$rootDir/gradle/java.gradle")

val minimumBranchCoverage by extra(0.6)
val minimumInstructionCoverage by extra(0.8)
val excludedClassesCoverage by extra(
listOf(
"datadog.telemetry.TelemetryRunnable.ThreadSleeperImpl",
"datadog.telemetry.HostInfo",
"datadog.telemetry.HostInfo.Os",
"datadog.telemetry.dependency.LocationsCollectingTransformer",
"datadog.telemetry.dependency.JbossVirtualFileHelper",
"datadog.telemetry.RequestBuilder.NumberJsonAdapter",
"datadog.telemetry.RequestBuilderSupplier",
"datadog.telemetry.TelemetrySystem",
"datadog.telemetry.api.*",
"datadog.telemetry.metric.CiVisibilityMetricPeriodicAction"
)
)
val excludedClassesBranchCoverage by extra(
listOf(
"datadog.telemetry.PolymorphicAdapterFactory.1",
"datadog.telemetry.HostInfo",
"datadog.telemetry.HostInfo.Os"
)
)
val excludedClassesInstructionCoverage by extra(emptyList<String>())

dependencies {
implementation(libs.slf4j)

implementation(project(":internal-api"))

compileOnly(project(":dd-java-agent:agent-tooling"))
testImplementation(project(":dd-java-agent:agent-tooling"))
testImplementation(project(":dd-java-agent:agent-logging"))

compileOnly(project(":communication"))
testImplementation(project(":communication"))

compileOnly(project(":utils:container-utils"))
testImplementation(project(":utils:container-utils"))

api(libs.okhttp)
api(libs.moshi)

testImplementation(project(":utils:test-utils"))
testImplementation(group = "org.hamcrest", name = "hamcrest", version = "2.2")
testImplementation(group = "org.jboss", name = "jboss-vfs", version = "3.2.16.Final")
}

jmh {
jmhVersion = "1.28"
duplicateClassesStrategy = DuplicatesStrategy.EXCLUDE
}
7 changes: 0 additions & 7 deletions utils/container-utils/build.gradle

This file was deleted.

11 changes: 11 additions & 0 deletions utils/container-utils/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
plugins {
`java-library`
}

apply(from = "$rootDir/gradle/java.gradle")

dependencies {
implementation(libs.slf4j)

testImplementation(project(":utils:test-utils"))
}
31 changes: 0 additions & 31 deletions utils/socket-utils/build.gradle

This file was deleted.

41 changes: 41 additions & 0 deletions utils/socket-utils/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import de.thetaphi.forbiddenapis.gradle.CheckForbiddenApis
import groovy.lang.Closure
import org.gradle.kotlin.dsl.extra

plugins {
`java-library`
idea
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any idea why this one have idea specifically enabled?

Copy link
Contributor Author

@bric3 bric3 Jun 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to force the jdk to 17 for this module. It was used before.

In order to not break anything at this point, so I kept the configuration. We can revisit this later.

}

val minJavaVersionForTests by extra(JavaVersion.VERSION_17)

apply(from = "$rootDir/gradle/java.gradle")

dependencies {
implementation(libs.slf4j)
implementation(project(":internal-api"))
implementation(libs.jnr.unixsocket)
testImplementation(files(sourceSets["main_java17"].output))
}

tasks.named<CheckForbiddenApis>("forbiddenApisMain_java17") {
failOnMissingClasses = false
}

fun AbstractCompile.setJavaVersion(javaVersionInteger: Int) {
(project.extra.get("setJavaVersion") as Closure<*>).call(this, javaVersionInteger)
}

listOf("compileMain_java17Java", "compileTestJava").forEach {
tasks.named<JavaCompile>(it).configure {
setJavaVersion(17)
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
targetCompatibility = JavaVersion.VERSION_1_8.toString()
}
}

idea {
module {
jdkName = "17"
}
}
12 changes: 0 additions & 12 deletions utils/test-agent-utils/decoder/build.gradle

This file was deleted.

19 changes: 19 additions & 0 deletions utils/test-agent-utils/decoder/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
plugins {
`java-library`
}

apply(from = "$rootDir/gradle/java.gradle")

val minimumInstructionCoverage by extra(0.8)
val excludedClassesCoverage by extra(
listOf(
"datadog.trace.test.agent.decoder.v04.raw.*",
"datadog.trace.test.agent.decoder.v05.raw.*",
)
)

dependencies {
implementation(group = "org.msgpack", name = "msgpack-core", version = "0.8.24")
testImplementation(libs.bundles.junit5)
testImplementation(libs.truth)
}
15 changes: 0 additions & 15 deletions utils/test-utils/build.gradle

This file was deleted.

19 changes: 19 additions & 0 deletions utils/test-utils/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
plugins {
`java-library`
}

apply(from = "$rootDir/gradle/java.gradle")

dependencies {
api(libs.groovy)
api(libs.bundles.spock)

api(libs.bytebuddy)
api(libs.bytebuddyagent)

api(group = "com.github.stefanbirkner", name = "system-rules", version = "1.19.0")
api(group = "commons-fileupload", name = "commons-fileupload", version = "1.5")

compileOnly(libs.logback.core)
compileOnly(libs.logback.classic)
}
12 changes: 0 additions & 12 deletions utils/time-utils/build.gradle

This file was deleted.

16 changes: 16 additions & 0 deletions utils/time-utils/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
plugins {
`java-library`
}

apply(from = "$rootDir/gradle/java.gradle")

val excludedClassesCoverage by extra(
listOf(
"datadog.trace.api.time.ControllableTimeSource:",
"datadog.trace.api.time.SystemTimeSource"
)
)

dependencies {
testImplementation(project(":utils:test-utils"))
}
Loading