Skip to content

Commit 30c8665

Browse files
authored
Merge pull request #375 from splendo/gitlive/kotlin-1.8.21-gradle-8
Upgrade to Kotlin 1.9.20 & gradle 8
2 parents f748d61 + c04da65 commit 30c8665

File tree

146 files changed

+2550
-1183
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+2550
-1183
lines changed

.github/ISSUE_TEMPLATE/increase-api-coverage.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ assignees: ''
77

88
---
99

10-
| Library | Class | Member | Platforms |
11-
| :-----------------| :------------------------ | :----------------------------------- | :---------------------- |
12-
| e.g auth | e.g FirebaseAuth | e.g signInWithGithub | e.g Android, iOS |
10+
| Library | Class | Member | Platforms |
11+
|:---------|:-----------------|:---------------------|:-----------------|
12+
| e.g auth | e.g FirebaseAuth | e.g signInWithGithub | e.g Android, iOS |
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: 'Setup Tests'
2+
description: 'Prepares to run tests on Firebase emulator'
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: Set up JDK
8+
uses: actions/setup-java@v3
9+
with:
10+
distribution: 'zulu'
11+
java-version: '17'
12+
cache: gradle
13+
- name: Set up Node.js
14+
uses: actions/setup-node@v4
15+
with:
16+
node-version: '21.x'
17+
- name: Upgrade packages
18+
shell: bash
19+
run: npm update
20+
- name: Gradle cache
21+
uses: gradle/gradle-build-action@v2
22+
- name: Grant execute permission for gradlew
23+
shell: bash
24+
run: chmod +x gradlew
25+
- name: Install Firebase tools
26+
shell: bash
27+
run: npm install -g firebase-tools
28+
- name: Start Firebase emulator
29+
shell: bash
30+
run: "firebase emulators:start --config=./test/firebase.json &"

.github/workflows/publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ env:
1515

1616
jobs:
1717
build:
18-
runs-on: macos-latest
18+
runs-on: macos-13
1919
steps:
2020
- uses: actions/checkout@v3
2121
- name: Set up JDK
2222
uses: actions/setup-java@v3
2323
with:
2424
distribution: 'zulu'
25-
java-version: '11'
25+
java-version: '17'
2626
- uses: gradle/gradle-build-action@v2
2727
- name: Setup versions
2828
run: ./gradlew :updateVersions

.github/workflows/pull_request.yml

Lines changed: 71 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -8,71 +8,31 @@ on:
88
branches: [ master ]
99

