Skip to content

Commit 748eafb

Browse files
RBusarowkodiakhq[bot]
authored andcommitted
WIP updating to Kotlin 1.9.22
1 parent e756233 commit 748eafb

7 files changed

Lines changed: 72 additions & 90 deletions

File tree

.github/workflows/ci.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,17 @@ jobs:
243243
fail-fast: false
244244
### <start-versions-matrix>
245245
matrix:
246-
kotlin-version: [ 1.8.0, 1.8.10, 1.8.22 ]
247-
gradle-version: [ 8.0.2, 8.1.1, 8.4, 8.5 ]
246+
kotlin-version: [ 1.8.22, 1.9.10, 1.9.22 ]
247+
gradle-version: [ 8.5 ]
248248
agp-version: [ 8.0.2, 8.1.0 ]
249-
anvil-version: [ 2.4.6 ]
250-
exclude: [ ]
249+
anvil-version: [ 2.4.9-1-8, 2.4.9 ]
250+
exclude:
251+
- kotlin-version: 1.9.10
252+
anvil-version: 2.4.9-1-8
253+
- kotlin-version: 1.9.22
254+
anvil-version: 2.4.9-1-8
255+
- kotlin-version: 1.8.22
256+
anvil-version: 2.4.9
251257
### <end-versions-matrix>
252258
runs-on: ubuntu-latest
253259
steps:

build-logic/build.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2021-2023 Rick Busarow
2+
* Copyright (C) 2021-2024 Rick Busarow
33
* Licensed under the Apache License, Version 2.0 (the "License");
44
* you may not use this file except in compliance with the License.
55
* You may obtain a copy of the License at
@@ -30,7 +30,6 @@ moduleCheck {
3030
}
3131
}
3232

33-
val kotlinVersion = libs.versions.kotlin.get()
3433
val ktlintPluginId = libs.plugins.ktlint.get().pluginId
3534

