Skip to content

Commit 9440c54

Browse files
authored
Migrate to kotlin v2 compiler (#2816)
* Migrate to kotlin v2 compiler also updates ksp and room to versions with support for k2 * Update compile sdk to API 36 * Run spotless * Fix lint error Error: Call requires API level 34 (current min is 26): java.util.stream.Stream#toList [NewApi] .toList() * Replace depracted toUpperCase() with uppercase() * Increase timeout for github ci build * Update ci actions to use jdk-21 * Update kokoro script and firebaseTestLab devices * Set api-33 as the target sdk
1 parent 480fd79 commit 9440c54

File tree

13 files changed

+49
-32
lines changed

13 files changed

+49
-32
lines changed

.github/actions/commonSetup/action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ description: "Prepares the machine"
33
runs:
44
using: "composite"
55
steps:
6-
- name: Set up JDK 17
7-
uses: actions/setup-java@v2
6+
- name: Set up JDK 21
7+
uses: actions/setup-java@v4
88
with:
99
distribution: temurin
10-
java-version: "17"
10+
java-version: "21"
1111

1212
- name: "Setup Gradle"
1313
uses: gradle/gradle-build-action@v2

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
# Build will compile APK, test APK and run tests, lint, etc.
4646
build:
4747
runs-on: 'ubuntu-24.04-8core'
48-
timeout-minutes: 60
48+
timeout-minutes: 90
4949
permissions:
5050
actions: read
5151
contents: read

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,6 @@ site/
9494
# (which is slightly confusing, but helps mkdocs to validate links)
9595
# so we ignore that here, as it's a built artifact that should not be committed
9696
docs/use/api/*/**
97+
98+
# Kotlin 2.0
99+
.kotlin/

buildSrc/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ repositories {
1111
dependencies {
1212
implementation("com.diffplug.spotless:spotless-plugin-gradle:6.22.0")
1313

14-
implementation("com.android.tools.build:gradle:8.5.0")
14+
implementation("com.android.tools.build:gradle:8.9.2")
1515

1616
implementation("app.cash.licensee:licensee-gradle-plugin:1.8.0")
1717
implementation("com.osacky.flank.gradle:fladle:0.17.4")

buildSrc/src/main/kotlin/FirebaseTestLabConfig.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023 Google LLC
2+
* Copyright 2023-2025 Google LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -43,7 +43,7 @@ fun Project.configureFirebaseTestLabForLibraries() {
4343
),
4444
mapOf(
4545
"model" to "MediumPhone.arm",
46-
"version" to "${project.extensions.getByType(LibraryExtension::class.java).compileSdk}",
46+
"version" to "33",
4747
"locale" to "en_US",
4848
),
4949
),
@@ -67,7 +67,7 @@ fun Project.configureFirebaseTestLabForMicroBenchmark() {
6767
listOf(
6868
mapOf(
6969
"model" to "panther",
70-
"version" to "${project.extensions.getByType(LibraryExtension::class.java).compileSdk}",
70+
"version" to "33",
7171
"locale" to "en_US",
7272
),
7373
),

buildSrc/src/main/kotlin/Plugins.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023-2024 Google LLC
2+
* Copyright 2023-2025 Google LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -35,17 +35,18 @@ object Plugins {
3535
const val androidGradlePlugin = "com.android.tools.build:gradle:${Versions.androidGradlePlugin}"
3636
const val benchmarkGradlePlugin =
3737
"androidx.benchmark:benchmark-gradle-plugin:${Versions.benchmarkPlugin}"
38-
const val kotlinGradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.22"
38+
const val kotlinGradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}"
3939
const val navSafeArgsGradlePlugin = "androidx.navigation:navigation-safe-args-gradle-plugin:2.6.0"
4040
const val rulerGradlePlugin = "com.spotify.ruler:ruler-gradle-plugin:1.2.1"
4141
const val flankGradlePlugin = "com.osacky.flank.gradle:fladle:0.17.4"
4242
const val kspGradlePlugin =
4343
"com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:${Versions.kspPlugin}"
4444

4545
object Versions {
46-
const val androidGradlePlugin = "8.5.0"
46+
const val androidGradlePlugin = "8.9.2"
4747
const val benchmarkPlugin = "1.1.0"
4848
const val dokka = "1.9.20"
49-
const val kspPlugin = "1.9.22-1.0.18"
49+
const val kspPlugin = "2.1.20-2.0.1"
50+
const val kotlin = "2.1.20"
5051
}
5152
}

buildSrc/src/main/kotlin/Sdk.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023-2024 Google LLC
2+
* Copyright 2023-2025 Google LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -15,8 +15,8 @@
1515
*/
1616

1717
object Sdk {
18-
const val COMPILE_SDK = 33
19-
const val TARGET_SDK = 31
18+
const val COMPILE_SDK = 36
19+
const val TARGET_SDK = 33
2020

2121
// Engine and SDC must support API 24.
2222
// Remove desugaring when upgrading it to 26.

engine/src/main/java/com/google/android/fhir/db/impl/SQLCipherSupportHelper.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023-2024 Google LLC
2+
* Copyright 2023-2025 Google LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -74,7 +74,8 @@ internal class SQLCipherSupportHelper(
7474
}
7575
}
7676

77-
override val databaseName = standardHelper.databaseName
77+
override val databaseName
78+
get() = standardHelper.databaseName
7879

7980
override fun setWriteAheadLoggingEnabled(enabled: Boolean) {
8081
standardHelper.setWriteAheadLoggingEnabled(enabled)
@@ -119,7 +120,8 @@ internal class SQLCipherSupportHelper(
119120
throw lastException ?: DatabaseEncryptionException(Exception(), UNKNOWN)
120121
}
121122

122-
override val readableDatabase = writableDatabase
123+
override val readableDatabase
124+
get() = writableDatabase
123125

124126
override fun close() {
125127
standardHelper.close()

engine/src/main/java/com/google/android/fhir/testing/Utilities.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023-2024 Google LLC
2+
* Copyright 2023-2025 Google LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -131,7 +131,6 @@ internal open class TestDownloadManagerImpl(
131131

132132
override suspend fun getSummaryRequestUrls() =
133133
queries
134-
.stream()
135134
.map { ResourceType.fromCode(it.substringBefore("?")) to it.plus("?_summary=count") }
136135
.toList()
137136
.toMap()

engine/src/test/java/com/google/android/fhir/index/SearchParameterRepositoryGeneratedTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023 Google LLC
2+
* Copyright 2023-2025 Google LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -43,7 +43,7 @@ class SearchParameterRepositoryGeneratedTest(private val resource: Resource) {
4343
.map {
4444
SearchParamDefinition(
4545
it.name,
46-
Enumerations.SearchParamType.valueOf(it.type.toUpperCase()),
46+
Enumerations.SearchParamType.valueOf(it.type.uppercase()),
4747
it.path,
4848
)
4949
}

0 commit comments

Comments
 (0)