Skip to content
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

Upgrade to Kotlin 1.9.20 & gradle 8 #375

Merged
merged 36 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
76e1f43
Move to Kotlin 1.8.21 & gradle 8
Daeda88 May 15, 2023
7fe7a64
Fixes to fix CI + cleanup
Daeda88 May 16, 2023
010e672
Fixed some gradle warnings
Daeda88 May 16, 2023
3525b90
Fixing Android emulator
Daeda88 May 16, 2023
c53dff1
Raise coroutines/serialization version
Daeda88 May 16, 2023
46cf087
More fixes (temp comment out assemble)
Daeda88 May 16, 2023
6536957
With assemble
Daeda88 May 16, 2023
13b0d2b
Merge branch 'master' into gitlive/kotlin-1.8.21-gradle-8
nbransby Jun 10, 2023
31035f5
Merge remote-tracking branch 'GitLiveApp/master' into gitlive/kotlin-…
Daeda88 Jun 12, 2023
539aef5
Merge branch 'master' into gitlive/kotlin-1.8.21-gradle-8
nbransby Jun 18, 2023
76445e7
Fix test-utils
Daeda88 Jun 20, 2023
361c007
Fixed issues for AndroidUnitTest
Daeda88 Jun 20, 2023
87d408f
Merge remote-tracking branch 'GitLiveApp/master' into gitlive/kotlin-…
Daeda88 Sep 15, 2023
18711c1
Ugrade to Kotlin 1.9.10 & fix tracking issues
Daeda88 Sep 15, 2023
f372c41
Raise firebase versions
Daeda88 Sep 18, 2023
8453cb6
Merge remote-tracking branch 'GitLiveApp/master' into gitlive/kotlin-…
Daeda88 Sep 19, 2023
8625a27
Cleanup/test fixes
Daeda88 Sep 19, 2023
1894f16
Fixing tests
Daeda88 Sep 26, 2023
7071613
Merge remote-tracking branch 'GitLiveApp/master' into gitlive/kotlin-…
Daeda88 Sep 26, 2023
4097460
Try raising timeout to something high
Daeda88 Sep 26, 2023
ca18a49
Remove assemble to speed up CI for js tests & make runTest > 10sec
Daeda88 Sep 26, 2023
6755ff9
More timeouts
Daeda88 Sep 26, 2023
90d08cf
Raise await DB connection
Daeda88 Sep 26, 2023
267bfd1
Raising min SDK from 19 to 23
Daeda88 Sep 27, 2023
d018176
Fix for publishing
Daeda88 Sep 27, 2023
d58c6b5
Raise pod versions
Daeda88 Sep 27, 2023
4caba6b
Enforce tests to start with clean Firebase app
Daeda88 Sep 27, 2023
4d3e7c5
Run on API 34
Daeda88 Sep 27, 2023
f3f693a
Better test cleanup
Daeda88 Sep 27, 2023
5dd6145
Fix for ios tests
Daeda88 Sep 27, 2023
69848e5
Merge pull request #64 from splendo/feature/kotlin-1.9.20
Daeda88 Nov 17, 2023
5457ddf
Merge remote-tracking branch 'GitLiveApp/master' into gitlive/kotlin-…
Daeda88 Nov 17, 2023
ad0ea39
Use Firebase 10.17
Daeda88 Nov 20, 2023
299ab66
Explicit linking to prevent some issues
Daeda88 Nov 20, 2023
cdf4a0c
Try ubuntu latest + upgrade to kotlin 1.9.21
Daeda88 Dec 5, 2023
c04da65
Android on MacOS 13
Daeda88 Dec 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/increase-api-coverage.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ assignees: ''

---

| Library | Class | Member | Platforms |
| :-----------------| :------------------------ | :----------------------------------- | :---------------------- |
| e.g auth | e.g FirebaseAuth | e.g signInWithGithub | e.g Android, iOS |
| Library | Class | Member | Platforms |
|:---------|:-----------------|:---------------------|:-----------------|
| e.g auth | e.g FirebaseAuth | e.g signInWithGithub | e.g Android, iOS |
30 changes: 30 additions & 0 deletions .github/actions/setup_test_action/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: 'Setup Tests'
description: 'Prepares to run tests on Firebase emulator'

runs:
using: "composite"
steps:
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
cache: gradle
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '21.x'
- name: Upgrade packages
shell: bash
run: npm update
- name: Gradle cache
uses: gradle/gradle-build-action@v2
- name: Grant execute permission for gradlew
shell: bash
run: chmod +x gradlew
- name: Install Firebase tools
shell: bash
run: npm install -g firebase-tools
- name: Start Firebase emulator
shell: bash
run: "firebase emulators:start --config=./test/firebase.json &"
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ env:

