Skip to content

ci(agp-matrix): Generate compatibility matrix dynamically#873

Merged
romtsn merged 31 commits intomainfrom
rz/ci/generate-compat-matrix
Jun 25, 2025
Merged

ci(agp-matrix): Generate compatibility matrix dynamically#873
romtsn merged 31 commits intomainfrom
rz/ci/generate-compat-matrix

Conversation

@romtsn
Copy link
Copy Markdown
Member

@romtsn romtsn commented Apr 29, 2025

📜 Description

  • Introduces a new script to fetch AGP and Gradle versions dynamically
    • Uses google maven index to fetch AGP versions
    • Uses AGP-Gradle html compat table to infer the supported Gradle version
    • Uses Kotlin-Gradle html compat table to infer the min supported Gradle version for the current Kotlin version (will parameterize it in the following PRs too)
    • We now test against two pre-release AGP versions, latest stable and a previous major stable
  • The output of the script is a json payload which is then being fed into github actions and consumed by the job that runs integration tests
  • Also adds a schedule for the test matrix job to run nightly so we get notified early even if there's no activity on the repo

💡 Motivation and Context

To proactively test against newest AGP and Gradle versions

💚 How did you test it?

📝 Checklist

  • I reviewed the submitted code
  • I added tests to verify the changes
  • I updated the docs if needed
  • No breaking changes

🔮 Next steps

@romtsn romtsn mentioned this pull request May 14, 2025
@romtsn romtsn marked this pull request as ready for review June 25, 2025 09:39
Comment thread .github/workflows/test-matrix-agp-gradle.yaml Outdated
Copy link
Copy Markdown
Contributor

@runningcode runningcode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good! i hope those pages remain stable!

Comment thread scripts/generate-compat-matrix.main.kts Outdated
private fun fetchKotlinGradleCompatibility(): Map<VersionRange, VersionRange> {
return try {
// Parse the official Kotlin documentation page for compatibility info
val html = URL("https://kotlinlang.org/docs/gradle-configure-project.html").readText()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes! ive been looking for this documentation justification for raising out minimum kotlin version compatibility. will ping you separately about this

val html = URL("https://kotlinlang.org/docs/gradle-configure-project.html").readText()
val doc = Jsoup.parse(html)

// Look for the compatibility table
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this makes us dependent on the structure of the page. hopefully it is stable🤞

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah that's not ideal but I think it will stay like that for a while. Otherwise we'd have to find an alternative (like looking at the kotlin github repo perhaps)

Comment thread gradle.properties
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
# For AGP matrix tests, we can't infer the correct Gradle version for pre-releases
android.overrideVersionCheck=true
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What exactly does this do? It seems to me that it checks that the running Gradle version is compatible with AGP version?

Why do we need this in the parent build? Is it just while we are running the entire build with different versions of Gradle?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it just while we are running the entire build with different versions of Gradle?

yep that's the reason! Was failing here without that flag: https://github.com/getsentry/sentry-android-gradle-plugin/actions/runs/14733865730/job/41354917196?pr=873

Comment thread gradle/libs.versions.toml
@@ -17,6 +17,7 @@ kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlinSpring = { id = "org.jetbrains.kotlin.plugin.spring", version.ref = "kotlin" }
kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we still need kapt?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, it's used in the compiler plugin for AutoService

Co-authored-by: Nelson Osacky <nelson.osacky@sentry.io>
Comment thread scripts/generate-compat-matrix.main.kts Outdated
@romtsn romtsn merged commit ddcd098 into main Jun 25, 2025
17 checks passed
@romtsn romtsn deleted the rz/ci/generate-compat-matrix branch June 25, 2025 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants