Skip to content

Commit 01a7ce9

Browse files
committed
RUM-16370: Support Android API 37
1 parent e3454f4 commit 01a7ce9

190 files changed

Lines changed: 696 additions & 687 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitlab-ci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ variables:
2020

2121
CACHE_FALLBACK_KEY: "develop"
2222

23+
# Unify the Gradle user home across ALL jobs so every Gradle invocation shares one
24+
# GitLab-cacheable location ($CI_PROJECT_DIR/cache) instead of some jobs using the default,
25+
# non-cached /root/.gradle. Jobs that pass --gradle-user-home cache/ already match this.
26+
GRADLE_USER_HOME: "$CI_PROJECT_DIR/cache"
27+
2328
# Magic Mirror Depot proxy URLs. The depot proxies both Maven Central and the Gradle
2429
# Plugin Portal for the Java ecosystem from the same endpoint. Setting these routes
2530
# dependency/plugin resolution through Datadog's internal mirror to avoid HTTP 429

LICENSE-3rdparty.csv

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ import,androidx.versionedparcelable,Apache-2.0,Copyright 2018 The Android Open S
5252
import,androidx.viewpager,Apache-2.0,Copyright 2018 The Android Open Source Project
5353
import,androidx.wear,Apache-2.0,Copyright 2018 The Android Open Source Project
5454
import,androidx.work,Apache-2.0,Copyright 2018 The Android Open Source Project
55+
import,app.cash.sql-psi,Apache-2.0,"Copyright 2016 Square, Inc"
56+
import,app.cash.sqldelight,Apache-2.0,"Copyright 2016 Square, Inc"
5557
import,com.android.tools,Apache-2.0,Copyright 2018 The Android Open Source Project
5658
import,com.apollographql.apollo,MIT,"Copyright (c) 2016-2024 Apollo Graph, Inc. (Formerly Meteor Development Group, Inc.)"
5759
import,com.benasher44,MIT,"Copyright (c) 2019 Ben Asher"
@@ -140,6 +142,7 @@ import(test),com.jakewharton.android.repackaged,Apache-2.0,"Copyright (C) 2007 T
140142
import(test),com.parse.bolts,"BSD License","Copyright (c) Facebook, Inc. and its affiliates."
141143
import(test),com.squareup,Apache-2.0,"Copyright 2015 Square, Inc."
142144
import(test),dev.drewhamilton.poko,Apache-2.0,Copyright 2020-Present Drew Hamilton
145+
import(test),dev.zacsweers.kctfork,MPL-2.0,Copyright (C) 2022 Zac Sweers
143146
import(test),greatest,ICT,"Copyright (c) 2011-2018 Scott Vokes <vokes.s@gmail.com>"
144147
import(test),io.github.davidburstrom.contester,Apache-2.0,"Copyright 2022-2024 David Burström"
145148
import(test),io.github.detekt.sarif4k,Apache-2.0,"Copyright 2021 Artur Bosch & Contributors"
@@ -184,7 +187,6 @@ build,com.fasterxml.jackson.dataformat,Apache-2.,"Copyright (c) 2007- Tatu Salor
184187
build,com.fasterxml.jackson.module,Apache-2.0,"Copyright (c) 2007- Tatu Saloranta"
185188
build,com.fasterxml.woodstox,Apache-2.0,"Copyright (c) 2007- Tatu Saloranta"
186189
build,com.github.ajalt.clikt,Apache-2.0,"Copyright clikt authors"
187-
build,com.github.tschuchortdev,MPL-2.0,"Copyright (C) 2023 Thilo Schuchort"
188190
build,com.google.android,Apache-2.0,Copyright (C) 2013 The Android Open Source Project
189191
build,com.google.api.grpc,Apache-2.0,Copyright 2020 Google LLC
190192
build,com.google.auto,Apache-2.0,"Copyright 2014 Google LLC"
@@ -210,6 +212,7 @@ build,commons-io,Apache-2.0,Copyright 2002-2024 The Apache Software Foundation
210212
build,commons-logging,Apache-2.0,Copyright 2002-2024 The Apache Software Foundation
211213
build,io.github.aakira,Apache-2.0,"Copyright (C) 2019 A.Akira"
212214
build,io.github.classgraph,MIT,"Copyright (c) 2019 Luke Hutchison"
215+
build,io.github.java-diff-utils,Apache-2.0,"Copyright java-diff-utils contributors"
213216
build,io.github.microutils,Apache-2.0,Copyright (c) 2016-2018 Ohad Shai
214217
build,io.github.oshai,Apache-2.0,"Copyright oshai authors"
215218
build,io.gitlab.arturbosch.detekt,Apache-2.0,Copyright 2016-2019 the original author or authors

