Skip to content
Open
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
3 changes: 2 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
variables:
CURRENT_CI_IMAGE: "18"
CURRENT_CI_IMAGE: "19"
CI_IMAGE_DOCKER: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/dd-sdk-android-gradle-plugin:$CURRENT_CI_IMAGE
GIT_DEPTH: 5

Expand All @@ -13,6 +13,7 @@ variables:
EMULATOR_NAME: "android_emulator"
ANDROID_ARCH: "arm64-v8a"
ANDROID_API: "36"
ANDROID_SDK_TOOLS: "13114758"
ANDROID_EMULATOR_IMAGE: "system-images;android-$ANDROID_API;google_apis;${ANDROID_ARCH}"
ANDROID_PLATFORM: "platforms;android-$ANDROID_API"
ANDROID_BUILD_TOOLS: "build-tools;$ANDROID_API.0.0"
Expand Down
14 changes: 8 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ The whole project is covered by a set of static analysis tools, linters and test
# launches the unit tests
./gradlew :dd-sdk-android-gradle-plugin:test

# launches the ktlint check and formatter for all Kotlin files (the ktlint client needs to be installed on your machine)
ktlint -F "**/*.kt" "**/*.kts" '!**/build/generated/**' '!**/build/kspCaches/**'
# launches the ktlint check for all Kotlin files
./gradlew ktlintCheck :build-config:ktlintCheck

# launches the detekt checks
./gradlew detekt


# launches all the tests described above
Expand Down Expand Up @@ -159,11 +162,11 @@ class Foo :Observable(), Runnable {
}

