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 8.9, AGP 8.6.0, Kotlin 1.9.22 #3839

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
06c23dc
Bump Gradle 8.9, AGP 8.6.0, Kotlin 1.9.22
markushi Nov 1, 2024
175cd51
Disable explicit API mode for uitest modules
markushi Nov 1, 2024
496c89d
Format code
getsentry-bot Nov 1, 2024
c992483
Merge branch 'main' into chore/gradle-agp-kotlin-version-bump
markushi Nov 7, 2024
e5aba6d
Address PR feedback
markushi Nov 7, 2024
f6305ac
Ensure file paths are correctly resolved
markushi Nov 7, 2024
17cdc91
Fix more lint/test issues
markushi Nov 8, 2024
593e102
Fix minSdk errors
markushi Nov 8, 2024
b5aa001
Remove assertIs, as it's not available for Kotlin 1.4
markushi Nov 8, 2024
1188303
Fix detekt errors
markushi Nov 12, 2024
9083d60
Fix R8 issues
markushi Nov 12, 2024
2dcb237
Bump to Kotlin 1.9.24, language version 1.6, Compose MP 1.6.11, Compo…
markushi Nov 13, 2024
78d9178
Merge branch 'main' into chore/gradle-agp-kotlin-version-bump
markushi Nov 13, 2024
7004e90
Merge branch 'main' into chore/gradle-agp-kotlin-version-bump
markushi Nov 14, 2024
73d248d
Format code
getsentry-bot Nov 14, 2024
d691085
Merge branch 'main' into chore/gradle-agp-kotlin-version-bump
markushi Nov 14, 2024
571da29
Define testProguardFiles to make R8 happy
markushi Nov 14, 2024
7c6e770
Merge branch 'main' into chore/gradle-agp-kotlin-version-bump
markushi Nov 14, 2024
af380aa
Add detailed message to asserts
markushi Nov 15, 2024
ad3740f
Ensure looper is idle
markushi Nov 15, 2024
8fbc17b
Bump robolectric, ensure main thread is idle for all replay tests
markushi Nov 15, 2024
15c1662
Fully robolectric-ify UserInteractionIntegration tests
markushi Nov 15, 2024
96ee3c6
Add Changelog for new Kotlin Language version
markushi Nov 15, 2024
fcf74d8
Fix missing proguard rules
markushi Nov 18, 2024
df830a5
Merge branch 'main' into chore/gradle-agp-kotlin-version-bump
markushi Nov 18, 2024
b203084
Fix missing explicit API
markushi Nov 18, 2024
317eb41
Format code
getsentry-bot Nov 18, 2024
778c58f
Fix missing explicit API
markushi Nov 18, 2024
393b37e
Fix formatting
markushi Nov 18, 2024
c253fe1
Merge branch 'main' into chore/gradle-agp-kotlin-version-bump
markushi Nov 18, 2024
2a91970
Merge branch 'main' into chore/gradle-agp-kotlin-version-bump
markushi Nov 25, 2024
c987526
Merge branch 'main' into chore/gradle-agp-kotlin-version-bump
markushi Nov 27, 2024
bd9bb23
Fix CodeQL jobs cancelling each other
markushi Nov 27, 2024
7470ec5
Apply suggestions from code review
markushi Nov 28, 2024
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 @@ -29,6 +29,10 @@
- [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#078)
- [diff](https://github.com/getsentry/sentry-native/compare/0.7.2...0.7.8)

### Breaking Changes

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

## 7.17.0

### Features
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 @@ -139,7 +137,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 @@ -156,6 +154,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 @@ -178,23 +177,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 @@ -205,7 +196,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 @@ -242,7 +233,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
33 changes: 18 additions & 15 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 @@ -43,7 +46,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 Down Expand Up @@ -144,13 +147,13 @@ 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.6.0"

val apolloKotlin = "com.apollographql.apollo3:apollo-runtime:3.8.2"
Expand Down Expand Up @@ -190,7 +193,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 @@ -214,7 +217,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=7.18.0

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.IHub
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.hub, 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.hub, 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.hub, fixture.options)

Expand Down
Loading
Loading