-
-
Notifications
You must be signed in to change notification settings - Fork 475
build: Bump AGP to 9.2.1 and migrate Android modules #5779
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -113,6 +113,20 @@ allprojects { | |
| subprojects { | ||
| apply { plugin("io.sentry.spotless") } | ||
|
|
||
| // AGP 9.2 bundles lint 9.2.1, which flags compileSdk 36 as outdated because 37 is available. | ||
| // We intentionally stay on compileSdk 36 until the API 37 bump (#5768), so silence that check | ||
| // for every Android module (library and application). | ||
| pluginManager.withPlugin("com.android.library") { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should remove this once we bump to compile/target sdk 37 |
||
| extensions.configure<com.android.build.gradle.BaseExtension> { | ||
|
runningcode marked this conversation as resolved.
|
||
| lintOptions { disable("GradleDependency") } | ||
| } | ||
| } | ||
| pluginManager.withPlugin("com.android.application") { | ||
| extensions.configure<com.android.build.gradle.BaseExtension> { | ||
| lintOptions { disable("GradleDependency") } | ||
| } | ||
| } | ||
|
|
||
| plugins.withId(Config.QualityPlugins.detektPlugin) { | ||
| configure<DetektExtension> { | ||
| buildUponDefaultConfig = true | ||
|
|
@@ -168,6 +182,18 @@ subprojects { | |
| } | ||
| } | ||
|
|
||
| // AGP 9 defaults Android modules to Java 11. Pin the published library modules back | ||
| // to Java 8 so their bytecode stays consumable by Java 8 projects, mirroring the | ||
| // java-library pin above. | ||
| plugins.withId("com.android.library") { | ||
| configure<com.android.build.gradle.BaseExtension> { | ||
| compileOptions { | ||
| sourceCompatibility = JavaVersion.VERSION_1_8 | ||
| targetCompatibility = JavaVersion.VERSION_1_8 | ||
| } | ||
| } | ||
| } | ||
|
|
||
| apply<MavenPublishPlugin>() | ||
|
|
||
| afterEvaluate { | ||
|
|
||
| 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.gradle.dsl.JvmTarget.JVM_1_8 | ||
|
|
||
| plugins { | ||
| id("com.android.library") | ||
|
|
@@ -33,7 +34,11 @@ android { | |
| getByName("release") { consumerProguardFiles("proguard-rules.pro") } | ||
| } | ||
|
|
||
| kotlin { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8 } | ||
| // AGP 9 only generates unit tests for the testBuildType. CI disables the debug | ||
| // variant, so unit tests must target release to run at all. | ||
| testBuildType = "release" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Release tests forced outside CIMedium Severity
Additional Locations (2)Reviewed by Cursor Bugbot for commit 7d0c248. Configure here. |
||
|
|
||
| kotlin { compilerOptions.jvmTarget = JVM_1_8 } | ||
|
|
||
| testOptions { | ||
| animationsDisabled = true | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -91,7 +91,7 @@ public SentryFrameMetricsCollector( | |
| } | ||
|
|
||
| @SuppressWarnings("deprecation") | ||
| @SuppressLint({"NewApi", "PrivateApi"}) | ||
| @SuppressLint({"NewApi", "PrivateApi", "DiscouragedPrivateApi"}) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is the |
||
| public SentryFrameMetricsCollector( | ||
| final @NotNull Context context, | ||
| final @NotNull ILogger logger, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,6 +47,7 @@ | |
| android:layout_height="wrap_content" | ||
| android:hint="Your Name" | ||
| android:inputType="textPersonName" | ||
| android:autofillHints="name" | ||
| android:background="@drawable/sentry_edit_text_border" | ||
| android:paddingHorizontal="8dp" | ||
| android:layout_below="@id/sentry_dialog_user_feedback_txt_name" /> | ||
|
|
@@ -66,6 +67,7 @@ | |
| android:layout_height="wrap_content" | ||
| android:hint="[email protected]" | ||
| android:inputType="textEmailAddress" | ||
| android:autofillHints="emailAddress" | ||
| android:background="@drawable/sentry_edit_text_border" | ||
| android:paddingHorizontal="8dp" | ||
| android:layout_below="@id/sentry_dialog_user_feedback_txt_email" /> | ||
|
|
@@ -85,6 +87,7 @@ | |
| android:layout_height="wrap_content" | ||
| android:lines="6" | ||
| android:inputType="textMultiLine" | ||
| android:importantForAutofill="no" | ||
| android:gravity="top|left" | ||
| android:hint="What's the bug? What did you expect?" | ||
| android:background="@drawable/sentry_edit_text_border" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,8 +8,10 @@ import org.junit.Assert.assertTrue | |
| import org.junit.Before | ||
| import org.junit.Test | ||
| import org.junit.runner.RunWith | ||
| import org.robolectric.annotation.Config | ||
|
|
||
| @RunWith(AndroidJUnit4::class) | ||
| @Config(sdk = [35]) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should investigate and/or update robolectric to fix the failure this was causing in a separate PR |
||
| class UpdateResponseParserTest { | ||
|
|
||
| private lateinit var options: SentryOptions | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| import io.gitlab.arturbosch.detekt.Detekt | ||
| import net.ltgt.gradle.errorprone.errorprone | ||
| import org.jetbrains.kotlin.gradle.dsl.JvmTarget | ||
|
|
||
| plugins { | ||
| id("com.android.application") | ||
|
|
@@ -64,12 +65,12 @@ android { | |
| } | ||
| } | ||
|
|
||
| kotlin { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8 } | ||
| kotlin { compilerOptions.jvmTarget = JvmTarget.JVM_11 } | ||
|
|
||
| lint { | ||
| warningsAsErrors = true | ||
| checkDependencies = true | ||
| // Suppress OldTargetApi: lint 8.13.1 expects API 37 but we target 36 | ||
| // Suppress OldTargetApi: lint 9.2.1 expects API 37 but we target 36 | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should remove this once we bump the SDK |
||
| disable += "OldTargetApi" | ||
|
|
||
| // We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| import io.gitlab.arturbosch.detekt.Detekt | ||
| import org.jetbrains.kotlin.gradle.dsl.JvmTarget | ||
|
|
||
| plugins { | ||
| id("com.android.application") | ||
|
|
@@ -31,7 +32,7 @@ android { | |
| proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") | ||
| } | ||
| } | ||
| kotlin { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8 } | ||
| kotlin { compilerOptions.jvmTarget = JvmTarget.JVM_11 } | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AGP defaults to 11 now. Since these are our UI tests, it doesn't affect the compiled artifact. |
||
| buildFeatures { compose = true } | ||
| composeOptions { kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() } | ||
| androidComponents.beforeVariants { | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reminder: we publish the entry-android artifact compiled against 9.2.1 as set in
Config.ktbelow. this test compiles the sentry-android artifact against different versions of AGP meaning the tests do not represent our published artifact