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.6, AGP=8.3.0, kotlin=1.9.22, compose=1.5+ #3263

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
634e4cc
Bump Gradle=8.6, AGP=8.2.0, kotlin=1.9.22, compose=1.5.12
markushi Mar 11, 2024
b08022f
Lint fixes
markushi Mar 11, 2024
c8a0039
Make lint happier
markushi Mar 11, 2024
fd1ff34
Add missing uses-feature
markushi Mar 11, 2024
6d6fc0c
temp: disable lint abortOnError for sentry-uitest-android
markushi Mar 11, 2024
b65f4aa
Fix visibility
markushi Mar 11, 2024
5c66ad0
Update Changelog
markushi Mar 12, 2024
0956924
Fix formatting
markushi Mar 12, 2024
c6e3b63
set lint.targetSdk only on AGP >= 8.2.0
markushi Mar 12, 2024
752145a
Remove lint.targetSdk
markushi Mar 12, 2024
ff28dc6
Fix visibility
markushi Mar 12, 2024
2bf9be6
Add testProguardFiles to benchmark app
markushi Mar 12, 2024
d87ed87
Supress Choreographer.mLastFrameTimeNanos warnings
markushi Mar 12, 2024
1093f6a
Format code
getsentry-bot Mar 12, 2024
68aca66
poke ci
markushi Mar 13, 2024
6b7e35a
Fix formatting
markushi Mar 13, 2024
997d6be
Making lint happier
markushi Mar 15, 2024
39997fa
Decrease min diff due to R8
markushi Mar 15, 2024
96ead33
Fix invalid proguard file path
markushi Mar 18, 2024
8104411
Bump plain/sentry perf apps versions
markushi Mar 18, 2024
a64c104
Update CHANGELOG.md
markushi Mar 18, 2024
67c9012
Update CHANGELOG.md
markushi Mar 18, 2024
4bed0e4
Make SentryTimberTree public again
markushi Mar 18, 2024
a2fd051
Merge branch 'feat/version-bumps' of github.com:getsentry/sentry-java…
markushi Mar 18, 2024
be1e320
Merge branch 'main' into feat/version-bumps
markushi Mar 21, 2024
f2390cb
Bump maven publish artifacts
markushi Mar 21, 2024
7029640
Merge branch 'main' into feat/version-bumps
markushi Mar 21, 2024
bfe02ea
Merge branch 'main' into feat/version-bumps
markushi Apr 23, 2024
6488520
Merge branch 'main' into feat/version-bumps
markushi Apr 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## Unreleased

### Features