build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ plugins {
2727
// don't add these to the classpath, otherwise there will be a conflict, because they are already coming
2828
// from buildSrc classpath. May be solved with convention plugins though.
2929
// alias(libs.plugins.androidLibraryPlugin) apply false
30-
// alias(libs.plugins.kotlinAndroidPlugin) apply false
3130
// alias(libs.plugins.dokkaGradlePlugin) apply false
3231
// alias(libs.plugins.versionsGradlePlugin) apply false
3332
}

buildSrc/src/main/kotlin/com/datadog/gradle/config/AndroidConfig.kt

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,23 @@ package com.datadog.gradle.config
88

99
import com.android.build.api.dsl.CompileOptions
1010
import com.android.build.api.dsl.LibraryExtension
11+
import com.android.build.api.variant.HostTestBuilder
12+
import com.android.build.api.variant.LibraryAndroidComponentsExtension
13+
import com.android.build.api.variant.LibraryVariantBuilder
1114
import com.datadog.gradle.utils.Version
1215
import org.gradle.api.JavaVersion
1316
import org.gradle.api.Project
1417

1518
object AndroidConfig {
1619

17-
const val TARGET_SDK = 36
20+
const val TARGET_SDK = 37
1821
const val MIN_SDK = 23
1922
const val MIN_SDK_FOR_AUTO = 29
20-
const val BUILD_TOOLS_VERSION = "36.0.0"
23+
const val BUILD_TOOLS_VERSION = "37.0.0"
2124

2225
val VERSION = Version(3, 13, 0, Version.Type.Snapshot)
2326
}
2427

25-
// TODO RUM-628 Switch to Java 17 bytecode
26-
fun CompileOptions.java11() {
27-
sourceCompatibility = JavaVersion.VERSION_11
28-
targetCompatibility = JavaVersion.VERSION_11
29-
}
30-
3128
fun CompileOptions.java17() {
3229
sourceCompatibility = JavaVersion.VERSION_17
3330
targetCompatibility = JavaVersion.VERSION_17
@@ -43,17 +40,16 @@ fun Project.androidLibraryConfig() {
4340
}
4441

4542
compileOptions {
46-
java11()
43+
java17()
4744
}
4845

4946
sourceSets.all {
50-
java.srcDir("src/$name/kotlin")
47+
java.directories.add("src/$name/kotlin")
5148
}
5249
sourceSets.named("main") {
53-
java.srcDir("build/generated/json2kotlin/main/kotlin")
50+
kotlin.directories.add("build/generated/json2kotlin/main/kotlin")
5451
}
5552

56-
@Suppress("UnstableApiUsage")
5753
testOptions {
5854
unitTests.isReturnDefaultValues = true
5955
}
@@ -86,4 +82,9 @@ fun Project.androidLibraryConfig() {
8682
}
8783
}
8884
}
85+
extensionConfig<LibraryAndroidComponentsExtension> {
86+
beforeVariants { variant: LibraryVariantBuilder ->
87+
variant.hostTests[HostTestBuilder.UNIT_TEST_TYPE]?.enable = true
88+
}
89+
}
8990
}

buildSrc/src/main/kotlin/com/datadog/gradle/config/JUnitConfig.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ fun Project.junitConfig() {
2222
"--add-opens=java.base/java.util.concurrent=ALL-UNNAMED"
2323
)
2424
useJUnitPlatform {
25-
includeEngines("spek", "junit-jupiter", "junit-vintage")
25+
includeEngines("junit-jupiter", "junit-vintage")
2626
}
2727
reports {
2828
junitXml.required.set(true)

buildSrc/src/main/kotlin/com/datadog/gradle/config/KotlinConfig.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ fun Project.kotlinConfig(
2121
jvmTarget.set(jvmBytecodeTarget)
2222
val isCI = System.getenv("CI").toBoolean()
2323
allWarningsAsErrors.set(evaluateWarningsAsErrors && isCI)
24-
apiVersion.set(KotlinVersion.KOTLIN_1_8)
25-
languageVersion.set(KotlinVersion.KOTLIN_1_8)
24+
apiVersion.set(KotlinVersion.KOTLIN_2_1)
25+
languageVersion.set(KotlinVersion.KOTLIN_2_1)
2626
}
2727
}
2828
}