jobs:
build:
runs-on: macos-latest
runs-on: macos-13
steps:
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
java-version: '17'
- uses: gradle/gradle-build-action@v2
- name: Setup versions
run: ./gradlew :updateVersions
Expand Down
120 changes: 71 additions & 49 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,71 +8,31 @@ on:
branches: [ master ]

jobs:
build:
runs-on: macos-latest
build-android:
runs-on: macos-13
strategy:
matrix:
api-level: [ 29 ]
api-level: [ 34 ]
steps:
- uses: actions/checkout@v3
- name: Cocoapods cache
uses: actions/cache@v3
id: cocoapods-cache
with:
path: |
~/.cocoapods
~/Library/Caches/CocoaPods
*/build/cocoapods
*/build/classes
key: cocoapods-cache
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
cache: gradle
- name: Gradle cache
uses: gradle/gradle-build-action@v2
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Install Firebase tools
run: npm install -g firebase-tools
- name: Start Firebase emulator
run: "firebase emulators:start --config=./test/firebase.json &"
- name: Assemble
run: ./gradlew assemble
- name: Run JS Tests
run: ./gradlew cleanTest jsLegacyTest
- name: Upload JS test artifact
uses: actions/upload-artifact@v3
if: failure()
with:
name: "JS Test Report HTML"
path: |
**/build/reports/tests/jsLegacyTest/
**/build/reports/tests/jsLegacyBrowserTest/
**/build/reports/tests/jsLegacyNodeTest/
- name: Run iOS Tests
run: ./gradlew cleanTest iosX64Test
- name: Upload iOS test artifact
uses: actions/upload-artifact@v3
if: failure()
with:
name: "iOS Test Report HTML"
path: "**/build/reports/tests/iosX64Test/"
- name: Setup test environment
uses: ./.github/actions/setup_test_action
- name: AVD cache
uses: actions/cache@v3
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}
key: avd-${{ matrix.api-level }}-${{ runner.os }}-${{ runner.arch }}
- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: x86_64
target: google_apis
avd-name: pixel6_API${{ matrix.api-level }}
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
Expand All @@ -81,6 +41,9 @@ jobs:
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: x86_64
target: google_apis
avd-name: pixel6_API${{ matrix.api-level }}
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
Expand All @@ -91,3 +54,62 @@ jobs:
with:
name: "Android Test Report HTML"
path: "**/build/reports/androidTests/"
- name: Upload Firebase Debug Log
uses: actions/upload-artifact@v3
if: failure()
with:
name: "Firebase Debug Log"
path: "**/firebase-debug.log"
build-js:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup test environment
uses: ./.github/actions/setup_test_action
- name: Run JS Tests
run: ./gradlew cleanTest jsTest
- name: Upload JS test artifact
uses: actions/upload-artifact@v3
if: failure()
with:
name: "JS Test Report HTML"
path: |
**/build/reports/tests/jsTest/
**/build/reports/tests/jsBrowserTest/
**/build/reports/tests/jsNodeTest/
- name: Upload Firebase Debug Log
uses: actions/upload-artifact@v3
if: failure()
with:
name: "Firebase Debug Log"
path: "**/firebase-debug.log"
build-ios:
runs-on: macos-13
steps:
- uses: actions/checkout@v3
- name: Cocoapods cache
uses: actions/cache@v3
id: cocoapods-cache
with:
path: |
~/.cocoapods
~/Library/Caches/CocoaPods
*/build/cocoapods
*/build/classes
key: cocoapods-cache
- name: Setup test environment
uses: ./.github/actions/setup_test_action
- name: Run iOS Tests
run: ./gradlew cleanTest iosX64Test
- name: Upload iOS test artifact
uses: actions/upload-artifact@v3
if: failure()
with:
name: "iOS Test Report HTML"
path: "**/build/reports/tests/iosX64Test/"
- name: Upload Firebase Debug Log
uses: actions/upload-artifact@v3
if: failure()
with:
name: "Firebase Debug Log"
path: "**/firebase-debug.log"
12 changes: 2 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,9 @@
local.properties
/**/*.iml
*.iml
firebase-app/src/nativeInterop/cinterop/modules/
firebase-functions/src/nativeInterop/cinterop/modules/
firebase-auth/src/nativeInterop/cinterop/modules/
firebase-firestore/src/nativeInterop/cinterop/modules/
firebase-database/src/nativeInterop/cinterop/modules/
Firebase*.zip
/Firebase
/.DS_Store
.DS_Store
*.log


/**/nativeInterop/cinterop/Cartfile.resolved
/**/nativeInterop/cinterop/Carthage/
/kotlin-js-store/
/kotlin-js-store/yarn.lock
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ The Firebase Kotlin SDK uses Kotlin serialization to read and write custom class

