Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Gradle, AGP and Kotlin versions #3936

Merged
merged 19 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from 2 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/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- cron: '17 23 * * 3'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.language }}
cancel-in-progress: true

jobs:
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Breaking Changes

- The Kotlin Language version is now set to 1.6 ([#3936](https://github.com/getsentry/sentry-java/pull/3936))

### Features

- Extract OpenTelemetry `URL_PATH` span attribute into description ([#3933](https://github.com/getsentry/sentry-java/pull/3933))
Expand Down
25 changes: 8 additions & 17 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import com.diffplug.spotless.LineEnding
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import com.vanniktech.maven.publish.MavenPublishPlugin
import com.vanniktech.maven.publish.MavenPublishPluginExtension
import groovy.util.Node
import io.gitlab.arturbosch.detekt.extensions.DetektExtension
import kotlinx.kover.gradle.plugin.dsl.KoverReportExtension
Expand All @@ -17,6 +15,7 @@ plugins {
id(Config.QualityPlugins.binaryCompatibilityValidator) version Config.QualityPlugins.binaryCompatibilityValidatorVersion
id(Config.QualityPlugins.jacocoAndroid) version Config.QualityPlugins.jacocoAndroidVersion apply false
id(Config.QualityPlugins.kover) version Config.QualityPlugins.koverVersion apply false
id(Config.BuildPlugins.gradleMavenPublishPlugin) version Config.BuildPlugins.gradleMavenPublishPluginVersion apply false
}

buildscript {
Expand All @@ -26,7 +25,6 @@ buildscript {
dependencies {
classpath(Config.BuildPlugins.androidGradle)
classpath(kotlin(Config.BuildPlugins.kotlinGradlePlugin, version = Config.kotlinVersion))
classpath(Config.BuildPlugins.gradleMavenPublishPlugin)
// dokka is required by gradle-maven-publish-plugin.
classpath(Config.BuildPlugins.dokkaPlugin)
classpath(Config.QualityPlugins.errorpronePlugin)
Expand Down Expand Up @@ -140,7 +138,7 @@ subprojects {
androidReports("release") {
xml {
// Change the report file name so the Codecov Github action can find it
setReportFile(file("$buildDir/reports/kover/report.xml"))
setReportFile(project.layout.buildDirectory.file("reports/kover/report.xml").get().asFile)
}
}
}
Expand All @@ -157,6 +155,7 @@ subprojects {

if (!this.name.contains("sample") && !this.name.contains("integration-tests") && this.name != "sentry-test-support" && this.name != "sentry-compose-helper") {
apply<DistributionPlugin>()
apply<com.vanniktech.maven.publish.MavenPublishPlugin>()

val sep = File.separator

Expand All @@ -179,23 +178,15 @@ subprojects {
tasks.named("distZip").configure {
this.dependsOn("publishToMavenLocal")
this.doLast {
val distributionFilePath =
"${this.project.buildDir}${sep}distributions${sep}${this.project.name}-${this.project.version}.zip"
val file = File(distributionFilePath)
if (!file.exists()) throw IllegalStateException("Distribution file: $distributionFilePath does not exist")
if (file.length() == 0L) throw IllegalStateException("Distribution file: $distributionFilePath is empty")
val file = this.project.layout.buildDirectory.file("distributions${sep}${this.project.name}-${this.project.version}.zip").get().asFile
if (!file.exists()) throw IllegalStateException("Distribution file: ${file.absolutePath} does not exist")
if (file.length() == 0L) throw IllegalStateException("Distribution file: ${file.absolutePath} is empty")
}
}

afterEvaluate {
apply<MavenPublishPlugin>()

configure<MavenPublishPluginExtension> {
// signing is done when uploading files to MC
// via gpg:sign-and-deploy-file (release.kts)
releaseSigningEnabled = false
}

@Suppress("UnstableApiUsage")
configure<MavenPublishBaseExtension> {
assignAarTypes()
Expand All @@ -206,7 +197,7 @@ subprojects {
repositories {
maven {
name = "unityMaven"
url = file("${rootProject.buildDir}/unityMaven").toURI()
url = rootProject.layout.buildDirectory.file("unityMaven").get().asFile.toURI()
}
}
}
Expand Down Expand Up @@ -243,7 +234,7 @@ spotless {

gradle.projectsEvaluated {
tasks.create("aggregateJavadocs", Javadoc::class.java) {
setDestinationDir(file("$buildDir/docs/javadoc"))
setDestinationDir(project.layout.buildDirectory.file("docs/javadoc").get().asFile)
title = "${project.name} $version API"
val opts = options as StandardJavadocDocletOptions
opts.quiet()
Expand Down
36 changes: 20 additions & 16 deletions buildSrc/src/main/java/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@
import java.math.BigDecimal

object Config {
val AGP = System.getenv("VERSION_AGP") ?: "7.4.2"
val kotlinVersion = "1.8.0"
val AGP = System.getenv("VERSION_AGP") ?: "8.6.0"
val kotlinVersion = "1.9.24"
val kotlinStdLib = "stdlib-jdk8"

val springBootVersion = "2.7.5"
val springBoot3Version = "3.3.2"
val kotlinCompatibleLanguageVersion = "1.4"
val kotlinCompatibleLanguageVersion = "1.6"

val composeVersion = "1.5.3"
val androidComposeCompilerVersion = "1.4.0"
// see https://www.jetbrains.com/help/kotlin-multiplatform-dev/compose-compatibility-and-versioning.html#kotlin-compatibility
// see https://developer.android.com/jetpack/androidx/releases/compose-kotlin
val composeVersion = "1.6.11"
val androidComposeCompilerVersion = "1.5.14"

object BuildPlugins {
val androidGradle = "com.android.tools.build:gradle:$AGP"
Expand All @@ -23,8 +25,9 @@ object Config {
val springDependencyManagementVersion = "1.0.11.RELEASE"
val gretty = "org.gretty"
val grettyVersion = "4.0.0"
val gradleMavenPublishPlugin = "com.vanniktech:gradle-maven-publish-plugin:0.18.0"
val dokkaPlugin = "org.jetbrains.dokka:dokka-gradle-plugin:1.7.10"
val gradleMavenPublishPlugin = "com.vanniktech.maven.publish"
val gradleMavenPublishPluginVersion = "0.28.0"
val dokkaPlugin = "org.jetbrains.dokka:dokka-gradle-plugin:1.9.20"
val dokkaPluginAlias = "org.jetbrains.dokka"
val composeGradlePlugin = "org.jetbrains.compose:compose-gradle-plugin:$composeVersion"
val commonsCompressOverride = "org.apache.commons:commons-compress:1.25.0"
Expand All @@ -39,7 +42,7 @@ object Config {

val abiFilters = listOf("x86", "armeabi-v7a", "x86_64", "arm64-v8a")

fun shouldSkipDebugVariant(name: String): Boolean {
fun shouldSkipDebugVariant(name: String?): Boolean {
return System.getenv("CI")?.toBoolean() ?: false && name == "debug"
}
}
Expand All @@ -58,6 +61,7 @@ object Config {
val androidxCore = "androidx.core:core:1.3.2"
val androidxSqlite = "androidx.sqlite:sqlite:2.3.1"
val androidxRecylerView = "androidx.recyclerview:recyclerview:1.2.1"
val androidxAnnotation = "androidx.annotation:annotation:1.9.1"

val slf4jApi = "org.slf4j:slf4j-api:1.7.30"
val slf4jApi2 = "org.slf4j:slf4j-api:2.0.5"
Expand Down Expand Up @@ -142,14 +146,14 @@ object Config {

// compose deps
val composeNavigation = "androidx.navigation:navigation-compose:$navigationVersion"
val composeActivity = "androidx.activity:activity-compose:1.4.0"
val composeFoundation = "androidx.compose.foundation:foundation:$composeVersion"
val composeUi = "androidx.compose.ui:ui:$composeVersion"
val composeActivity = "androidx.activity:activity-compose:1.8.2"
val composeFoundation = "androidx.compose.foundation:foundation:1.6.3"
val composeUi = "androidx.compose.ui:ui:1.6.3"
val composeFoundationLayout = "androidx.compose.foundation:foundation-layout:1.6.3"
val composeMaterial = "androidx.compose.material3:material3:1.2.1"

val composeUiReplay = "androidx.compose.ui:ui:1.5.0" // Note: don't change without testing forwards compatibility
val composeFoundationLayout = "androidx.compose.foundation:foundation-layout:$composeVersion"
val composeMaterial = "androidx.compose.material3:material3:1.0.0-alpha13"
val composeCoil = "io.coil-kt:coil-compose:2.0.0"
val composeCoil = "io.coil-kt:coil-compose:2.6.0"

val apolloKotlin = "com.apollographql.apollo3:apollo-runtime:3.8.2"

Expand Down Expand Up @@ -192,7 +196,7 @@ object Config {
val androidxTestOrchestrator = "androidx.test:orchestrator:1.5.0"
val androidxJunit = "androidx.test.ext:junit:1.1.5"
val androidxCoreKtx = "androidx.core:core-ktx:1.7.0"
val robolectric = "org.robolectric:robolectric:4.10.3"
val robolectric = "org.robolectric:robolectric:4.14"
val mockitoKotlin = "org.mockito.kotlin:mockito-kotlin:4.1.0"
val mockitoInline = "org.mockito:mockito-inline:4.8.0"
val awaitility = "org.awaitility:awaitility-kotlin:4.1.1"
Expand All @@ -218,7 +222,7 @@ object Config {
val gradleVersionsPlugin = "com.github.ben-manes:gradle-versions-plugin:0.42.0"
val gradleVersions = "com.github.ben-manes.versions"
val detekt = "io.gitlab.arturbosch.detekt"
val detektVersion = "1.19.0"
val detektVersion = "1.23.5"
val detektPlugin = "io.gitlab.arturbosch.detekt"
val binaryCompatibilityValidatorVersion = "0.13.0"
val binaryCompatibilityValidatorPlugin = "org.jetbrains.kotlinx:binary-compatibility-validator:$binaryCompatibilityValidatorVersion"
Expand Down
3 changes: 0 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ org.gradle.workers.max=2
# AndroidX required by AGP >= 3.6.x
android.useAndroidX=true

# Required by AGP >= 8.0.x
android.defaults.buildfeatures.buildconfig=true

# Release information
versionName=8.0.0-beta.3

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
11 changes: 6 additions & 5 deletions sentry-android-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ android {
namespace = "io.sentry.android.core"

defaultConfig {
targetSdk = Config.Android.targetSdkVersion
minSdk = Config.Android.minSdkVersion

testInstrumentationRunner = Config.TestLibs.androidJUnitRunner
Expand Down Expand Up @@ -53,15 +52,17 @@ android {
checkReleaseBuilds = false
}

buildFeatures {
buildConfig = true
}

// needed because of Kotlin 1.4.x
configurations.all {
resolutionStrategy.force(Config.CompileOnly.jetbrainsAnnotations)
}

variantFilter {
if (Config.Android.shouldSkipDebugVariant(buildType.name)) {
ignore = true
}
androidComponents.beforeVariants {
it.enable = !Config.Android.shouldSkipDebugVariant(it.buildType)
}
}

Expand Down
1 change: 1 addition & 0 deletions sentry-android-core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET"/>

<application>
<!-- 'android:authorities' must be unique in the device, across all apps -->
<provider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ public SentryFrameMetricsCollector(
this(context, logger, buildInfoProvider, new WindowFrameMetricsManager() {});
}

@SuppressWarnings("deprecation")
@SuppressLint({"NewApi", "DiscouragedPrivateApi"})
public SentryFrameMetricsCollector(
final @NotNull Context context,
Expand All @@ -79,7 +78,7 @@ public SentryFrameMetricsCollector(
}

@SuppressWarnings("deprecation")
@SuppressLint({"NewApi", "DiscouragedPrivateApi"})
@SuppressLint({"NewApi", "PrivateApi"})
public SentryFrameMetricsCollector(
final @NotNull Context context,
final @NotNull ILogger logger,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.sentry.android.core

import android.annotation.SuppressLint
import android.app.ActivityManager
import android.app.ActivityManager.MemoryInfo
import android.app.ActivityManager.RunningAppProcessInfo
Expand Down Expand Up @@ -174,6 +175,7 @@ class ContextUtilsTest {
assertNull(memInfo)
}

@SuppressLint("UnspecifiedRegisterReceiverFlag")
@Test
fun `registerReceiver calls context_registerReceiver without exported flag on API 32-`() {
val buildInfo = mock<BuildInfoProvider>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package io.sentry.android.core
import android.content.Context
import android.content.Intent
import android.os.BatteryManager
import android.os.Build
import androidx.test.ext.junit.runners.AndroidJUnit4
import io.sentry.Breadcrumb
import io.sentry.IScopes
Expand All @@ -19,13 +20,15 @@ import org.mockito.kotlin.never
import org.mockito.kotlin.verify
import org.mockito.kotlin.verifyNoMoreInteractions
import org.mockito.kotlin.whenever
import org.robolectric.annotation.Config
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertNotNull
import kotlin.test.assertNull

@RunWith(AndroidJUnit4::class)
@Config(sdk = [Build.VERSION_CODES.TIRAMISU])
class SystemEventsBreadcrumbsIntegrationTest {

private class Fixture {
Expand All @@ -50,7 +53,7 @@ class SystemEventsBreadcrumbsIntegrationTest {

sut.register(fixture.scopes, fixture.options)

verify(fixture.context).registerReceiver(any(), any())
verify(fixture.context).registerReceiver(any(), any(), any())
assertNotNull(sut.receiver)
}

Expand All @@ -69,7 +72,7 @@ class SystemEventsBreadcrumbsIntegrationTest {

sut.register(fixture.scopes, fixture.options)

verify(fixture.context, never()).registerReceiver(any(), any())
verify(fixture.context, never()).registerReceiver(any(), any(), any())
assertNull(sut.receiver)
}

Expand Down Expand Up @@ -174,7 +177,7 @@ class SystemEventsBreadcrumbsIntegrationTest {
@Test
fun `Do not crash if registerReceiver throws exception`() {
val sut = fixture.getSut()
whenever(fixture.context.registerReceiver(any(), any())).thenThrow(SecurityException())
whenever(fixture.context.registerReceiver(any(), any(), any())).thenThrow(SecurityException())

sut.register(fixture.scopes, fixture.options)

Expand Down
Loading
Loading