buildSrc/src/main/kotlin/com/datadog/gradle/plugin/apisurface/ApiSurfacePlugin.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class ApiSurfacePlugin : Plugin<Project> {
4040
this.kotlinSurfaceFile.set(generateApiSurfaceTask.flatMap { it.surfaceFile })
4141
if (target.plugins.hasPlugin(GEN_JAVA_API_LAYOUT_PLUGIN)) {
4242
this.javaSurfaceFile.set(javaSurfaceFile)
43-
dependsOn(TASK_GEN_JAVA_API_SURFACE)
43+
dependsOn(target.tasks.matching { it.name == TASK_GEN_JAVA_API_SURFACE })
4444
} else {
4545
logger.info(
4646
"No Java API layout plugin found, skipping API surface" +
@@ -72,15 +72,16 @@ class ApiSurfacePlugin : Plugin<Project> {
7272
// Java API generation task does a clean-up of all files in the output
7373
// folder, so let it run first
7474
if (target.plugins.hasPlugin(GEN_JAVA_API_LAYOUT_PLUGIN)) {
75+
val apiDumpTasks = target.tasks.matching { it.name == TASK_GEN_JAVA_API_SURFACE }
7576
val isCi = target.providers.environmentVariable("CI").isPresent
7677
if (isCi) {
7778
// Java API generation wires to the release build type, so we can afford triggering compilation
7879
// of release type locally when we run debug compilation, but we would like to avoid it on CI
7980
if (name == "compileReleaseKotlin") {
80-
finalizedBy(TASK_GEN_JAVA_API_SURFACE)
81+
finalizedBy(apiDumpTasks)
8182
}
8283
} else {
83-
finalizedBy(TASK_GEN_JAVA_API_SURFACE)
84+
finalizedBy(apiDumpTasks)
8485
}
8586
}
8687
finalizedBy(generateApiSurfaceTask)

ci/Dockerfile.gitlab

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ RUN set -x \
2626
&& apt-get -y clean \
2727
&& rm -rf /var/lib/apt/lists/*
2828

29-
ENV GRADLE_VERSION 9.4.0
30-
ENV ANDROID_COMPILE_SDK 36
31-
ENV ANDROID_BUILD_TOOLS 36.0.0
29+
ENV GRADLE_VERSION 9.5.1
30+
ENV ANDROID_COMPILE_SDK 37
31+
ENV ANDROID_BUILD_TOOLS 37.0.0
3232
ENV ANDROID_SDK_TOOLS 13114758
3333
ENV NDK_VERSION 28.0.13004108
3434
ENV CMAKE_VERSION 3.22.1
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
kotlin_abi_version=1.8.0
2-
jvm_bytecode_version=11
1+
kotlin_abi_version=2.1.0
2+
jvm_bytecode_version=17

dd-sdk-android-core/build.gradle.kts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,11 @@ import com.datadog.gradle.config.javadocConfig
1414
import com.datadog.gradle.config.junitConfig
1515
import com.datadog.gradle.config.kotlinConfig
1616
import com.datadog.gradle.config.publishingConfig
17-
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
1817

1918
plugins {
2019
id("ktlint")
2120
// Build
2221
id("com.android.library")
23-
kotlin("android")
2422
id("com.google.devtools.ksp")
2523

2624
// Publish
@@ -136,7 +134,8 @@ dependencies {
136134
testImplementation(testFixtures(project(":dd-sdk-android-internal")))
137135
unmock(libs.robolectric)
138136

139-
// Test Fixtures
137+
// Test Fixtures — declared explicitly because the testFixtures source set is its own variant
138+
// and does not inherit the main `implementation` classpath (nor the auto-added kotlin-stdlib).
140139
testFixturesImplementation(libs.kotlin)
141140
testFixturesImplementation(libs.bundles.jUnit5)
142141
testFixturesImplementation(libs.okHttp)
@@ -165,7 +164,7 @@ unMock {
165164
keepStartingWith("org.json")
166165
}
167166

168-
kotlinConfig(jvmBytecodeTarget = JvmTarget.JVM_11)
167+
kotlinConfig()
169168
androidLibraryConfig()
170169
junitConfig()
171170
javadocConfig()

0 commit comments

Comments
 (0)