```groovy
plugins {
kotlin("multiplatform") version "1.8.20" // or kotlin("jvm") or any other kotlin plugin
kotlin("plugin.serialization") version "1.8.20"
kotlin("multiplatform") version "1.8.21" // or kotlin("jvm") or any other kotlin plugin
kotlin("plugin.serialization") version "1.8.21"
}
```

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

user.updateProfile(profileUpdates)
.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
Log.d(TAG, "User profile updated.");
Log.d(TAG, "User profile updated.")
}
}
});
})

//...becomes...

Expand Down
52 changes: 30 additions & 22 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask

repositories {
google()
mavenCentral()
}

plugins {
kotlin("multiplatform") version "1.8.20" apply false
kotlin("native.cocoapods") version "1.8.20" apply false
kotlin("multiplatform") apply false
kotlin("native.cocoapods") apply false
id("base")
id("com.github.ben-manes.versions") version "0.42.0"
}
Expand All @@ -23,17 +24,17 @@ buildscript {
}
}
dependencies {
classpath("com.android.tools.build:gradle:7.2.2")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.20-RC")
classpath("com.android.tools.build:gradle:${project.extra["gradlePluginVersion"]}")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.extra["kotlinVersion"]}")
classpath("com.adarshr:gradle-test-logger-plugin:3.2.0")
}
}

val targetSdkVersion by extra(32)
val minSdkVersion by extra(19)
val compileSdkVersion by extra(34)
val minSdkVersion by extra(23)

tasks {
val updateVersions by registering {
register("updateVersions") {
dependsOn(
"firebase-app:updateVersion", "firebase-app:updateDependencyVersion",
"firebase-auth:updateVersion", "firebase-auth:updateDependencyVersion",
Expand All @@ -52,7 +53,7 @@ tasks {
subprojects {

group = "dev.gitlive"

apply(plugin = "com.adarshr.test-logger")

repositories {
Expand Down Expand Up @@ -88,11 +89,11 @@ subprojects {

if (skipPublishing) return@tasks

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

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

afterEvaluate {

val coroutinesVersion: String by project
val firebaseBoMVersion: String by project

dependencies {
"commonMainImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
"androidMainImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.6.4")
"androidMainImplementation"(platform("com.google.firebase:firebase-bom:32.3.1"))
"commonMainImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
"androidMainImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$coroutinesVersion")
"androidMainImplementation"(platform("com.google.firebase:firebase-bom:$firebaseBoMVersion"))
"commonTestImplementation"(kotlin("test-common"))
"commonTestImplementation"(kotlin("test-annotations-common"))
"commonTestImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
"commonTestImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4")
if ([email protected] != "firebase-crashlytics") {
"jvmMainApi"("dev.gitlive:firebase-java-sdk:0.1.2")
"jvmMainApi"("org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.6.0") {
"jvmMainApi"("org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$coroutinesVersion") {
exclude("com.google.android.gms")
}
"jsTestImplementation"(kotlin("test-js"))
"jvmTestImplementation"(kotlin("test-junit"))
"jvmTestImplementation"("junit:junit:4.13.2")
}
"androidAndroidTestImplementation"(kotlin("test-junit"))
"androidAndroidTestImplementation"("junit:junit:4.13.2")
"androidAndroidTestImplementation"("androidx.test:core:1.4.0")
"androidAndroidTestImplementation"("androidx.test.ext:junit:1.1.3")
"androidAndroidTestImplementation"("androidx.test:runner:1.4.0")
"androidInstrumentedTestImplementation"(kotlin("test-junit"))
"androidUnitTestImplementation"(kotlin("test-junit"))
"androidInstrumentedTestImplementation"("junit:junit:4.13.2")
"androidInstrumentedTestImplementation"("androidx.test:core:1.5.0")
"androidInstrumentedTestImplementation"("androidx.test.ext:junit:1.1.5")
"androidInstrumentedTestImplementation"("androidx.test:runner:1.5.2")
}
}

Expand All @@ -145,6 +148,7 @@ subprojects {
repositories {
maven {
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2")

credentials {
username = project.findProperty("sonatypeUsername") as String? ?: System.getenv("sonatypeUsername")
password = project.findProperty("sonatypePassword") as String? ?: System.getenv("sonatypePassword")
Expand Down Expand Up @@ -193,12 +197,16 @@ subprojects {
}

}

tasks.withType(AbstractPublishToMaven::class.java).configureEach {
dependsOn(tasks.withType(Sign::class.java))
}
}

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

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

return (stableKeyword || versionMatch).not()
Expand Down
Loading