- Internal: Version bump Gradle=8.6, AGP=8.3.0, kotlin=1.9.22, compose=1.5.12 ([#3263](https://github.com/getsentry/sentry-java/pull/3263))
markushi marked this conversation as resolved.
Show resolved Hide resolved

**Breaking changes:**
- The min supported Kotlin language version has been bumped to `1.5`, please consider using previous version of the SDK if you have to support compatibility with earlier Kotlin versions

## 7.6.0

### Features
Expand Down
8 changes: 4 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,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(file("${layout.buildDirectory}/reports/kover/report.xml"))
}
}
}
Expand Down Expand Up @@ -185,7 +185,7 @@ subprojects {
this.dependsOn("publishToMavenLocal")
this.doLast {
val distributionFilePath =
"${this.project.buildDir}${sep}distributions${sep}${this.project.name}-${this.project.version}.zip"
"${this.project.layout.buildDirectory}${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")
Expand All @@ -211,7 +211,7 @@ subprojects {
repositories {
maven {
name = "unityMaven"
url = file("${rootProject.buildDir}/unityMaven").toURI()
url = file("${rootProject.layout.buildDirectory}/unityMaven").toURI()
}
}
}
Expand Down Expand Up @@ -248,7 +248,7 @@ spotless {

gradle.projectsEvaluated {
tasks.create("aggregateJavadocs", Javadoc::class.java) {
setDestinationDir(file("$buildDir/docs/javadoc"))
setDestinationDir(file("${layout.buildDirectory}/docs/javadoc"))
title = "${project.name} $version API"
val opts = options as StandardJavadocDocletOptions
opts.quiet()
Expand Down
24 changes: 12 additions & 12 deletions buildSrc/src/main/java/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
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.3.0"
val kotlinVersion = "1.9.22"
val kotlinStdLib = "stdlib-jdk8"

val springBootVersion = "2.7.5"
val springBoot3Version = "3.2.0"
val kotlinCompatibleLanguageVersion = "1.4"
val kotlinCompatibleLanguageVersion = "1.5"

val composeVersion = "1.5.3"
val androidComposeCompilerVersion = "1.4.0"
val composeVersion = "1.5.12"
val androidComposeCompilerVersion = "1.5.10"

object BuildPlugins {
val androidGradle = "com.android.tools.build:gradle:$AGP"
Expand Down Expand Up @@ -41,7 +41,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 @@ -142,11 +142,11 @@ 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 composeFoundationLayout = "androidx.compose.foundation:foundation-layout:$composeVersion"
val composeMaterial = "androidx.compose.material3:material3:1.0.0-alpha13"
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 apolloKotlin = "com.apollographql.apollo3:apollo-runtime:3.8.2"

Expand Down Expand Up @@ -208,7 +208,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
2 changes: 0 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ org.gradle.parallel=true
android.useAndroidX=true

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

# Release information
versionName=7.6.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.6-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
19 changes: 14 additions & 5 deletions sentry-android-core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import net.ltgt.gradle.errorprone.errorprone
import org.jetbrains.kotlin.config.KotlinCompilerVersion
import org.jetbrains.kotlin.tooling.core.compareTo

plugins {
id("com.android.library")
Expand All @@ -15,7 +16,6 @@ android {
namespace = "io.sentry.android.core"

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

testInstrumentationRunner = Config.TestLibs.androidJUnitRunner
Expand All @@ -26,6 +26,14 @@ android {
buildConfigField("String", "VERSION_NAME", "\"${project.version}\"")
}

lint {
warningsAsErrors = true
checkDependencies = true

// We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks.
checkReleaseBuilds = false
}

buildTypes {
getByName("debug")
getByName("release") {
Expand All @@ -52,16 +60,17 @@ android {
// We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks.
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
19 changes: 12 additions & 7 deletions sentry-android-core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET"/>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />

<uses-sdk tools:overrideLibrary="androidx.compose.runtime" />
romtsn marked this conversation as resolved.
Show resolved Hide resolved

<application>
<!-- 'android:authorities' must be unique in the device, across all apps -->
<provider
android:name=".SentryInitProvider"
android:authorities="${applicationId}.SentryInitProvider"
android:exported="false"/>
android:exported="false" />

<provider
android:name=".SentryPerformanceProvider"
android:authorities="${applicationId}.SentryPerformanceProvider"
android:initOrder="200"
android:exported="false"/>
android:name=".SentryPerformanceProvider"
android:authorities="${applicationId}.SentryPerformanceProvider"
android:exported="false"
android:initOrder="200" />
</application>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,11 @@ public SentryFrameMetricsCollector(
this(context, options.getLogger(), buildInfoProvider, windowFrameMetricsManager);
}

/**
* @noinspection JavaReflectionMemberAccess
*/
@SuppressWarnings("deprecation")
@SuppressLint({"NewApi", "DiscouragedPrivateApi"})
@SuppressLint({"NewApi", "DiscouragedPrivateApi", "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 @@ -173,6 +174,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 @@ -2,25 +2,31 @@ package io.sentry.android.core

import android.content.Context
import android.content.Intent
import android.os.Build
import androidx.test.ext.junit.runners.AndroidJUnit4
import io.sentry.Breadcrumb
import io.sentry.IHub
import io.sentry.ISentryExecutorService
import io.sentry.SentryLevel
import io.sentry.test.DeferredExecutorService
import io.sentry.test.ImmediateExecutorService
import org.junit.runner.RunWith
import org.mockito.kotlin.any
import org.mockito.kotlin.anyOrNull
import org.mockito.kotlin.check
import org.mockito.kotlin.mock
import org.mockito.kotlin.never
import org.mockito.kotlin.verify
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)
romtsn marked this conversation as resolved.
Show resolved Hide resolved
@Config(sdk = [Build.VERSION_CODES.TIRAMISU])
class SystemEventsBreadcrumbsIntegrationTest {

private class Fixture {
Expand All @@ -45,7 +51,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 @@ -64,7 +70,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 @@ -114,7 +120,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
23 changes: 12 additions & 11 deletions sentry-android-fragment/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,20 @@ android {
namespace = "io.sentry.android.fragment"

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

// for AGP 4.1
buildConfigField("String", "VERSION_NAME", "\"${project.version}\"")
}

lint {
warningsAsErrors = true
checkDependencies = true

// We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks.
checkReleaseBuilds = false
}

buildTypes {
getByName("debug")
getByName("release") {
Expand All @@ -40,18 +47,12 @@ android {
}
}

lint {
warningsAsErrors = true
checkDependencies = true

// We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks.
checkReleaseBuilds = false
buildFeatures {
buildConfig = true
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import io.sentry.SentryOptions
import io.sentry.util.IntegrationUtils.addIntegrationToSdkVersion
import java.io.Closeable

class FragmentLifecycleIntegration(
public class FragmentLifecycleIntegration(
private val application: Application,
private val filterFragmentLifecycleBreadcrumbs: Set<FragmentLifecycleState>,
private val enableAutoFragmentLifecycleTracing: Boolean
Expand All @@ -22,13 +22,13 @@ class FragmentLifecycleIntegration(
Integration,
Closeable {

constructor(application: Application) : this(
public constructor(application: Application) : this(
application = application,
filterFragmentLifecycleBreadcrumbs = FragmentLifecycleState.values().toSet(),
enableAutoFragmentLifecycleTracing = false
)

constructor(
public constructor(
application: Application,
enableFragmentLifecycleBreadcrumbs: Boolean,
enableAutoFragmentLifecycleTracing: Boolean
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.sentry.android.fragment

enum class FragmentLifecycleState(internal val breadcrumbName: String) {
public enum class FragmentLifecycleState(internal val breadcrumbName: String) {
ATTACHED("attached"),
SAVE_INSTANCE_STATE("save instance state"),
CREATED("created"),
Expand Down