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

Support for Kotlin 2.0 #529

Merged
merged 32 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
ae457ac
Support for Kotlin 2.0
Daeda88 Jun 11, 2024
e727265
Correct JS dependency version
Daeda88 Jun 11, 2024
03e8702
Removed the UNCHANGED logic from update profile
Daeda88 Jun 11, 2024
4a27646
Fixes for JVM
Daeda88 Jun 11, 2024
a3cd5fa
Merge branch 'master' into feature/kotlin-2.0
nbransby Jun 16, 2024
837daa7
Merge branch 'master' into feature/kotlin-2.0
Daeda88 Jun 23, 2024
5c3ac45
Support skipping JVM tests
Daeda88 Jun 23, 2024
e1acf13
Merge remote-tracking branch 'GitLiveApp/master' into feature/kotlin-2.0
Daeda88 Jun 23, 2024
efba3c7
Move cocoapods versioning to version catalog
Daeda88 Jun 24, 2024
01983d3
Merge branch 'master' into feature/kotlin-2.0
Daeda88 Jun 24, 2024
5a06df6
Upgrade to latest github actions
Daeda88 Jun 24, 2024
9d3708e
temp skip storage tests on iOS to see if it explains hanging
Daeda88 Jun 24, 2024
3d41683
Try running Storage on X64 target
Daeda88 Jun 24, 2024
ad0d12b
Set CI to latest
Daeda88 Jun 24, 2024
a41aa20
Attempt to stabilize Crashlytics tests
Daeda88 Jun 24, 2024
0112654
Fixed 547
Daeda88 Jun 25, 2024
9639a5d
Cleanup of test
Daeda88 Jun 25, 2024
a85efaa
Fixed Storage for JS
Daeda88 Jun 25, 2024
5504c0d
Merge branch 'master' into feature/kotlin-2.0
nbransby Jun 25, 2024
bc46dad
Merge remote-tracking branch 'GitLiveApp/master' into feature/kotlin-2.0
Daeda88 Jun 25, 2024
7ce7eb9
Fixed broken iOS test
Daeda88 Jun 25, 2024
26d518d
Improvement to Uploading artifacts
Daeda88 Jun 25, 2024
0c085fe
Using proper Android task name
Daeda88 Jun 25, 2024
7886f0f
Attempting to fix iOS auth tests
Daeda88 Jun 25, 2024
da96818
Trying to fix Android name
Daeda88 Jun 25, 2024
473872b
Another syntax
Daeda88 Jun 25, 2024
8cae779
Without cut
Daeda88 Jun 25, 2024
2555ae8
IN quotes
Daeda88 Jun 25, 2024
6e3772b
Test again
Daeda88 Jun 25, 2024
ac899e3
Retry with cut
Daeda88 Jun 25, 2024
6ef4f30
Cut at right position
Daeda88 Jun 25, 2024
775659b
Yet another attempt
Daeda88 Jun 25, 2024
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
2 changes: 1 addition & 1 deletion .github/actions/setup_test_action/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ runs:
using: "composite"
steps:
- name: Set up JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ env:

