Skip to content

Commit c266c57

Browse files
authored
Merge pull request #3796 from DataDog/kikoveiga/rum-18191/address-compilation-warnings
RUM-18191: Re-enable warnings-as-errors on the Compose modules
2 parents f8159e9 + d11927e commit c266c57

5 files changed

Lines changed: 36 additions & 28 deletions

File tree

features/dd-sdk-android-session-replay-compose/build.gradle.kts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
* Copyright 2016-Present Datadog, Inc.
55
*/
66

7+
import com.datadog.gradle.config.taskConfig
78
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
9+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
810

911
plugins {
1012
// Build
@@ -78,17 +80,18 @@ unMock {
7880
}
7981

8082
datadogBuild {
81-
applyKotlinConfig(
82-
// TODO RUM-18191
83-
// Suppress -> generateFunctionKeyMetaClasses is deprecated. It was replaced by emitting annotations on functions
84-
// instead. Use generateFunctionKeyMetaAnnotations instead. Seems to Compose <-> Kotlin mismatch.
85-
evaluateWarningsAsErrors = false,
86-
jvmBytecodeTarget = JvmTarget.JVM_11
87-
)
83+
applyKotlinConfig(jvmBytecodeTarget = JvmTarget.JVM_11)
8884
applyAndroidLibraryConfig()
8985
applyJunitConfig()
9086
applyJavadocConfig()
9187
applyPublishingConfig(
9288
"Session Replay Extension Support for Jetpack Compose."
9389
)
9490
}
91+
92+
taskConfig<KotlinCompile> {
93+
compilerOptions {
94+
// TODO RUM-18190
95+
freeCompilerArgs.add("-Xwarning-level=ERROR_SUPPRESSION:disabled")
96+
}
97+
}

gradle/libs.versions.toml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ cronetApi = "143.7445.0"
55
cronetPlayServices = "18.1.1"
66
gson = "2.10.1"
77
kotlin = "2.0.21"
8+
# Deliberately not `version.ref = "kotlin"`: this must match the Kotlin Gradle Plugin that is actually
9+
# loaded, which is AGP's. `androidToolsPlugin` (below) depends on KGP 2.2.10, and that outranks the
10+
# `kotlin` version above in conflict resolution (`kotlin-gradle-plugin:2.0.21 -> 2.2.10`).
11+
# The Compose *compiler* is always resolved at the loaded KGP's version and never at this one, so the
12+
# two drift apart silently. An older plugin against a newer compiler passes options the compiler has
13+
# since deprecated (RUM-18191, `generateFunctionKeyMetaClasses`), and the version also decides which
14+
# options are sent at all — 2.2.10 turns on `sourceInformation`, which changes generated Compose code.
15+
# Re-check this whenever `androidToolsPlugin` moves.
16+
composeCompilerPlugin = "2.2.10"
817
kotlinSP = "2.0.21-1.0.28"
918
kronosNTP = "0.0.1-alpha11"
1019
kotlinxSerialization = "1.6.3"
@@ -371,7 +380,7 @@ traceCore = [
371380
[plugins]
372381
nexusPublishGradlePlugin = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "nexusPublishGradlePlugin" }
373382
datadogGradlePlugin = { id = "com.datadoghq.dd-sdk-android-gradle-plugin", version.ref = "datadogPlugin" }
374-
composeCompilerPlugin = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
383+
composeCompilerPlugin = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "composeCompilerPlugin" }
375384
apolloPlugin = { id = "com.apollographql.apollo", version.ref = "apollo" }
376385
dependencyLicenseGradlePlugin = { id = "com.datadoghq.dependency-license", version.ref = "dependencyLicense" }
377386
kotlinAndroidPlugin = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }

instrumented/integration/build.gradle.kts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
import com.datadog.gradle.config.AndroidConfig
88
import com.datadog.gradle.config.depotProxied
99
import com.datadog.gradle.config.java17
10+
import com.datadog.gradle.config.taskConfig
11+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
1012

1113
plugins {
1214
// Build
@@ -145,10 +147,12 @@ dependencies {
145147
}
146148

147149
datadogBuild {
148-
applyKotlinConfig(
149-
// TODO RUM-18191
150-
// Suppress -> generateFunctionKeyMetaClasses is deprecated. It was replaced by emitting annotations on functions
151-
// instead. Use generateFunctionKeyMetaAnnotations instead. Seems to Compose <-> Kotlin mismatch.
152-
evaluateWarningsAsErrors = false
153-
)
150+
applyKotlinConfig()
151+
}
152+
153+
taskConfig<KotlinCompile> {
154+
compilerOptions {
155+
// TODO RUM-18190
156+
freeCompilerArgs.add("-Xwarning-level=ERROR_SUPPRESSION:disabled")
157+
}
154158
}

integrations/dd-sdk-android-compose/build.gradle.kts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import com.datadog.gradle.config.taskConfig
88
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
9+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
910

1011
plugins {
1112
// Build
@@ -79,13 +80,7 @@ unMock {
7980
}
8081

8182
datadogBuild {
82-
applyKotlinConfig(
83-
// TODO RUM-18191
84-
// Suppress -> generateFunctionKeyMetaClasses is deprecated. It was replaced by emitting annotations on functions
85-
// instead. Use generateFunctionKeyMetaAnnotations instead. Seems to Compose <-> Kotlin mismatch.
86-
evaluateWarningsAsErrors = false,
87-
jvmBytecodeTarget = JvmTarget.JVM_11
88-
)
83+
applyKotlinConfig(jvmBytecodeTarget = JvmTarget.JVM_11)
8984
applyAndroidLibraryConfig()
9085
applyJunitConfig()
9186
applyJavadocConfig()
@@ -95,8 +90,10 @@ datadogBuild {
9590
)
9691
}
9792

98-
taskConfig<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
93+
taskConfig<KotlinCompile> {
9994
compilerOptions {
10095
optIn.add("kotlin.RequiresOptIn")
96+
// TODO RUM-18190
97+
freeCompilerArgs.add("-Xwarning-level=ERROR_SUPPRESSION:disabled")
10198
}
10299
}

sample/benchmark/build.gradle.kts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,6 @@ dependencies {
132132
}
133133

134134
datadogBuild {
135-
applyKotlinConfig(
136-
// TODO RUM-18191
137-
// Suppress -> generateFunctionKeyMetaClasses is deprecated. It was replaced by emitting annotations on functions
138-
// instead. Use generateFunctionKeyMetaAnnotations instead. Seems to Compose <-> Kotlin mismatch.
139-
evaluateWarningsAsErrors = false
140-
)
135+
applyKotlinConfig()
141136
applyJunitConfig()
142137
}

0 commit comments

Comments
 (0)