3635
allprojects ap@{

build-logic/versions-matrix/build.gradle.kts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,6 @@
1313
* limitations under the License.
1414
*/
1515

16-
buildscript {
17-
dependencies {
18-
// Gradle 7.6 has a dependency resolution bug which tries to use Kotlin 1.7.10
19-
// for transitive dependencies like `sam-with-receiver`.
20-
// https://github.com/gradle/gradle/issues/22510
21-
classpath(libs.kotlin.sam.with.receiver)
22-
}
23-
}
24-
2516
plugins {
2617
base
2718
kotlin("jvm")
@@ -63,8 +54,6 @@ dependencies {
6354
implementation(libs.kotlin.stdlib.jdk7)
6455
implementation(libs.kotlin.stdlib.jdk8)
6556
implementation(libs.kotlinx.knit)
66-
implementation(libs.rickBusarow.kase)
67-
implementation(libs.rickBusarow.kase.gradle)
6857
implementation(libs.rickBusarow.ktlint)
6958
implementation(libs.scabbard)
7059
implementation(libs.square.anvil.gradle)

build-logic/versions-matrix/src/main/kotlin/modulecheck/builds/matrix/VersionsMatrix.kt

Lines changed: 13 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,17 @@
1616
package modulecheck.builds.matrix
1717

1818
class VersionsMatrix(
19-
val exhaustive: Boolean = false,
20-
private val gradleArg: String? = null,
21-
private val agpArg: String? = null,
22-
private val anvilArg: String? = null,
23-
private val kotlinArg: String? = null
19+
val gradleList: List<String>,
20+
val agpList: List<String>,
21+
val anvilList: List<String>,
22+
val kotlinList: List<String>
2423
) {
2524

26-
internal val gradleListDefault = listOf("8.0.2", "8.1.1", "8.4", "8.5")
27-
internal val agpListDefault = listOf("8.0.2", "8.1.0")
28-
internal val anvilListDefault = listOf("2.4.6")
29-
internal val kotlinListDefault = listOf("1.8.0", "1.8.10", "1.8.22")
30-
31-
val gradleList = gradleArg?.singletonList() ?: gradleListDefault
32-
val agpList = agpArg?.singletonList() ?: agpListDefault
33-
val anvilList = anvilArg?.singletonList() ?: anvilListDefault
34-
val kotlinList = kotlinArg?.singletonList() ?: kotlinListDefault
35-
36-
internal val exclusions = listOf<Exclusion>().requireNoDuplicates()
37-
38-
private val latest by lazy { allValid.last() }
39-
40-
val defaultGradle by lazy { gradleArg ?: latest.gradle }
41-
val defaultAgp by lazy { agpArg ?: latest.agp }
42-
val defaultAnvil by lazy { anvilArg ?: latest.anvil }
43-
val defaultKotlin by lazy { kotlinArg ?: latest.kotlin }
25+
internal val exclusions = listOf(
26+
Exclusion(anvil = "2.4.9-1-8", kotlin = "1.9.10"),
27+
Exclusion(anvil = "2.4.9-1-8", kotlin = "1.9.22"),
28+
Exclusion(anvil = "2.4.9", kotlin = "1.8.22")
29+
).requireNoDuplicates()
4430

4531
// ORDER MATTERS.
4632
// ...at least with regard to Gradle.
@@ -68,37 +54,21 @@ class VersionsMatrix(
6854
}
6955
}
7056

71-
val allValidDefaults = combinations(
72-
gradleList = gradleListDefault,
73-
agpList = agpListDefault,
74-
anvilList = anvilListDefault,
75-
kotlinList = kotlinListDefault
76-
).filtered(exclusions).requireNotEmpty()
77-
7857
val allValid = combinations(
7958
gradleList = gradleList,
8059
agpList = agpList,
8160
anvilList = anvilList,
8261
kotlinList = kotlinList
83-
).filtered(exclusions).requireNotEmpty()
62+
).filtered(exclusions)
63+
.requireNotEmpty()
8464

8565
init {
86-
8766
requireNoUselessExclusions()
8867
}
8968

9069
private fun List<TestVersions>.requireNotEmpty() = apply {
9170
require(isNotEmpty()) {
92-
val arguments = listOf(
93-
"gradle" to gradleArg,
94-
"agp" to agpArg,
95-
"anvil" to anvilArg,
96-
"kotlin" to kotlinArg
97-
).filter { pair -> pair.second != null }
98-
.map { (name, version) -> "$name=$version" }
99-
100-
"There are no valid version combinations to be made " +
101-
"from the provided arguments: $arguments"
71+
"There are no valid version combinations to be made from the provided arguments."
10272
}
10373
}
10474

@@ -117,7 +87,7 @@ class VersionsMatrix(
11787
private fun requireNoUselessExclusions() {
11888
// If we're using arguments, then the baseline `combinations` list will naturally be smaller.
11989
// This check can be skipped.
120-
if (listOfNotNull(gradleArg, agpArg, anvilArg, kotlinArg).isNotEmpty()) return
90+
// if (listOfNotNull(gradleArg, agpArg, anvilArg, kotlinArg).isNotEmpty()) return
12191

12292
val redundant = mutableListOf<Exclusion>()
12393

@@ -143,8 +113,6 @@ class VersionsMatrix(
143113
}
144114
}
145115

146-
private fun <T> T.singletonList() = listOf(this)
147-
148116
internal operator fun Collection<Exclusion>.contains(testVersions: TestVersions): Boolean {
149117
return any { testVersions.excludedBy(it) }
150118
}

build-logic/versions-matrix/src/main/kotlin/modulecheck/builds/matrix/VersionsMatrixExtension.kt

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ import com.rickbusarow.kgx.listProperty
2121
import com.rickbusarow.kgx.pluginId
2222
import com.rickbusarow.kgx.propertyOrNull
2323
import com.rickbusarow.kgx.version
24+
import modulecheck.builds.matrix.Versions.Companion.agpListDefault
25+
import modulecheck.builds.matrix.Versions.Companion.anvilListDefault
26+
import modulecheck.builds.matrix.Versions.Companion.gradleListDefault
27+
import modulecheck.builds.matrix.Versions.Companion.kotlinListDefault
2428
import org.gradle.api.Project
2529
import org.gradle.api.provider.ListProperty
2630
import org.gradle.kotlin.dsl.buildConfigField
@@ -35,16 +39,19 @@ open class Versions @Inject constructor(
3539

3640
val gradleList: ListProperty<String> = target.objects
3741
.listProperty<String>()
38-
.convention(propertyName = "modulecheck.gradleVersion", listOf("8.0.2", "8.1.1", "8.4", "8.5"))
42+
.convention(propertyName = "modulecheck.gradleVersion", gradleListDefault)
43+
3944
val agpList: ListProperty<String> = target.objects
4045
.listProperty<String>()
41-
.convention("modulecheck.agpVersion", listOf("8.0.2", "8.1.0"))
46+
.convention("modulecheck.agpVersion", agpListDefault)
47+
4248
val anvilList: ListProperty<String> = target.objects
4349
.listProperty<String>()
44-
.convention("modulecheck.anvilVersion", listOf("2.4.6"))
50+
.convention("modulecheck.anvilVersion", anvilListDefault)
51+
4552
val kotlinList: ListProperty<String> = target.objects
4653
.listProperty<String>()
47-
.convention("modulecheck.kotlinVersion", listOf("1.8.0", "1.8.10", "1.8.22"))
54+
.convention("modulecheck.kotlinVersion", kotlinListDefault)
4855

4956
private fun ListProperty<String>.convention(
5057
propertyName: String,
@@ -54,6 +61,13 @@ open class Versions @Inject constructor(
5461
.map { it.split("""\s*,\s*""".toRegex()) }
5562
.orElse(default)
5663
)
64+
65+
companion object {
66+
internal val gradleListDefault = listOf("8.5")
67+
internal val agpListDefault = listOf("8.0.2", "8.1.0")
68+
internal val anvilListDefault = listOf("2.4.9-1-8", "2.4.9")
69+
internal val kotlinListDefault = listOf("1.8.22", "1.9.10", "1.9.22")
70+
}
5771
}
5872

5973
open class VersionsMatrixExtension @Inject constructor(target: Project) : Serializable {
@@ -121,12 +135,17 @@ private fun Project.requireInSyncWithToml() {
121135
"Could not resolve the $simpleName file: $versionMatrixFile"
122136
}
123137

124-
with(VersionsMatrix()) {
138+
VersionsMatrix(
139+
gradleList = gradleListDefault,
140+
agpList = agpListDefault,
141+
anvilList = anvilListDefault,
142+
kotlinList = kotlinListDefault
143+
).run {
125144

126145
sequenceOf(
127146
Triple(agpList, "agpList", "androidTools"),
128147
Triple(anvilList, "anvilList", "square-anvil"),
129-
Triple(kotlinList, "kotlinList", "kotlin")
148+
Triple(kotlinList, "kotlinList", "kotlin-core")
130149
)
131150
.forEach { (list, listName, alias) ->
132151
require(list.contains(libsCatalog.version(alias))) {

build-logic/versions-matrix/src/main/kotlin/modulecheck/builds/matrix/VersionsMatrixYamlCheckTask.kt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2021-2023 Rick Busarow
2+
* Copyright (C) 2021-2024 Rick Busarow
33
* Licensed under the Apache License, Version 2.0 (the "License");
44
* you may not use this file except in compliance with the License.
55
* You may obtain a copy of the License at
@@ -101,11 +101,10 @@ abstract class VersionsMatrixYamlGenerateTask @Inject constructor(
101101

102102
private fun createYaml(indentSize: Int): String {
103103
val versionsMatrix = VersionsMatrix(
104-
exhaustive = true,
105-
gradleArg = null,
106-
agpArg = null,
107-
anvilArg = null,
108-
kotlinArg = null
104+
gradleList = Versions.gradleListDefault,
105+
agpList = Versions.agpListDefault,
106+
anvilList = Versions.anvilListDefault,
107+
kotlinList = Versions.kotlinListDefault
109108
)
110109

111110
return VersionsMatrixYamlGenerator()

gradle/libs.versions.toml

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ jdk = "17"
55
jvmTarget = "11"
66
kotlinApi = "1.6"
77

8-
kotlin = "1.8.22"
9-
google-ksp = "1.8.22-1.0.11"
10-
square-anvil = "2.4.6"
8+
kotlin-gradle = "1.9.22"
9+
kotlin-core = "1.9.22"
10+
google-ksp = "1.9.22-1.0.16"
11+
square-anvil = "2.4.9"
1112

1213
ajalt-clikt = "4.2.2"
1314
ajalt-mordant = "2.1.0"
@@ -101,9 +102,9 @@ exhaustive = { id = "app.cash.exhaustive:exhaustive-gradle", version.ref = "exha
101102
github-release = { id = "com.github.breadmoirai.github-release", version.ref = "github-release" }
102103
google-ksp = { id = "com.google.devtools.ksp", version.ref = "google-ksp" }
103104
gradle-plugin-publish = { id = "com.gradle.plugin-publish", version.ref = "gradle-plugin-publish" }
104-
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
105+
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin-gradle" }
105106
kotlinx-binaryCompatibility = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "kotlinx-binaryCompatibility" }
106-
kotlinx-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
107+
kotlinx-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin-core" }
107108
ktlint = { id = "com.rickbusarow.ktlint", version.ref = "rickBusarow-ktlint" }
108109
moduleCheck = { id = "com.rickbusarow.module-check", version.ref = "rickBusarow-moduleCheck" }
109110
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "johnrengelman-shadow" }
@@ -206,17 +207,18 @@ kotest-extensions = { module = "io.kotest:kotest-extensions", version.ref = "kot
206207
kotest-property-jvm = { module = "io.kotest:kotest-property-jvm", version.ref = "kotest" }
207208
kotest-runner-junit5-jvm = { module = "io.kotest:kotest-runner-junit5-jvm", version.ref = "kotest" }
208209

209-
kotlin-annotation-processing = { module = "org.jetbrains.kotlin:kotlin-annotation-processing-embeddable", version.ref = "kotlin" }
210-
kotlin-bom = { module = "org.jetbrains.kotlin:kotlin-bom", version.ref = "kotlin" }
211-
kotlin-compiler = { module = "org.jetbrains.kotlin:kotlin-compiler-embeddable", version.ref = "kotlin" }
212-
kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
213-
kotlin-gradle-plugin-api = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin-api", version.ref = "kotlin" }
214-
kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" }
215-
kotlin-sam-with-receiver = { module = "org.jetbrains.kotlin:kotlin-sam-with-receiver", version.ref = "kotlin" }
216-
kotlin-serialization = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin" }
217-
kotlin-stdlib-jdk7 = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk7", version.ref = "kotlin" }
218-
kotlin-stdlib-common = { module = "org.jetbrains.kotlin:kotlin-stdlib-common", version.ref = "kotlin" }
219-
kotlin-stdlib-jdk8 = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin" }
210+
kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin-gradle" }
211+
kotlin-gradle-plugin-api = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin-api", version.ref = "kotlin-gradle" }
212+
213+
kotlin-annotation-processing = { module = "org.jetbrains.kotlin:kotlin-annotation-processing-embeddable", version.ref = "kotlin-core" }
214+
kotlin-bom = { module = "org.jetbrains.kotlin:kotlin-bom", version.ref = "kotlin-core" }
215+
kotlin-compiler = { module = "org.jetbrains.kotlin:kotlin-compiler-embeddable", version.ref = "kotlin-core" }
216+
kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin-core" }
217+
kotlin-sam-with-receiver = { module = "org.jetbrains.kotlin:kotlin-sam-with-receiver", version.ref = "kotlin-core" }
218+
kotlin-serialization = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin-core" }
219+
kotlin-stdlib-jdk7 = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk7", version.ref = "kotlin-core" }
220+
kotlin-stdlib-common = { module = "org.jetbrains.kotlin:kotlin-stdlib-common", version.ref = "kotlin-core" }
221+
kotlin-stdlib-jdk8 = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin-core" }
220222

221223
kotlinx-binaryCompatibility = { module = "org.jetbrains.kotlinx:binary-compatibility-validator", version.ref = "kotlinx-binaryCompatibility" }
222224

0 commit comments

Comments
 (0)