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
2 changes: 1 addition & 1 deletion .github/workflows/agp-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
with:
distribution: 'temurin'
java-version: '17'
java-version: '21'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@3f5f9adaf7d9fecd50b5935e54106014257a94e6 # v6.4.0
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ concurrency:

jobs:
build:
name: Build Job ubuntu-latest - Java 17
name: Build Job ubuntu-latest
runs-on: ubuntu-latest

env:
Expand All @@ -28,7 +28,7 @@ jobs:
uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
with:
distribution: 'temurin'
java-version: '17'
java-version: '21'

# Workaround for https://github.com/gradle/actions/issues/21 to use config cache
- name: Cache buildSrc
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
with:
distribution: 'temurin'
java-version: '17'
java-version: '21'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@3f5f9adaf7d9fecd50b5935e54106014257a94e6 # v6.4.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/enforce-license-compliance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
with:
distribution: 'temurin'
java-version: '17'
java-version: '21'

- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/format-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
with:
distribution: 'temurin'
java-version: '17'
java-version: '21'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@3f5f9adaf7d9fecd50b5935e54106014257a94e6 # v6.4.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/generate-javadocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
with:
distribution: 'temurin'
java-version: '17'
java-version: '21'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@3f5f9adaf7d9fecd50b5935e54106014257a94e6 # v6.4.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration-tests-macrobenchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
with:
distribution: 'temurin'
java-version: '17'
java-version: '21'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@3f5f9adaf7d9fecd50b5935e54106014257a94e6 # v6.4.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration-tests-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
with:
distribution: "temurin"
java-version: "17"
java-version: "21"

# Workaround for https://github.com/gradle/actions/issues/21 to use config cache
- name: Cache buildSrc
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration-tests-ui-critical.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
with:
distribution: 'temurin'
java-version: '17'
java-version: '21'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@3f5f9adaf7d9fecd50b5935e54106014257a94e6 # v6.4.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration-tests-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
with:
distribution: 'temurin'
java-version: '17'
java-version: '21'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@3f5f9adaf7d9fecd50b5935e54106014257a94e6 # v6.4.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
with:
distribution: 'temurin'
java-version: '17'
java-version: '21'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@3f5f9adaf7d9fecd50b5935e54106014257a94e6 # v6.4.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/spring-boot-2-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
with:
distribution: 'temurin'
java-version: '17'
java-version: '21'

# Workaround for https://github.com/gradle/actions/issues/21 to use config cache
- name: Cache buildSrc
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/spring-boot-3-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
with:
distribution: 'temurin'
java-version: '17'
java-version: '21'

# Workaround for https://github.com/gradle/actions/issues/21 to use config cache
- name: Cache buildSrc
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/spring-boot-4-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
with:
distribution: 'temurin'
java-version: '17'
java-version: '21'

# Workaround for https://github.com/gradle/actions/issues/21 to use config cache
- name: Cache buildSrc
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/system-tests-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ jobs:
uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
with:
distribution: 'temurin'
java-version: '17'
java-version: '21'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@3f5f9adaf7d9fecd50b5935e54106014257a94e6 # v6.4.0
Expand Down
4 changes: 3 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ We suggest opening an issue to discuss bigger changes before investing on a big

# Requirements