1010
jobs:
11-
build:
12-
runs-on: macos-latest
11+
build-android:
12+
runs-on: macos-13
1313
strategy:
1414
matrix:
15-
api-level: [ 29 ]
15+
api-level: [ 34 ]
1616
steps:
1717
- uses: actions/checkout@v3
18-
- name: Cocoapods cache
19-
uses: actions/cache@v3
20-
id: cocoapods-cache
21-
with:
22-
path: |
23-
~/.cocoapods
24-
~/Library/Caches/CocoaPods
25-
*/build/cocoapods
26-
*/build/classes
27-
key: cocoapods-cache
28-
- name: Set up JDK
29-
uses: actions/setup-java@v3
30-
with:
31-
distribution: 'zulu'
32-
java-version: '11'
33-
cache: gradle
34-
- name: Gradle cache
35-
uses: gradle/gradle-build-action@v2
36-
- name: Grant execute permission for gradlew
37-
run: chmod +x gradlew
38-
- name: Install Firebase tools
39-
run: npm install -g firebase-tools
40-
- name: Start Firebase emulator
41-
run: "firebase emulators:start --config=./test/firebase.json &"
42-
- name: Assemble
43-
run: ./gradlew assemble
44-
- name: Run JS Tests
45-
run: ./gradlew cleanTest jsLegacyTest
46-
- name: Upload JS test artifact
47-
uses: actions/upload-artifact@v3
48-
if: failure()
49-
with:
50-
name: "JS Test Report HTML"
51-
path: |
52-
**/build/reports/tests/jsLegacyTest/
53-
**/build/reports/tests/jsLegacyBrowserTest/
54-
**/build/reports/tests/jsLegacyNodeTest/
55-
- name: Run iOS Tests
56-
run: ./gradlew cleanTest iosX64Test
57-
- name: Upload iOS test artifact
58-
uses: actions/upload-artifact@v3
59-
if: failure()
60-
with:
61-
name: "iOS Test Report HTML"
62-
path: "**/build/reports/tests/iosX64Test/"
18+
- name: Setup test environment
19+
uses: ./.github/actions/setup_test_action
6320
- name: AVD cache
6421
uses: actions/cache@v3
6522
id: avd-cache
6623
with:
6724
path: |
6825
~/.android/avd/*
6926
~/.android/adb*
70-
key: avd-${{ matrix.api-level }}
27+
key: avd-${{ matrix.api-level }}-${{ runner.os }}-${{ runner.arch }}
7128
- name: create AVD and generate snapshot for caching
7229
if: steps.avd-cache.outputs.cache-hit != 'true'
7330
uses: reactivecircus/android-emulator-runner@v2
7431
with:
7532
api-level: ${{ matrix.api-level }}
33+
arch: x86_64
34+
target: google_apis
35+
avd-name: pixel6_API${{ matrix.api-level }}
7636
force-avd-creation: false
7737
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
7838
disable-animations: false
@@ -81,6 +41,9 @@ jobs:
8141
uses: reactivecircus/android-emulator-runner@v2
8242
with:
8343
api-level: ${{ matrix.api-level }}
44+
arch: x86_64
45+
target: google_apis
46+
avd-name: pixel6_API${{ matrix.api-level }}
8447
force-avd-creation: false
8548
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
8649
disable-animations: true
@@ -91,3 +54,62 @@ jobs:
9154
with:
9255
name: "Android Test Report HTML"
9356
path: "**/build/reports/androidTests/"
57+
- name: Upload Firebase Debug Log
58+
uses: actions/upload-artifact@v3
59+
if: failure()
60+
with:
61+
name: "Firebase Debug Log"
62+
path: "**/firebase-debug.log"
63+
build-js:
64+
runs-on: ubuntu-latest
65+
steps:
66+
- uses: actions/checkout@v3
67+
- name: Setup test environment
68+
uses: ./.github/actions/setup_test_action
69+
- name: Run JS Tests
70+
run: ./gradlew cleanTest jsTest
71+
- name: Upload JS test artifact
72+
uses: actions/upload-artifact@v3
73+
if: failure()
74+
with:
75+
name: "JS Test Report HTML"
76+
path: |
77+
**/build/reports/tests/jsTest/
78+
**/build/reports/tests/jsBrowserTest/
79+
**/build/reports/tests/jsNodeTest/
80+
- name: Upload Firebase Debug Log
81+
uses: actions/upload-artifact@v3
82+
if: failure()
83+
with:
84+
name: "Firebase Debug Log"
85+
path: "**/firebase-debug.log"
86+
build-ios:
87+
runs-on: macos-13
88+
steps:
89+
- uses: actions/checkout@v3
90+
- name: Cocoapods cache
91+
uses: actions/cache@v3
92+
id: cocoapods-cache
93+
with:
94+
path: |
95+
~/.cocoapods
96+
~/Library/Caches/CocoaPods
97+
*/build/cocoapods
98+
*/build/classes
99+
key: cocoapods-cache
100+
- name: Setup test environment
101+
uses: ./.github/actions/setup_test_action
102+
- name: Run iOS Tests
103+
run: ./gradlew cleanTest iosX64Test
104+
- name: Upload iOS test artifact
105+
uses: actions/upload-artifact@v3
106+
if: failure()
107+
with:
108+
name: "iOS Test Report HTML"
109+
path: "**/build/reports/tests/iosX64Test/"
110+
- name: Upload Firebase Debug Log
111+
uses: actions/upload-artifact@v3
112+
if: failure()
113+
with:
114+
name: "Firebase Debug Log"
115+
path: "**/firebase-debug.log"