```
There is also a command that you can use to automatically format the code following the
required styling rules (require ktlint installed on your machine):
There is also a Gradle command that you can use to automatically format the code following the
required styling rules:

```console
ktlint -F "**/*.kt" "**/*.kts" '!**/build/generated/**' '!**/build/kspCaches/**'
./gradlew ktlintFormat :build-config:ktlintFormat
```

### #TestMatters
Expand Down Expand Up @@ -252,4 +255,3 @@ Because we sometimes need to reuse some setup or assertions in our tests, we ten
- `fun setupSomething()`: method to set up a complex test (should only be used in the Given part of a test).



5 changes: 4 additions & 1 deletion LICENSE-3rdparty.csv
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
Component,Origin,License,Copyright
build,com.pinterest,MIT,"Copyright 2019 Pinterest Inc, Copyright 2016-2019 Stanley Shyiko"
build,com.pinterest.ktlint,MIT,"Copyright 2019 Pinterest Inc, Copyright 2016-2019 Stanley Shyiko"
build,dev.drewhamilton.poko,Apache-2.0,Copyright 2020-Present Drew Hamilton
build,io.github.detekt.sarif4k,Apache-2.0,"Copyright 2021 Artur Bosch & Contributors"
build,io.github.oshai,Apache-2.0,"Copyright oshai authors"
build,io.gitlab.arturbosch.detekt,Apache-2.0,Copyright 2016-2019 the original author or authors
build,org.ec4j.core,Apache-2.0,"Copyright (c) 2017 Angelo Zerr and other contributors"
build,org.jetbrains.dokka,Apache-2.0,"Copyright 2014-2019 JetBrains s.r.o. and Dokka project contributors."
build,org.jetbrains.intellij.deps,LGPL-2.1-only,"Copyright (c) 2001-2002, Eric D. Friedman, Jason Baldridge, Copyright (c) 1999 CERN - European Organization for Nuclear Research"
build,org.jetbrains.kotlinx,Apache-2.0,Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors
import,com.android.tools.build,Apache-2.0,Copyright (C) 2013 The Android Open Source Project
import,com.squareup.okhttp3,Apache-2.0,"Copyright 2019 Square, Inc"
import,org.bouncycastle,BouncyCastle-License,"Copyright (c) 2000 - 2026 The Legion of the Bouncy Castle Inc. (https://www.bouncycastle.org)""
Expand All @@ -19,7 +23,6 @@ import(test),dev.zacsweers.kctfork,MPL-2.0,Copyright (C) 2023 Thilo Schuchort
import(test),com.github.xgouchet.Elmyr,MIT,Copyright 2017-2019 Xavier F. Gouchet
import(test),net.wuerl.kotlin,Apache-2.0,Copyright 2016 Andreas Würl
import(test),org.assertj,Apache-2.0,Copyright 2012-2019 the original author or authors
import(test),org.jacoco,EPL-2.0,"Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors"
import(test),org.junit.jupiter,EPL-2.0,Copyright 2015-2019 the original author or authors
import(test),org.junit.platform,EPL-2.0,Copyright 2015-2019 the original author or authors
import(test),org.junit.vintage,EPL-2.0,Copyright 2015-2019 the original author or authors
Expand Down
28 changes: 28 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* Copyright 2020-Present Datadog, Inc.
*/

import io.gitlab.arturbosch.detekt.Detekt

buildscript {
repositories {
// Magic Mirror Depot proxy (only set in CI via `.gitlab-ci.yml`).
Expand All @@ -23,7 +25,11 @@ buildscript {
}

plugins {
alias(libs.plugins.detektGradlePlugin)
alias(libs.plugins.kotlinPlugin23) apply false
alias(libs.plugins.ktlintGradlePlugin) apply false
alias(libs.plugins.koverPlugin) apply false
id("ktlint")
alias(libs.plugins.dokkaJavadocPlugin) apply false
alias(libs.plugins.androidApplicationPlugin) apply false
alias(libs.plugins.androidLibraryPlugin) apply false
Expand All @@ -44,6 +50,28 @@ allprojects {
}
}

val detektSources = files(rootDir)
val detektExcludes = listOf("**/build/**", "**/.gradle/**")

tasks.withType<Detekt>().configureEach {
setSource(detektSources)
include("**/*.kt", "**/*.kts")
exclude(detektExcludes)
jvmTarget = "17"
reports {
sarif.required = false
html.required = false
xml.required = false
txt.required = false
md.required = false
}
}

tasks.named<Detekt>("detekt") {
description = "Runs the Detekt checks."
config.setFrom(rootProject.file("detekt.yml"))
}

tasks.register<Delete>("clean") {
delete(rootProject.layout.buildDirectory)
}
Expand Down
123 changes: 49 additions & 74 deletions ci/Dockerfile.gitlab
Original file line number Diff line number Diff line change
@@ -1,56 +1,33 @@
# This base image is based on a GBI image
FROM registry.ddbuild.io/images/docker:24.0.4-jammy

ENV DEBIAN_FRONTEND=noninteractive
ARG DEBIAN_FRONTEND=noninteractive
ARG TARGETARCH

# Set timezone to UTC by default
RUN ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime

RUN apt-get update \
&& apt-get -y install openjdk-17-jdk \
&& rm -rf /var/lib/apt/lists/*

RUN set -x \
&& apt-get update \
&& apt-get -y upgrade \
&& apt-get -y install --no-install-recommends \
&& apt-get install -y openjdk-17-jdk \
&& apt-get install -y --no-install-recommends \
curl \
git \
python3 \
python3-pip \
unzip \
wget \
openssh-client \
expect \
python3-distutils \
python3-apt \
&& apt-get -y clean \
&& rm -rf /var/lib/apt/lists/*

ENV GRADLE_VERSION 9.6.1
ENV ANDROID_COMPILE_SDK 36
ENV ANDROID_BUILD_TOOLS 36.1.0
ENV ANDROID_SDK_TOOLS 11076708
ENV NDK_VERSION 26.1.10909125
ENV CMAKE_VERSION 3.22.1

RUN apt update && apt install -y python3 python3-distutils

# Install pip for aws
RUN set -x \
&& curl -OL https://bootstrap.pypa.io/get-pip.py \
&& python3 get-pip.py \
&& rm get-pip.py

RUN python3 --version

RUN set -x \
&& pip install awscli
ENV ANDROID_COMPILE_SDK=36 \
ANDROID_BUILD_TOOLS=36.1.0 \
ANDROID_SDK_TOOLS=13114758 \
CMAKE_VERSION=3.22.1 \
NDK_VERSION=28.2.13676358
ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-${TARGETARCH}

# Gradle
RUN \
cd /usr/local && \
curl -L https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip -o gradle-${GRADLE_VERSION}-bin.zip && \
unzip gradle-${GRADLE_VERSION}-bin.zip && \
rm gradle-${GRADLE_VERSION}-bin.zip
RUN python3 --version \
&& python3 -m pip install --no-cache-dir awscli \
&& aws --version

# Workaround for
# Warning: File /root/.android/repositories.cfg could not be loaded.
Expand All @@ -60,39 +37,31 @@ RUN mkdir /root/.android \

# Android SDK
RUN \
wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_SDK_TOOLS}_latest.zip && \
mkdir -p android-sdk-linux/cmdline-tools && \
unzip -d android-sdk-linux/cmdline-tools android-sdk.zip && \
mv android-sdk-linux/cmdline-tools/cmdline-tools android-sdk-linux/cmdline-tools/latest && \
echo y | android-sdk-linux/cmdline-tools/latest/bin/sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" >/dev/null && \
echo y | android-sdk-linux/cmdline-tools/latest/bin/sdkmanager "platform-tools" >/dev/null && \
echo y | android-sdk-linux/cmdline-tools/latest/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" >/dev/null && \
echo y | android-sdk-linux/cmdline-tools/latest/bin/sdkmanager --install "ndk;${NDK_VERSION}" >/dev/null && \
echo y | android-sdk-linux/cmdline-tools/latest/bin/sdkmanager --install "cmake;${CMAKE_VERSION}" >/dev/null && \
(yes || true) | android-sdk-linux/cmdline-tools/latest/bin/sdkmanager --licenses

RUN set -x \
&& curl -OL https://s3.amazonaws.com/dd-package-public/dd-package.deb && dpkg -i dd-package.deb && rm dd-package.deb \
&& apt-get update \
&& apt-get -y clean \
&& rm -rf /var/lib/apt/lists/*

ENV ANDROID_SDK_ROOT $PWD/android-sdk-linux
ENV ANDROID_HOME $PWD/android-sdk-linux
ENV GRADLE_HOME /usr/local/gradle-${GRADLE_VERSION}
ENV PATH $PATH:$GRADLE_HOME/bin
ENV PATH $PATH:$ANDROID_HOME/platform-tools
ENV PATH $PATH:$ANDROID_SDK_ROOT/build-tools/${ANDROID_BUILD_TOOLS}:$ANDROID_NDK

# Woke
ENV WOKE_VERSION "0.6.0"
ENV WOKE_SHA256 "ea5605d4242b93d9586a21878264dd8abcf64ed92f0f6538ea831d9d3215b883"

RUN curl -L https://github.com/get-woke/woke/releases/download/v${WOKE_VERSION}/woke-${WOKE_VERSION}-linux-amd64.tar.gz -o woke-linux-amd64.tar.gz \
&& echo "${WOKE_SHA256} woke-linux-amd64.tar.gz" | sha256sum -c \
&& tar -xf woke-linux-amd64.tar.gz \
&& mv woke-${WOKE_VERSION}-linux-amd64/woke /usr/bin/woke \
&& rm -Rf woke-${WOKE_VERSION}-linux-amd64 woke-${WOKE_VERSION}-linux-amd64.tar.gz
curl -fsSLo /tmp/android-sdk.zip https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_SDK_TOOLS}_latest.zip && \
mkdir -p /android-sdk-linux/cmdline-tools && \
unzip -q -d /android-sdk-linux/cmdline-tools /tmp/android-sdk.zip && \
rm /tmp/android-sdk.zip && \
mv /android-sdk-linux/cmdline-tools/cmdline-tools /android-sdk-linux/cmdline-tools/latest && \
echo y | /android-sdk-linux/cmdline-tools/latest/bin/sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" >/dev/null && \
echo y | /android-sdk-linux/cmdline-tools/latest/bin/sdkmanager "platform-tools" >/dev/null && \
echo y | /android-sdk-linux/cmdline-tools/latest/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" >/dev/null && \
echo y | /android-sdk-linux/cmdline-tools/latest/bin/sdkmanager --install "ndk;${NDK_VERSION}" >/dev/null && \
echo y | /android-sdk-linux/cmdline-tools/latest/bin/sdkmanager --install "cmake;${CMAKE_VERSION}" >/dev/null && \
(yes || true) | /android-sdk-linux/cmdline-tools/latest/bin/sdkmanager --licenses

ENV ANDROID_SDK_ROOT=/android-sdk-linux \
ANDROID_HOME=/android-sdk-linux \
ANDROID_NDK=/android-sdk-linux/ndk/${NDK_VERSION}
ENV PATH=${PATH}:${ANDROID_HOME}/platform-tools:${ANDROID_SDK_ROOT}/build-tools/${ANDROID_BUILD_TOOLS}:${ANDROID_NDK}

# Install Datadog Java tracer
ENV DD_TRACER_VERSION=1.65.1 \
DD_TRACER_SHA256=04fa3c1ec79d6bf112f9b115465b2f41f352474b7aeb4178961adf4b24ff351d \
DD_TRACER_FOLDER=/opt/dd-java-agent
RUN mkdir -p "${DD_TRACER_FOLDER}" \
&& curl -fsSLo "${DD_TRACER_FOLDER}/dd-java-agent.jar" \
"https://repo1.maven.org/maven2/com/datadoghq/dd-java-agent/${DD_TRACER_VERSION}/dd-java-agent-${DD_TRACER_VERSION}.jar" \
&& echo "${DD_TRACER_SHA256} ${DD_TRACER_FOLDER}/dd-java-agent.jar" | sha256sum -c

COPY --from=registry.ddbuild.io/dd-octo-sts:v1.8.2 /usr/local/bin/dd-octo-sts /usr/local/bin/dd-octo-sts
COPY --from=registry.ddbuild.io/dd-sts:v0.1.7@sha256:dea74bd68e19075b6001a02a2f6121001fbcd84b2512c7f398f7b39bf22f04a8 /usr/local/bin/dd-sts /usr/local/bin/dd-sts
Expand All @@ -103,9 +72,15 @@ COPY --from=registry.ddbuild.io/ddsign:v1.11.10@sha256:55784668a612ab22129bb15a6
ARG GITHUB_RELEASES_BASE=https://depot-read-api-github-releases.us1.ddbuild.io/internal/mirror/github-releases
ENV DATADOG_CI_VERSION=5.21.2
ENV DATADOG_CI_SHA256_amd64=b163d332679b677410e05389700874a7e73b8fcb4d29dbc94c904637a9665b79
ENV DATADOG_CI_SHA256_arm64=526d92541ef6990211f9da96d828394db956a3b12bdadc68a687b114f21918f7
RUN set -x \
&& case "${TARGETARCH}" in \
amd64) sha256="${DATADOG_CI_SHA256_amd64}"; arch=x64 ;; \
arm64) sha256="${DATADOG_CI_SHA256_arm64}"; arch=arm64 ;; \
*) echo "Unsupported architecture: ${TARGETARCH}" >&2; exit 1 ;; \
esac \
&& curl -fsSLo /usr/local/bin/datadog-ci \
"${GITHUB_RELEASES_BASE}/DataDog/datadog-ci/releases/download/v${DATADOG_CI_VERSION}/datadog-ci_linux-x64" \
&& echo "${DATADOG_CI_SHA256_amd64} /usr/local/bin/datadog-ci" | sha256sum -c \
"${GITHUB_RELEASES_BASE}/DataDog/datadog-ci/releases/download/v${DATADOG_CI_VERSION}/datadog-ci_linux-${arch}" \
&& echo "${sha256} /usr/local/bin/datadog-ci" | sha256sum -c \
&& chmod +x /usr/local/bin/datadog-ci \
&& datadog-ci version
&& datadog-ci version
Loading
Loading