jobs:
build:
runs-on: macos-13
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
Expand Down Expand Up @@ -59,9 +59,9 @@ jobs:
documentation:
runs-on: macos-13
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
Expand All @@ -71,7 +71,7 @@ jobs:
- name: Generate documentation
run: ./gradlew dokkaHtmlMultiModule
- name: Uploading build folder
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: artefact
path: build/dokka/htmlMultiModule
Expand Down
59 changes: 42 additions & 17 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
Expand All @@ -31,41 +31,44 @@ jobs:
fail-fast: false
matrix: ${{ fromJson(needs.jobEmulatorMatrixSetup.outputs.emulator_jobs_matrix) }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Enable KVM group perms
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Setup test environment
uses: ./.github/actions/setup_test_action
- name: Set Artifact Name
run: |
echo "ARCHIVE_KEY=$(echo ${{ matrix.gradle_tasks }} | cut -d: -f2)" >> $GITHUB_ENV
- name: Apply Android licenses
run: ./gradlew ciSdkManagerLicenses
- name: Run Android Instrumented Tests
run: ./gradlew ${{ matrix.gradle_tasks }}
- name: Upload Android test artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: failure()
with:
name: "Android Test Report HTML"
name: Android ${{ env.ARCHIVE_KEY }} Test Report HTML
path: "**/build/reports/androidTests/"
- name: Upload Firebase Debug Log
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: failure()
with:
name: "Firebase Debug Log"
name: Android ${{ env.ARCHIVE_KEY }} Firebase Debug Log
path: "**/firebase-debug.log"
build-js:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup test environment
uses: ./.github/actions/setup_test_action
timeout-minutes: 10
- name: Run JS Tests
run: ./gradlew cleanTest jsTest
- name: Upload JS test artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: failure()
with:
name: "JS Test Report HTML"
Expand All @@ -74,17 +77,17 @@ jobs:
**/build/reports/tests/jsBrowserTest/
**/build/reports/tests/jsNodeTest/
- name: Upload Firebase Debug Log
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: failure()
with:
name: "Firebase Debug Log"
name: "JS Firebase Debug Log"
path: "**/firebase-debug.log"
build-ios:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Cocoapods cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cocoapods
Expand All @@ -95,16 +98,38 @@ jobs:
- name: Setup test environment
uses: ./.github/actions/setup_test_action
- name: Run iOS Tests
run: ./gradlew cleanTest iosX64Test
run: ./gradlew cleanTest iosSimulatorArm64Test
- name: Upload iOS test artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: failure()
with:
name: "iOS Test Report HTML"
path: "**/build/reports/tests/iosX64Test/"
path: "**/build/reports/tests/iosSimulatorArm64Test/"
- name: Upload Firebase Debug Log
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: failure()
with:
name: "Firebase Debug Log"
name: "iOS Firebase Debug Log"
path: "**/firebase-debug.log"
build-jvm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup test environment
uses: ./.github/actions/setup_test_action
timeout-minutes: 10
- name: Run JVM Tests
run: ./gradlew cleanTest jvmTest
- name: Upload JVM test artifact
uses: actions/upload-artifact@v4
if: failure()
with:
name: "JVM Test Report HTML"
path: |
**/build/reports/tests/jvmTest/
- name: Upload Firebase Debug Log
uses: actions/upload-artifact@v4
if: failure()
with:
name: "JVM Firebase Debug Log"
path: "**/firebase-debug.log"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ Firebase*.zip
*.log
/kotlin-js-store/
/kotlin-js-store/yarn.lock

.kotlin/
67 changes: 33 additions & 34 deletions firebase-analytics/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompilerOptions
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetTree

/*
Expand Down Expand Up @@ -26,8 +29,8 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

testOptions.configureTestOptions()
Expand All @@ -44,10 +47,20 @@ android {
val supportIosTarget = project.property("skipIosTarget") != "true"

kotlin {

@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
freeCompilerArgs.add("-Xexpect-actual-classes")
}
targets.configureEach {
compilations.configureEach {
kotlinOptions.freeCompilerArgs += "-Xexpect-actual-classes"
compileTaskProvider.configure {
compilerOptions {
if (this is KotlinJvmCompilerOptions) {
jvmTarget = JvmTarget.JVM_17
}
freeCompilerArgs.add("-Xexpect-actual-classes")
}
}
}
}

Expand All @@ -56,25 +69,9 @@ kotlin {
instrumentedTestVariant.sourceSetTree.set(KotlinSourceSetTree.test)
unitTestVariant.sourceSetTree.set(KotlinSourceSetTree.test)
publishAllLibraryVariants()
compilations.configureEach {
kotlinOptions {
jvmTarget = "11"
}
}
}

jvm {
compilations.getByName("main") {
kotlinOptions {
jvmTarget = "17"
}
}
compilations.getByName("test") {
kotlinOptions {
jvmTarget = "17"
}
}
}
jvm()

if (supportIosTarget) {
iosArm64()
Expand All @@ -87,7 +84,7 @@ kotlin {
}
noPodspec()
pod("FirebaseAnalytics") {
version = "10.25.0"
version = libs.versions.firebase.cocoapods.get()
extraOpts += listOf("-compiler-option", "-fmodules")
}
}
Expand All @@ -96,22 +93,18 @@ kotlin {
js(IR) {
useCommonJs()
nodejs {
testTask(
Action {
useKarma {
useChromeHeadless()
}
testTask {
useKarma {
useChromeHeadless()
}
)
}
}
browser {
testTask(
Action {
useKarma {
useChromeHeadless()
}
testTask {
useKarma {
useChromeHeadless()
}
)
}
}
}

Expand Down Expand Up @@ -154,6 +147,12 @@ if (project.property("firebase-analytics.skipIosTests") == "true") {
}
}

if (project.property("firebase-analytics.skipJvmTests") == "true") {
tasks.forEach {
if (it.name.contains("jvm", true) && it.name.contains("test", true)) { it.enabled = false }
}
}

if (project.property("firebase-analytics.skipJsTests") == "true") {
tasks.forEach {
if (it.name.contains("js", true) && it.name.contains("test", true)) { it.enabled = false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ actual val Firebase.analytics: FirebaseAnalytics
get() = TODO("Not yet implemented")

actual fun Firebase.analytics(app: FirebaseApp): FirebaseAnalytics {
TODO("Not yetimplemented")
TODO("Not yet implemented")
}

actual class FirebaseAnalytics {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
@file:JvmName("tests")
package dev.gitlive.firebase.analytics

import dev.gitlive.firebase.testContext

actual val emulatorHost: String = "10.0.2.2"

actual val context: Any = Unit
actual val context: Any = testContext

@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
actual annotation class IgnoreForAndroidUnitTest
Loading
Loading