Skip to content

Commit

Permalink
Bump Kotlin version to match Gradle version
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeWharton committed Sep 26, 2023
1 parent a8c1a89 commit c73dc53
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 2 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ kotlin {
jvmToolchain(11)
target {
compilations.configureEach {
// Ensure compatibility with old Gradle versions running Kotlin 1.4.
// When changing this value see kotlinCompatibility.kt and delete unnecessary backports.
compilerOptions.options.apiVersion.set(KotlinVersion.KOTLIN_1_4)
// Ensure compatibility with old Gradle versions. Keep in sync with LicenseePlugin.kt.
compilerOptions.options.apiVersion.set(KotlinVersion.KOTLIN_1_8)
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/main/kotlin/app/cash/licensee/plugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ private const val reportFolder = "licensee"
@Suppress("unused") // Instantiated reflectively by Gradle.
class LicenseePlugin : Plugin<Project> {
override fun apply(project: Project) {
// HEY! If you update the minimum-supported Gradle version check to see if the Kotlin language version
// can be bumped. See https://docs.gradle.org/current/userguide/compatibility.html#kotlin.
require(GradleVersion.current() >= GradleVersion.version("8.0")) {
"Licensee plugin requires Gradle 8.0 or later. Found ${GradleVersion.current()}"
}
Expand Down Expand Up @@ -143,7 +145,7 @@ private fun configureAndroidVariants(
) {
val androidComponents = project.extensions.getByType(AndroidComponentsExtension::class.java)
androidComponents.onVariants { variant ->
val suffix = variant.name.capitalize(ROOT)
val suffix = variant.name.replaceFirstChar { it.titlecase(ROOT) }
val taskName = "${baseTaskName}Android$suffix"

val task = project.tasks.configure(taskName) {
Expand Down Expand Up @@ -176,7 +178,7 @@ private fun configureKotlinMultiplatformTargets(
return@configureEach // handled by android logic.
}

val suffix = target.name.capitalize(ROOT)
val suffix = target.name.replaceFirstChar { it.titlecase(ROOT) }
val task = project.tasks.configure("$baseTaskName$suffix") {
it.group = VERIFICATION_GROUP
it.description = taskDescription("Kotlin ${target.name} target")
Expand Down

0 comments on commit c73dc53

Please sign in to comment.