-
-
Notifications
You must be signed in to change notification settings - Fork 37
fix(ci): Fallback to AGP release notes for Gradle version lookup #1128
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
Changes from all commits
2cd6840
d676e04
ddf6db3
079ba77
2a5d322
f36ff24
9a53589
e0f8495
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 |
|---|---|---|
|
|
@@ -5,7 +5,7 @@ import java.util.Properties | |
| import org.gradle.api.tasks.testing.logging.TestLogEvent | ||
| import org.jetbrains.kotlin.config.KotlinCompilerVersion | ||
| import org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11 | ||
| import org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_8 | ||
| import org.jetbrains.kotlin.gradle.dsl.KotlinVersion | ||
| import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
|
||
| plugins { | ||
|
|
@@ -31,7 +31,7 @@ val fixtureClasspath: Configuration by configurations.creating | |
|
|
||
| dependencies { | ||
| compileOnly(libs.gradleApi) | ||
| compileOnly(Libs.AGP) | ||
| compileOnly(libs.agp) | ||
| compileOnly(libs.proguard) | ||
|
|
||
| implementation(libs.asm) | ||
|
|
@@ -91,8 +91,15 @@ tasks.withType<KotlinCompile>().configureEach { | |
|
|
||
| compilerOptions { | ||
| jvmTarget.set(JVM_11) | ||
| languageVersion.set(KOTLIN_1_8) | ||
| apiVersion.set(KOTLIN_1_8) | ||
| // Kotlin supports current + 3 previous language versions. | ||
| // We want 1.8, but if the compiler no longer supports it, use the oldest it does support. | ||
| // e.g. Kotlin 2.1 oldest=1.8, Kotlin 2.3 oldest=2.0 | ||
| val compilerParts = KotlinCompilerVersion.VERSION.split(".") | ||
| val compilerFlat = compilerParts[0].toInt() * 10 + compilerParts[1].toInt() | ||
| val oldestFlat = maxOf(compilerFlat - 3, 18) // 18 = Kotlin 1.8 | ||
| val kotlinLangVersion = KotlinVersion.valueOf("KOTLIN_${oldestFlat / 10}_${oldestFlat % 10}") | ||
|
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. Flat version encoding breaks for minor versions ≥ 10Low Severity The flat encoding
Member
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. don't think kotlin ever reaches 10, they usually bump the major version then |
||
| languageVersion.set(kotlinLangVersion) | ||
| apiVersion.set(kotlinLangVersion) | ||
| } | ||
| } | ||
|
|
||
|
|
||


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.
this means we're compiling against a static version of AGP as opposed to dynamic (so we don't hit compilation issues when some AGP APIs are removed, for example, even though we have a proper AGP version guard for those at runtime). Integration tests, however, still run against a dynamic version, so we're testing against newer AGP versions and if our plugin does not handle something yet those would still fail.