.gitignore

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,9 @@
55
local.properties
66
/**/*.iml
77
*.iml
8-
firebase-app/src/nativeInterop/cinterop/modules/
9-
firebase-functions/src/nativeInterop/cinterop/modules/
10-
firebase-auth/src/nativeInterop/cinterop/modules/
11-
firebase-firestore/src/nativeInterop/cinterop/modules/
12-
firebase-database/src/nativeInterop/cinterop/modules/
138
Firebase*.zip
149
/Firebase
15-
/.DS_Store
10+
.DS_Store
1611
*.log
17-
18-
19-
/**/nativeInterop/cinterop/Cartfile.resolved
20-
/**/nativeInterop/cinterop/Carthage/
12+
/kotlin-js-store/
2113
/kotlin-js-store/yarn.lock

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ The Firebase Kotlin SDK uses Kotlin serialization to read and write custom class
7070

7171
```groovy
7272
plugins {
73-
kotlin("multiplatform") version "1.8.20" // or kotlin("jvm") or any other kotlin plugin
74-
kotlin("plugin.serialization") version "1.8.20"
73+
kotlin("multiplatform") version "1.8.21" // or kotlin("jvm") or any other kotlin plugin
74+
kotlin("plugin.serialization") version "1.8.21"
7575
}
7676
```
7777

@@ -161,17 +161,17 @@ To reduce boilerplate, default arguments are used in the places where the Fireba
161161
UserProfileChangeRequest profileUpdates = new UserProfileChangeRequest.Builder()
162162
.setDisplayName("Jane Q. User")
163163
.setPhotoUri(Uri.parse("https://example.com/jane-q-user/profile.jpg"))
164-
.build();
164+
.build()
165165

166166
user.updateProfile(profileUpdates)
167167
.addOnCompleteListener(new OnCompleteListener<Void>() {
168168
@Override
169169
public void onComplete(@NonNull Task<Void> task) {
170170
if (task.isSuccessful()) {
171-
Log.d(TAG, "User profile updated.");
171+
Log.d(TAG, "User profile updated.")
172172
}
173173
}
174-
});
174+
})
175175

176176
//...becomes...
177177

build.gradle.kts

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
22
import org.gradle.api.tasks.testing.logging.TestLogEvent
3+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
34

45
repositories {
56
google()
67
mavenCentral()
78
}
89

910
plugins {
10-
kotlin("multiplatform") version "1.8.20" apply false
11-
kotlin("native.cocoapods") version "1.8.20" apply false
11+
kotlin("multiplatform") apply false
12+
kotlin("native.cocoapods") apply false
1213
id("base")
1314
id("com.github.ben-manes.versions") version "0.42.0"
1415
}
@@ -23,17 +24,17 @@ buildscript {
2324
}
2425
}
2526
dependencies {
26-
classpath("com.android.tools.build:gradle:7.2.2")
27-
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.20-RC")
27+
classpath("com.android.tools.build:gradle:${project.extra["gradlePluginVersion"]}")
28+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.extra["kotlinVersion"]}")
2829
classpath("com.adarshr:gradle-test-logger-plugin:3.2.0")
2930
}
3031
}
3132

32-
val targetSdkVersion by extra(32)
33-
val minSdkVersion by extra(19)
33+
val compileSdkVersion by extra(34)
34+
val minSdkVersion by extra(23)
3435

