Skip to content
Draft
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: 5 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ variables:

CACHE_FALLBACK_KEY: "develop"

# Unify the Gradle user home across ALL jobs so every Gradle invocation shares one
# GitLab-cacheable location ($CI_PROJECT_DIR/cache) instead of some jobs using the default,
# non-cached /root/.gradle. Jobs that pass --gradle-user-home cache/ already match this.
GRADLE_USER_HOME: "$CI_PROJECT_DIR/cache"

# Magic Mirror Depot proxy URLs. The depot proxies both Maven Central and the Gradle
# Plugin Portal for the Java ecosystem from the same endpoint. Setting these routes
# dependency/plugin resolution through Datadog's internal mirror to avoid HTTP 429
Expand Down
5 changes: 4 additions & 1 deletion LICENSE-3rdparty.csv
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ import,androidx.versionedparcelable,Apache-2.0,Copyright 2018 The Android Open S
import,androidx.viewpager,Apache-2.0,Copyright 2018 The Android Open Source Project
import,androidx.wear,Apache-2.0,Copyright 2018 The Android Open Source Project
import,androidx.work,Apache-2.0,Copyright 2018 The Android Open Source Project
import,app.cash.sql-psi,Apache-2.0,"Copyright 2016 Square, Inc"
import,app.cash.sqldelight,Apache-2.0,"Copyright 2016 Square, Inc"
import,com.android.tools,Apache-2.0,Copyright 2018 The Android Open Source Project
import,com.apollographql.apollo,MIT,"Copyright (c) 2016-2024 Apollo Graph, Inc. (Formerly Meteor Development Group, Inc.)"
import,com.benasher44,MIT,"Copyright (c) 2019 Ben Asher"
Expand Down Expand Up @@ -140,6 +142,7 @@ import(test),com.jakewharton.android.repackaged,Apache-2.0,"Copyright (C) 2007 T
import(test),com.parse.bolts,"BSD License","Copyright (c) Facebook, Inc. and its affiliates."
import(test),com.squareup,Apache-2.0,"Copyright 2015 Square, Inc."
import(test),dev.drewhamilton.poko,Apache-2.0,Copyright 2020-Present Drew Hamilton
import(test),dev.zacsweers.kctfork,MPL-2.0,Copyright (C) 2022 Zac Sweers
import(test),greatest,ICT,"Copyright (c) 2011-2018 Scott Vokes <vokes.s@gmail.com>"
import(test),io.github.davidburstrom.contester,Apache-2.0,"Copyright 2022-2024 David Burström"
import(test),io.github.detekt.sarif4k,Apache-2.0,"Copyright 2021 Artur Bosch & Contributors"
Expand Down Expand Up @@ -183,7 +186,6 @@ build,com.fasterxml.jackson.core,Apache-2.0,"Copyright (c) 2007- Tatu Saloranta"
build,com.fasterxml.jackson.dataformat,Apache-2.,"Copyright (c) 2007- Tatu Saloranta"
build,com.fasterxml.jackson.module,Apache-2.0,"Copyright (c) 2007- Tatu Saloranta"
build,com.fasterxml.woodstox,Apache-2.0,"Copyright (c) 2007- Tatu Saloranta"
build,com.github.tschuchortdev,MPL-2.0,"Copyright (C) 2023 Thilo Schuchort"
build,com.google.android,Apache-2.0,Copyright (C) 2013 The Android Open Source Project
build,com.google.api.grpc,Apache-2.0,Copyright 2020 Google LLC
build,com.google.auto,Apache-2.0,"Copyright 2014 Google LLC"
Expand All @@ -208,6 +210,7 @@ build,commons-io,Apache-2.0,Copyright 2002-2024 The Apache Software Foundation
build,commons-logging,Apache-2.0,Copyright 2002-2024 The Apache Software Foundation
build,io.github.aakira,Apache-2.0,"Copyright (C) 2019 A.Akira"
build,io.github.classgraph,MIT,"Copyright (c) 2019 Luke Hutchison"
build,io.github.java-diff-utils,Apache-2.0,"Copyright java-diff-utils contributors"
build,io.github.microutils,Apache-2.0,Copyright (c) 2016-2018 Ohad Shai
build,io.gitlab.arturbosch.detekt,Apache-2.0,Copyright 2016-2019 the original author or authors
build,io.grpc,Apache-2.0,Copyright 2014 The gRPC Authors
Expand Down
24 changes: 8 additions & 16 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/
@file:Suppress("StringLiteralDuplication")