The project requires you to run JDK 17.
The project requires you to run JDK 21 or newer. Compilation and tests always happen on JDK 21
through a [toolchain](https://docs.gradle.org/current/userguide/toolchains.html), so a newer JDK
runs the build but never changes its output.

## Android

Expand Down
2 changes: 2 additions & 0 deletions build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ repositories {
dependencies {
implementation(libs.animalsniffer.gradle.plugin)
implementation(libs.spotlessLib)
// Only for the Kotlin task types the jvm-targets plugin configures.
compileOnly(libs.kotlin.gradle.plugin)
}

gradlePlugin {
Expand Down
38 changes: 38 additions & 0 deletions build-logic/src/main/kotlin/io.sentry.jvm-targets.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile

// Compilation and tests run on this JDK whatever JDK runs Gradle, so a contributor on a newer JDK
// gets the same output as CI. Error Prone 2.50 ships Java 21 bytecode and needs javac 21 as well.
// This picks the JDK only - every module pins the bytecode level it publishes itself.
val buildJdk = JavaLanguageVersion.of(21)

plugins.withType<JavaBasePlugin> {
extensions.configure<JavaPluginExtension> { toolchain { languageVersion.set(buildJdk) } }
}

/**
* Targets [buildJdk] in the compile tasks that [taskFilter] selects. Both languages move together,
* because the Kotlin plugin rejects a Java/Kotlin target mismatch.
*/
fun Project.applyToolchainToCompileTasks(taskFilter: (Task) -> Boolean) {
// AGP assigns these task properties while it creates the variants, so this has to run later.
afterEvaluate {
tasks.withType<JavaCompile>().matching(taskFilter).configureEach {
sourceCompatibility = buildJdk.toString()
targetCompatibility = buildJdk.toString()
}
tasks.withType<KotlinJvmCompile>().matching(taskFilter).configureEach {
compilerOptions.jvmTarget.set(JvmTarget.fromTarget(buildJdk.toString()))
}
}
}

listOf("com.android.library", "com.android.application").forEach { pluginId ->
plugins.withId(pluginId) {
// Mockito 5 and mockito-kotlin 6 are built for Java 11, so test code (never published) can't
// share the Java 8 target of the published code. Other modules pin main compilation only, which
// leaves their test tasks on the toolchain; AGP has no such split, as compileOptions applies to
// every variant, so its unit tests need this.
applyToolchainToCompileTasks { it.name.contains("UnitTest") }
}
}
14 changes: 12 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ plugins {
alias(libs.plugins.sentry) apply false
Comment thread
sentry-warden[bot] marked this conversation as resolved.
}

check(JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_21)) {
"This build requires JDK 21 or newer, but runs on JDK ${JavaVersion.current()}."
}

buildscript {
repositories {
google()
Expand Down Expand Up @@ -111,6 +115,7 @@ allprojects {

subprojects {
apply { plugin("io.sentry.spotless") }
apply { plugin("io.sentry.jvm-targets") }

plugins.withId(Config.QualityPlugins.detektPlugin) {
configure<DetektExtension> {
Expand Down Expand Up @@ -162,9 +167,14 @@ subprojects {

configure<JavaPluginExtension> {
withJavadocJar()
}

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
// Published code targets Java 8. release compiles against that version's class library
// instead of the build JDK's, so newer JDK APIs (e.g. List.getFirst()) can't leak into
// published bytecode. Modules that publish a higher level override this; test code is
// never published and follows the toolchain.
tasks.named<JavaCompile>("compileJava") {
options.release.set(8)
}
}

Expand Down
6 changes: 0 additions & 6 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
`kotlin-dsl`
}

repositories {
mavenCentral()
}

tasks.withType<KotlinCompile>().configureEach {
Comment thread
markushi marked this conversation as resolved.
compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
}
12 changes: 6 additions & 6 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ buildconfig = { id = "com.github.gmazzo.buildconfig", version = "5.6.5" }
dokka = { id = "org.jetbrains.dokka", version = "2.0.0" }
dokka-javadoc = { id = "org.jetbrains.dokka-javadoc", version = "2.0.0" }
binary-compatibility-validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version = "0.13.0" }
errorprone = { id = "net.ltgt.errorprone", version = "3.0.1" }
errorprone = { id = "net.ltgt.errorprone", version = "5.1.1" }
Comment thread
markushi marked this conversation as resolved.
gradle-versions = { id = "com.github.ben-manes.versions", version = "0.42.0" }
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
detekt = { id = "io.gitlab.arturbosch.detekt", version = "1.23.8" }
Expand Down Expand Up @@ -129,7 +129,7 @@ caffeine-jcache = { module = "com.github.ben-manes.caffeine:jcache", version = "
coil-compose = { module = "io.coil-kt:coil-compose", version = "2.6.0" }
commons-compress = {module = "org.apache.commons:commons-compress", version = "1.28.0"}
context-propagation = { module = "io.micrometer:context-propagation", version = "1.1.0" }
errorprone-core = { module = "com.google.errorprone:error_prone_core", version = "2.11.0" }
errorprone-core = { module = "com.google.errorprone:error_prone_core", version = "2.50.0" }
feign-core = { module = "io.github.openfeign:feign-core", version.ref = "feign" }
feign-gson = { module = "io.github.openfeign:feign-gson", version.ref = "feign" }
graphql-java17 = { module = "com.graphql-java:graphql-java", version = "17.3" }
Expand All @@ -152,9 +152,10 @@ log4j-core = { module = "org.apache.logging.log4j:log4j-core", version.ref = "lo
leakcanary = { module = "com.squareup.leakcanary:leakcanary-android", version = "2.14" }
lottie-compose = { module = "com.airbnb.android:lottie-compose", version = "6.7.1" }
logback-classic = { module = "ch.qos.logback:logback-classic", version.ref = "logback" }
kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
nopen-annotations = { module = "com.jakewharton.nopen:nopen-annotations", version.ref = "nopen" }
nopen-checker = { module = "com.jakewharton.nopen:nopen-checker", version.ref = "nopen" }
nullaway = { module = "com.uber.nullaway:nullaway", version = "0.9.5" }
nullaway = { module = "com.uber.nullaway:nullaway", version = "0.14.2" }
Comment thread
markushi marked this conversation as resolved.
okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
okhttp-bom = { module = "com.squareup.okhttp3:okhttp-bom", version.ref = "okhttp" }
openfeature = { module = "dev.openfeature:sdk", version.ref = "openfeature" }
Expand Down Expand Up @@ -273,9 +274,8 @@ hsqldb = { module = "org.hsqldb:hsqldb", version = "2.6.1" }
javafaker = { module = "com.github.javafaker:javafaker", version = "1.0.2" }
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutines" }
leakcanary-instrumentation = { module = "com.squareup.leakcanary:leakcanary-android-instrumentation", version = "2.14" }
mockito-kotlin = { module = "org.mockito.kotlin:mockito-kotlin", version = "4.1.0" }
mockito-kotlin-spring7 = { module = "org.mockito.kotlin:mockito-kotlin", version = "6.0.0" }
mockito-inline = { module = "org.mockito:mockito-inline", version = "4.8.0" }
mockito-kotlin = { module = "org.mockito.kotlin:mockito-kotlin", version = "6.4.0" }
mockito-core = { module = "org.mockito:mockito-core", version = "5.24.0" }
msgpack = { module = "org.msgpack:msgpack-core", version = "0.9.8" }
okhttp-mockwebserver = { module = "com.squareup.okhttp3:mockwebserver", version.ref = "okhttp" }
# apollo-runtime 5.x pulls in okhttp 5.x; mockwebserver 4.x is incompatible with that classpath
Expand Down
2 changes: 1 addition & 1 deletion sentry-android-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ dependencies {
testImplementation(libs.awaitility.kotlin)
testImplementation(libs.google.truth)
testImplementation(libs.mockito.kotlin)
testImplementation(libs.mockito.inline)
testImplementation(libs.mockito.core)
testImplementation(projects.sentryTestSupport)
testImplementation(projects.sentrySpotlight)
testImplementation(projects.sentryAndroidFragment)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
* really the cause of the exception. Each "Caused by" is the stack trace of a running thread. Note
* that the main thread always comes first.
*/
final class ApplicationNotResponding extends RuntimeException {
private static final long serialVersionUID = 252541144579117016L;

// Never serialized.
@SuppressWarnings("serial")
private final @Nullable Thread thread;

ApplicationNotResponding(final @Nullable String message) {

Check warning on line 24 in sentry-android-core/src/main/java/io/sentry/android/core/ApplicationNotResponding.java

View check run for this annotation

@sentry/warden / warden: check-code-attribution

โš ๏ธ Vendored file header missing copyright and license name

**io.sentry.android.core.ApplicationNotResponding** โ€” Header has source URL and "Based on" origin but lacks the required Copyright line and license name (e.g. Copyright (c) 2016 Salomon BRYS and MIT License). Add both fields to the file header to match ANRWatchDog and the ANR-WatchDog NOTICES entry.

Check warning on line 24 in sentry-android-core/src/main/java/io/sentry/android/core/ApplicationNotResponding.java

View check run for this annotation

@sentry/warden / warden: check-code-attribution

โš ๏ธ Missing THIRD_PARTY_NOTICES.md entry for vendored file

**io.sentry.android.core.ApplicationNotResponding** โ€” This file is adapted from SalomonBrys ANR-WatchDog ANRError but is not named in THIRD_PARTY_NOTICES.md. Extend the SalomonBrys โ€” ANR-WatchDog Scope to include `io.sentry.android.core.ApplicationNotResponding` (or add an equivalent entry).
Comment thread
markushi marked this conversation as resolved.
Comment thread
markushi marked this conversation as resolved.
super(message);
this.thread = null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
/**
* @deprecated `SentryUserFeedbackButton` will be removed in the next major version
*/
// Constructors call overridable methods; making them final would break the public API.
@SuppressWarnings("this-escape")
@Deprecated
public class SentryUserFeedbackButton extends Button {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
* <p>This class is also responsible for - determining the app start type (cold, warm) - determining
* if the app was launched in foreground
*/
// Constructors call overridable methods; making them final would break the public API.
@SuppressWarnings("this-escape")
@ApiStatus.Internal
public class AppStartMetrics extends ActivityLifecycleCallbacksAdapter {
public interface HeadlessAppStartListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import org.junit.Rule
import org.junit.rules.TemporaryFolder
import org.mockito.kotlin.any
import org.mockito.kotlin.anyOrNull
import org.mockito.kotlin.anyVararg
import org.mockito.kotlin.argThat
import org.mockito.kotlin.atMost
import org.mockito.kotlin.check
Expand Down Expand Up @@ -316,7 +317,7 @@ abstract class ApplicationExitIntegrationTestBase<THint : Any> {
.log(
any(),
argThat { startsWith("Timed out waiting to flush previous session to its own file.") },
any<Any>(),
anyVararg<Any>(),
)
}

Expand All @@ -337,7 +338,7 @@ abstract class ApplicationExitIntegrationTestBase<THint : Any> {
.log(
any(),
argThat { startsWith("Timed out waiting to flush previous session to its own file.") },
any<Any>(),
anyVararg<Any>(),
)
verify(fixture.scopes).captureEvent(any(), any<Hint>())
}
Expand All @@ -354,7 +355,7 @@ abstract class ApplicationExitIntegrationTestBase<THint : Any> {
.log(
any(),
argThat { startsWith("Timed out waiting to flush previous session to its own file.") },
any<Any>(),
anyVararg<Any>(),
)
assertTrue((fixture.options.envelopeDiskCache as EnvelopeCache).waitPreviousSessionFlush())
}
Expand Down
2 changes: 1 addition & 1 deletion sentry-android-fragment/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ dependencies {
testImplementation(libs.androidx.fragment.ktx)
testImplementation(libs.kotlin.test.junit)
testImplementation(libs.mockito.kotlin)
testImplementation(libs.mockito.inline)
testImplementation(libs.mockito.core)
}

tasks.withType<Detekt>().configureEach {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import io.gitlab.arturbosch.detekt.Detekt
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
id("com.android.application")
Expand Down Expand Up @@ -33,7 +32,6 @@ android {
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
kotlin { compilerOptions.jvmTarget = JvmTarget.JVM_11 }
buildFeatures { compose = true }
composeOptions { kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() }
androidComponents.beforeVariants {
Expand Down
Loading
Loading