3536
tasks {
36-
val updateVersions by registering {
37+
register("updateVersions") {
3738
dependsOn(
3839
"firebase-app:updateVersion", "firebase-app:updateDependencyVersion",
3940
"firebase-auth:updateVersion", "firebase-auth:updateDependencyVersion",
@@ -52,7 +53,7 @@ tasks {
5253
subprojects {
5354

5455
group = "dev.gitlive"
55-
56+
5657
apply(plugin = "com.adarshr.test-logger")
5758

5859
repositories {
@@ -88,11 +89,11 @@ subprojects {
8889

8990
if (skipPublishing) return@tasks
9091

91-
val updateVersion by registering(Exec::class) {
92+
register<Exec>("updateVersion") {
9293
commandLine("npm", "--allow-same-version", "--prefix", projectDir, "version", "${project.property("${project.name}.version")}")
9394
}
9495

95-
val updateDependencyVersion by registering(Copy::class) {
96+
register<Copy>("updateDependencyVersion") {
9697
mustRunAfter("updateVersion")
9798
val from = file("package.json")
9899
from.writeText(
@@ -106,28 +107,30 @@ subprojects {
106107

107108
afterEvaluate {
108109

110+
val coroutinesVersion: String by project
111+
val firebaseBoMVersion: String by project
112+
109113
dependencies {
110-
"commonMainImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
111-
"androidMainImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.6.4")
112-
"androidMainImplementation"(platform("com.google.firebase:firebase-bom:32.3.1"))
114+
"commonMainImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
115+
"androidMainImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$coroutinesVersion")
116+
"androidMainImplementation"(platform("com.google.firebase:firebase-bom:$firebaseBoMVersion"))
113117
"commonTestImplementation"(kotlin("test-common"))
114118
"commonTestImplementation"(kotlin("test-annotations-common"))
115-
"commonTestImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
116-
"commonTestImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4")
117119
if (this@afterEvaluate.name != "firebase-crashlytics") {
118120
"jvmMainApi"("dev.gitlive:firebase-java-sdk:0.1.2")
119-
"jvmMainApi"("org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.6.0") {
121+
"jvmMainApi"("org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$coroutinesVersion") {
120122
exclude("com.google.android.gms")
121123
}
122124
"jsTestImplementation"(kotlin("test-js"))
123125
"jvmTestImplementation"(kotlin("test-junit"))
124126
"jvmTestImplementation"("junit:junit:4.13.2")
125127
}
126-
"androidAndroidTestImplementation"(kotlin("test-junit"))
127-
"androidAndroidTestImplementation"("junit:junit:4.13.2")
128-
"androidAndroidTestImplementation"("androidx.test:core:1.4.0")
129-
"androidAndroidTestImplementation"("androidx.test.ext:junit:1.1.3")
130-
"androidAndroidTestImplementation"("androidx.test:runner:1.4.0")
128+
"androidInstrumentedTestImplementation"(kotlin("test-junit"))
129+
"androidUnitTestImplementation"(kotlin("test-junit"))
130+
"androidInstrumentedTestImplementation"("junit:junit:4.13.2")
131+
"androidInstrumentedTestImplementation"("androidx.test:core:1.5.0")
132+
"androidInstrumentedTestImplementation"("androidx.test.ext:junit:1.1.5")
133+
"androidInstrumentedTestImplementation"("androidx.test:runner:1.5.2")
131134
}
132135
}
133136

@@ -145,6 +148,7 @@ subprojects {
145148
repositories {
146149
maven {
147150
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2")
151+
148152
credentials {
149153
username = project.findProperty("sonatypeUsername") as String? ?: System.getenv("sonatypeUsername")
150154
password = project.findProperty("sonatypePassword") as String? ?: System.getenv("sonatypePassword")
@@ -193,12 +197,16 @@ subprojects {
193197
}
194198

195199
}
200+
201+
tasks.withType(AbstractPublishToMaven::class.java).configureEach {
202+
dependsOn(tasks.withType(Sign::class.java))
203+
}
196204
}
197205

198206
tasks.withType<com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask> {
199207

200208
fun isNonStable(version: String): Boolean {
201-
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.toUpperCase().contains(it) }
209+
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.uppercase(java.util.Locale.ENGLISH).contains(it) }
202210
val versionMatch = "^[0-9,.v-]+(-r)?$".toRegex().matches(version)
203211

204212
return (stableKeyword || versionMatch).not()

0 commit comments

Comments
 (0)