import com.android.build.gradle.LibraryExtension
import com.datadog.gradle.config.AndroidConfig
import com.datadog.gradle.config.depotProxied
import com.datadog.gradle.config.registerSubModuleAggregationTask
Expand All @@ -29,7 +28,6 @@ plugins {
// don't add these to the classpath, otherwise there will be a conflict, because they are already coming
// from buildSrc classpath. May be solved with convention plugins though.
// alias(libs.plugins.androidLibraryPlugin) apply false
// alias(libs.plugins.kotlinAndroidPlugin) apply false
// alias(libs.plugins.dokkaGradlePlugin) apply false
// alias(libs.plugins.versionsGradlePlugin) apply false
}
Expand Down Expand Up @@ -207,20 +205,14 @@ tasks.register("printSdkDebugRuntimeClasspath") {
allprojects.minus(project).forEach { subproject ->
val childTask = subproject.tasks.register("printDebugRuntimeClasspath") {
doLast {
val ext =
subproject.extensions.findByType(LibraryExtension::class.java) ?: return@doLast
val classpath = ext.libraryVariants
.filter { it.name == "jvmDebug" || it.name == "debug" }
.map { libVariant ->
// returns also test part of classpath for now, no idea how to filter it out
libVariant.getCompileClasspath(null).filter { it.exists() }
}
.first()
if (classpath is FileTree) {
fileTreeClassPathCollector.addToUnion(classpath)
} else {
nonFileTreeClassPathCollector += classpath
}
val config = subproject.configurations.findByName("jvmDebugCompileClasspath")
?: subproject.configurations.findByName("debugCompileClasspath")
?: return@doLast
// Use lenient resolution: AGP 9 variant resolution can fail for local project
// dependencies when kotlin.platform.type attributes are missing on providers.
val classpath = config.incoming.artifactView { isLenient = true }.files
.filter { it.exists() }
nonFileTreeClassPathCollector += classpath
}
}
this@register.dependsOn(childTask)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,23 @@ package com.datadog.gradle.config

import com.android.build.api.dsl.CompileOptions
import com.android.build.api.dsl.LibraryExtension
import com.android.build.api.variant.HostTestBuilder
import com.android.build.api.variant.LibraryAndroidComponentsExtension
import com.android.build.api.variant.LibraryVariantBuilder
import com.datadog.gradle.utils.Version
import org.gradle.api.JavaVersion
import org.gradle.api.Project

object AndroidConfig {

const val TARGET_SDK = 36
const val TARGET_SDK = 37
const val MIN_SDK = 23
const val MIN_SDK_FOR_AUTO = 29
const val BUILD_TOOLS_VERSION = "36.0.0"
const val BUILD_TOOLS_VERSION = "37.0.0"

val VERSION = Version(3, 12, 0, Version.Type.Snapshot)
}

// TODO RUM-628 Switch to Java 17 bytecode
fun CompileOptions.java11() {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

fun CompileOptions.java17() {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
Expand All @@ -43,17 +40,16 @@ fun Project.androidLibraryConfig() {
}

compileOptions {
java11()
java17()
}

sourceSets.all {
java.srcDir("src/$name/kotlin")
java.directories.add("src/$name/kotlin")
}
sourceSets.named("main") {
java.srcDir("build/generated/json2kotlin/main/kotlin")
kotlin.directories.add("build/generated/json2kotlin/main/kotlin")
}

@Suppress("UnstableApiUsage")
testOptions {
unitTests.isReturnDefaultValues = true
}
Expand Down Expand Up @@ -86,4 +82,9 @@ fun Project.androidLibraryConfig() {
}
}
}
extensionConfig<LibraryAndroidComponentsExtension> {
beforeVariants { variant: LibraryVariantBuilder ->
variant.hostTests[HostTestBuilder.UNIT_TEST_TYPE]?.enable = true
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ fun Project.kotlinConfig(
jvmTarget.set(jvmBytecodeTarget)
val isCI = System.getenv("CI").toBoolean()
allWarningsAsErrors.set(evaluateWarningsAsErrors && isCI)
apiVersion.set(KotlinVersion.KOTLIN_1_8)
languageVersion.set(KotlinVersion.KOTLIN_1_8)
apiVersion.set(KotlinVersion.KOTLIN_2_1)
languageVersion.set(KotlinVersion.KOTLIN_2_1)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ApiSurfacePlugin : Plugin<Project> {
this.kotlinSurfaceFile.set(generateApiSurfaceTask.flatMap { it.surfaceFile })
if (target.plugins.hasPlugin(GEN_JAVA_API_LAYOUT_PLUGIN)) {
this.javaSurfaceFile.set(javaSurfaceFile)
dependsOn(TASK_GEN_JAVA_API_SURFACE)
dependsOn(target.tasks.matching { it.name == TASK_GEN_JAVA_API_SURFACE })
} else {
logger.info(
"No Java API layout plugin found, skipping API surface" +
Expand Down Expand Up @@ -72,15 +72,16 @@ class ApiSurfacePlugin : Plugin<Project> {
// Java API generation task does a clean-up of all files in the output
// folder, so let it run first
if (target.plugins.hasPlugin(GEN_JAVA_API_LAYOUT_PLUGIN)) {
val apiDumpTasks = target.tasks.matching { it.name == TASK_GEN_JAVA_API_SURFACE }
val isCi = target.providers.environmentVariable("CI").isPresent
if (isCi) {
// Java API generation wires to the release build type, so we can afford triggering compilation
// of release type locally when we run debug compilation, but we would like to avoid it on CI
if (name == "compileReleaseKotlin") {
finalizedBy(TASK_GEN_JAVA_API_SURFACE)
finalizedBy(apiDumpTasks)
}
} else {
finalizedBy(TASK_GEN_JAVA_API_SURFACE)
finalizedBy(apiDumpTasks)
}
}
finalizedBy(generateApiSurfaceTask)
Expand Down
6 changes: 3 additions & 3 deletions ci/Dockerfile.gitlab
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ RUN set -x \
&& apt-get -y clean \
&& rm -rf /var/lib/apt/lists/*

ENV GRADLE_VERSION 9.4.0
ENV ANDROID_COMPILE_SDK 36
ENV ANDROID_BUILD_TOOLS 36.0.0
ENV GRADLE_VERSION 9.5.1
ENV ANDROID_COMPILE_SDK 37
ENV ANDROID_BUILD_TOOLS 37.0.0
ENV ANDROID_SDK_TOOLS 13114758
ENV NDK_VERSION 28.0.13004108
ENV CMAKE_VERSION 3.22.1
Expand Down
14 changes: 7 additions & 7 deletions ci/pipelines/default-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ test:debug:
:unitTestDebugFeatures
:unitTestDebugIntegrations
:unitTestDebugSamples
--parallel --max-workers=4 --no-daemon --build-cache --gradle-user-home cache/
--parallel --max-workers=4 --no-daemon --build-cache
-Dorg.gradle.jvmargs=-javaagent:$DD_TRACER_FOLDER/dd-java-agent.jar=$DD_COMMON_AGENT_CONFIG
artifacts:
when: always
Expand All @@ -188,7 +188,7 @@ test:tools:
script:
- rm -rf ~/.gradle/daemon/
- export DD_AGENT_HOST="$BUILDENV_HOST_IP"
- GRADLE_OPTS="-Xmx3072m" ./gradlew :unitTestTools --stacktrace --no-daemon --build-cache --gradle-user-home cache/
- GRADLE_OPTS="-Xmx3072m" ./gradlew :unitTestTools --stacktrace --no-daemon --build-cache

test:kover:
tags: [ "arch:amd64" ]
Expand All @@ -214,7 +214,7 @@ test:kover:
:dd-sdk-android-internal:koverXmlReportRelease
:koverReportFeatures
:koverReportIntegrations
--parallel --max-workers=4 --no-daemon --build-cache --gradle-user-home cache/
--parallel --max-workers=4 --no-daemon --build-cache
-Dorg.gradle.jvmargs=-javaagent:$DD_TRACER_FOLDER/dd-java-agent.jar=$DD_COMMON_AGENT_CONFIG
- bash <(cat ./ci/scripts/codecov.sh) -t $CODECOV_TOKEN
- npm install -g @datadog/datadog-ci
Expand Down Expand Up @@ -283,7 +283,7 @@ test-pyramid:single-fit-logs:
script:
- rm -rf ~/.gradle/daemon/
- export DD_AGENT_HOST="$BUILDENV_HOST_IP"
- GRADLE_OPTS="-Xmx3072m" DD_TAGS="test.configuration.variant:release" ./gradlew :reliability:single-fit:logs:testReleaseUnitTest --stacktrace --no-daemon --build-cache --gradle-user-home cache/ -Dorg.gradle.jvmargs=-javaagent:$DD_TRACER_FOLDER/dd-java-agent.jar=$DD_COMMON_AGENT_CONFIG
- GRADLE_OPTS="-Xmx3072m" DD_TAGS="test.configuration.variant:release" ./gradlew :reliability:single-fit:logs:testReleaseUnitTest --stacktrace --no-daemon --build-cache -Dorg.gradle.jvmargs=-javaagent:$DD_TRACER_FOLDER/dd-java-agent.jar=$DD_COMMON_AGENT_CONFIG
artifacts:
when: always
expire_in: 1 week
Expand All @@ -300,7 +300,7 @@ test-pyramid:single-fit-rum:
script:
- rm -rf ~/.gradle/daemon/
- export DD_AGENT_HOST="$BUILDENV_HOST_IP"
- GRADLE_OPTS="-Xmx3072m" DD_TAGS="test.configuration.variant:release" ./gradlew :reliability:single-fit:rum:testReleaseUnitTest --stacktrace --no-daemon --build-cache --gradle-user-home cache/ -Dorg.gradle.jvmargs=-javaagent:$DD_TRACER_FOLDER/dd-java-agent.jar=$DD_COMMON_AGENT_CONFIG
- GRADLE_OPTS="-Xmx3072m" DD_TAGS="test.configuration.variant:release" ./gradlew :reliability:single-fit:rum:testReleaseUnitTest --stacktrace --no-daemon --build-cache -Dorg.gradle.jvmargs=-javaagent:$DD_TRACER_FOLDER/dd-java-agent.jar=$DD_COMMON_AGENT_CONFIG
artifacts:
when: always
expire_in: 1 week
Expand All @@ -317,7 +317,7 @@ test-pyramid:single-fit-trace:
script:
- rm -rf ~/.gradle/daemon/
- export DD_AGENT_HOST="$BUILDENV_HOST_IP"
- GRADLE_OPTS="-Xmx3072m" DD_TAGS="test.configuration.variant:release" ./gradlew :reliability:single-fit:trace:testReleaseUnitTest --stacktrace --no-daemon --build-cache --gradle-user-home cache/ -Dorg.gradle.jvmargs=-javaagent:$DD_TRACER_FOLDER/dd-java-agent.jar=$DD_COMMON_AGENT_CONFIG
- GRADLE_OPTS="-Xmx3072m" DD_TAGS="test.configuration.variant:release" ./gradlew :reliability:single-fit:trace:testReleaseUnitTest --stacktrace --no-daemon --build-cache -Dorg.gradle.jvmargs=-javaagent:$DD_TRACER_FOLDER/dd-java-agent.jar=$DD_COMMON_AGENT_CONFIG
artifacts:
when: always
expire_in: 1 week
Expand All @@ -334,7 +334,7 @@ test-pyramid:single-fit-okhttp:
script:
- rm -rf ~/.gradle/daemon/
- export DD_AGENT_HOST="$BUILDENV_HOST_IP"
- GRADLE_OPTS="-Xmx3072m" DD_TAGS="test.configuration.variant:release" ./gradlew :reliability:single-fit:okhttp:testReleaseUnitTest --stacktrace --no-daemon --build-cache --gradle-user-home cache/ -Dorg.gradle.jvmargs=-javaagent:$DD_TRACER_FOLDER/dd-java-agent.jar=$DD_COMMON_AGENT_CONFIG
- GRADLE_OPTS="-Xmx3072m" DD_TAGS="test.configuration.variant:release" ./gradlew :reliability:single-fit:okhttp:testReleaseUnitTest --stacktrace --no-daemon --build-cache -Dorg.gradle.jvmargs=-javaagent:$DD_TRACER_FOLDER/dd-java-agent.jar=$DD_COMMON_AGENT_CONFIG
artifacts:
when: always
expire_in: 1 week
Expand Down
4 changes: 2 additions & 2 deletions dd-sdk-android-core/api/compiler-meta.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
kotlin_abi_version=1.8.0
jvm_bytecode_version=11
kotlin_abi_version=2.1.0
jvm_bytecode_version=17
7 changes: 3 additions & 4 deletions dd-sdk-android-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ import com.datadog.gradle.config.javadocConfig
import com.datadog.gradle.config.junitConfig
import com.datadog.gradle.config.kotlinConfig
import com.datadog.gradle.config.publishingConfig
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
// Build
id("com.android.library")
kotlin("android")
id("com.google.devtools.ksp")

// Publish
Expand Down Expand Up @@ -134,7 +132,8 @@ dependencies {
testImplementation(testFixtures(project(":dd-sdk-android-internal")))
unmock(libs.robolectric)

// Test Fixtures
// Test Fixtures — declared explicitly because the testFixtures source set is its own variant
// and does not inherit the main `implementation` classpath (nor the auto-added kotlin-stdlib).
testFixturesImplementation(libs.kotlin)
testFixturesImplementation(libs.bundles.jUnit5)
testFixturesImplementation(libs.okHttp)
Expand Down Expand Up @@ -163,7 +162,7 @@ unMock {
keepStartingWith("org.json")
}

kotlinConfig(jvmBytecodeTarget = JvmTarget.JVM_11)
kotlinConfig()
androidLibraryConfig()
junitConfig()
javadocConfig()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import java.net.Proxy
*
* This is necessary to initialize the SDK with the [Datadog.initialize] method.
*/
@ConsistentCopyVisibility
data class Configuration
internal constructor(
internal val coreConfig: Core,
Expand Down Expand Up @@ -113,7 +114,7 @@ internal constructor(
/**
* Sets the list of first party hosts.
* Requests made to a URL with any one of these hosts (or any subdomain) will:
* - be considered a first party resource and categorised as such in your RUM dashboard;
* - be considered a first party resource and categorized as such in your RUM dashboard;
* - be wrapped in a Span and have DataDog trace id injected to get a full flame-graph in
* APM in case of OkHttp instrumentation usage.
* @param hosts a list of all the hosts that you own.
Expand All @@ -138,7 +139,7 @@ internal constructor(
* Sets the list of first party hosts and specifies the type of HTTP headers used for
* distributed tracing.
* Requests made to a URL with any one of these hosts (or any subdomain) will:
* - be considered a first party resource and categorised as such in your RUM dashboard;
* - be considered a first party resource and categorized as such in your RUM dashboard;
* - be wrapped in a Span and have trace id of the specified types injected to get a
* full flame-graph in APM. Multiple header types are supported for each host.
* @param hostsWithHeaderType a list of all the hosts that you own and the tracing headers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ internal class ProcessLifecycleCallbackTest {
fun `when process started cancel existing workers`() {
// Given
WorkManagerImpl::class.java.setStaticValue("sDefaultInstance", mockWorkManager)
whenever(mockWorkManager.cancelAllWorkByTag(ArgumentMatchers.anyString())) doReturn mock()

// When
testedCallback.onStarted()
Expand Down
4 changes: 2 additions & 2 deletions dd-sdk-android-core/transitiveDependencies
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Dependencies List

androidx.annotation:annotation-experimental:1.1.0 : 16 Kb
androidx.annotation:annotation-experimental:1.0.0 : 11 Kb
androidx.annotation:annotation-jvm:1.9.1 : 59 Kb
androidx.arch.core:core-common:2.1.0 : 10 Kb
androidx.arch.core:core-runtime:2.1.0 : 5 Kb
Expand All @@ -18,7 +18,7 @@ com.squareup.okhttp3:okhttp:4.12.0 : 771 Kb
com.squareup.okio:okio-jvm:3.6.0 : 351 Kb
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.10 : 959 b
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.10 : 965 b
org.jetbrains.kotlin:kotlin-stdlib:2.0.21 : 1706 Kb
org.jetbrains.kotlin:kotlin-stdlib:2.3.20 : 1762 Kb
org.jetbrains:annotations:13.0 : 17 Kb

Total transitive dependencies size : 5 Mb
Expand Down
4 changes: 2 additions & 2 deletions dd-sdk-android-internal/api/compiler-meta.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
kotlin_abi_version=1.8.0
jvm_bytecode_version=11
kotlin_abi_version=2.1.0
jvm_bytecode_version=17
Loading
Loading