Skip to content

Commit 76e1f43

Browse files
committed
Move to Kotlin 1.8.21 & gradle 8
1 parent 80770ac commit 76e1f43

File tree

59 files changed

+775
-275
lines changed

Some content is hidden

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

59 files changed

+775
-275
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 |

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
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: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: macos-latest
1313
strategy:
1414
matrix:
15-
api-level: [ 29 ]
15+
api-level: [ 33 ]
1616
steps:
1717
- uses: actions/checkout@v3
1818
- name: Cocoapods cache
@@ -29,7 +29,7 @@ jobs:
2929
uses: actions/setup-java@v3
3030
with:
3131
distribution: 'zulu'
32-
java-version: '11'
32+
java-version: '17'
3333
cache: gradle
3434
- name: Gradle cache
3535
uses: gradle/gradle-build-action@v2
@@ -42,16 +42,16 @@ jobs:
4242
- name: Assemble
4343
run: ./gradlew assemble
4444
- name: Run JS Tests
45-
run: ./gradlew cleanTest jsLegacyTest
45+
run: ./gradlew cleanTest jsTest
4646
- name: Upload JS test artifact
4747
uses: actions/upload-artifact@v3
4848
if: failure()
4949
with:
5050
name: "JS Test Report HTML"
5151
path: |
52-
**/build/reports/tests/jsLegacyTest/
53-
**/build/reports/tests/jsLegacyBrowserTest/
54-
**/build/reports/tests/jsLegacyNodeTest/
52+
**/build/reports/tests/jsTest/
53+
**/build/reports/tests/jsBrowserTest/
54+
**/build/reports/tests/jsNodeTest/
5555
- name: Run iOS Tests
5656
run: ./gradlew cleanTest iosX64Test
5757
- name: Upload iOS test artifact

.gitignore

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,10 @@
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
1712

18-
19-
/**/nativeInterop/cinterop/Cartfile.resolved
20-
/**/nativeInterop/cinterop/Carthage/
13+
/kotlin-js-store/
2114
/kotlin-js-store/yarn.lock

build.gradle.kts

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ repositories {
88
}
99

1010
plugins {
11-
kotlin("multiplatform") version "1.8.20" apply false
12-
kotlin("native.cocoapods") version "1.8.20" apply false
11+
kotlin("multiplatform") apply false
12+
kotlin("native.cocoapods") apply false
1313
id("base")
1414
id("com.github.ben-manes.versions") version "0.42.0"
1515
}
@@ -24,17 +24,17 @@ buildscript {
2424
}
2525
}
2626
dependencies {
27-
classpath("com.android.tools.build:gradle:7.2.2")
28-
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"]}")
2929
classpath("com.adarshr:gradle-test-logger-plugin:3.2.0")
3030
}
3131
}
3232

33-
val targetSdkVersion by extra(32)
33+
val compileSdkVersion by extra(33)
3434
val minSdkVersion by extra(19)
3535

3636
tasks {
37-
val updateVersions by registering {
37+
register("updateVersions") {
3838
dependsOn(
3939
"firebase-app:updateVersion", "firebase-app:updateDependencyVersion",
4040
"firebase-auth:updateVersion", "firebase-auth:updateDependencyVersion",
@@ -62,16 +62,16 @@ subprojects {
6262
}
6363

6464
tasks.withType<Sign>().configureEach {
65-
onlyIf { !project.gradle.startParameter.taskNames.contains("publishToMavenLocal") }
65+
onlyIf { project.gradle.startParameter.taskNames.contains("MavenRepository") }
6666
}
6767

6868
tasks {
6969

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

74-
val updateDependencyVersion by registering(Copy::class) {
74+
register<Copy>("updateDependencyVersion") {
7575
mustRunAfter("updateVersion")
7676
val from = file("package.json")
7777
from.writeText(
@@ -117,7 +117,7 @@ subprojects {
117117
into(file("$buildDir/node_module"))
118118
}
119119

120-
val prepareForNpmPublish by registering {
120+
register("prepareForNpmPublish") {
121121
dependsOn(
122122
unzipJar,
123123
copyPackageJson,
@@ -127,7 +127,7 @@ subprojects {
127127
)
128128
}
129129

130-
val publishToNpm by creating(Exec::class) {
130+
create<Exec>("publishToNpm") {
131131
workingDir("$buildDir/node_module")
132132
isIgnoreExitValue = true
133133
if(Os.isFamily(Os.FAMILY_WINDOWS)) {
@@ -162,22 +162,25 @@ subprojects {
162162
mkdir("$buildDir/node_module")
163163
}
164164

165+
val coroutinesVersion: String by project
166+
val firebaseBoMVersion: String by project
167+
165168
dependencies {
166-
"commonMainImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
167-
"androidMainImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.6.4")
168-
"androidMainImplementation"(platform("com.google.firebase:firebase-bom:31.4.0"))
169+
"commonMainImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
170+
"androidMainImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$coroutinesVersion")
171+
"androidMainImplementation"(platform("com.google.firebase:firebase-bom:$firebaseBoMVersion"))
169172
"commonTestImplementation"(kotlin("test-common"))
170173
"commonTestImplementation"(kotlin("test-annotations-common"))
171-
"commonTestImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
172-
"commonTestImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4")
174+
"commonTestImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
175+
"commonTestImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion")
173176
if (this@afterEvaluate.name != "firebase-crashlytics") {
174177
"jsTestImplementation"(kotlin("test-js"))
175178
}
176-
"androidAndroidTestImplementation"(kotlin("test-junit"))
177-
"androidAndroidTestImplementation"("junit:junit:4.13.2")
178-
"androidAndroidTestImplementation"("androidx.test:core:1.4.0")
179-
"androidAndroidTestImplementation"("androidx.test.ext:junit:1.1.3")
180-
"androidAndroidTestImplementation"("androidx.test:runner:1.4.0")
179+
"androidInstrumentedTestImplementation"(kotlin("test-junit"))
180+
"androidInstrumentedTestImplementation"("junit:junit:4.13.2")
181+
"androidInstrumentedTestImplementation"("androidx.test:core:1.5.0")
182+
"androidInstrumentedTestImplementation"("androidx.test.ext:junit:1.1.5")
183+
"androidInstrumentedTestImplementation"("androidx.test:runner:1.5.2")
181184
}
182185
}
183186

@@ -236,6 +239,12 @@ subprojects {
236239
}
237240
}
238241
}
242+
243+
// Workaround for setting kotlinOptions.jvmTarget
244+
// See https://youtrack.jetbrains.com/issue/KT-55947/Unable-to-set-kapt-jvm-target-version
245+
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
246+
kotlinOptions.jvmTarget = "11"
247+
}
239248
}
240249

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

firebase-app/build.gradle.kts

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,28 @@ repositories {
1616
}
1717

1818
android {
19-
compileSdk = property("targetSdkVersion") as Int
19+
val minSdkVersion: Int by project
20+
val compileSdkVersion: Int by project
21+
22+
compileSdk = compileSdkVersion
23+
namespace="dev.gitlive.firebase"
24+
2025
defaultConfig {
21-
minSdk = property("minSdkVersion") as Int
22-
targetSdk = property("targetSdkVersion") as Int
26+
minSdk = minSdkVersion
2327
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
2428
}
25-
sourceSets {
26-
getByName("main") {
27-
manifest.srcFile("src/androidMain/AndroidManifest.xml")
28-
}
29+
30+
compileOptions {
31+
sourceCompatibility = JavaVersion.VERSION_11
32+
targetCompatibility = JavaVersion.VERSION_11
2933
}
34+
3035
testOptions {
3136
unitTests.apply {
3237
isIncludeAndroidResources = true
3338
}
3439
}
35-
packagingOptions {
40+
packaging {
3641
resources.pickFirsts.add("META-INF/kotlinx-serialization-core.kotlin_module")
3742
resources.pickFirsts.add("META-INF/AL2.0")
3843
resources.pickFirsts.add("META-INF/LGPL2.1")
@@ -62,12 +67,12 @@ kotlin {
6267
}
6368
noPodspec()
6469
pod("FirebaseCore") {
65-
version = "10.7.0"
70+
version = "10.9.0"
6671
}
6772
}
6873
}
6974

70-
js {
75+
js(IR) {
7176
useCommonJs()
7277
nodejs {
7378
testTask {
@@ -88,21 +93,31 @@ kotlin {
8893
sourceSets {
8994
all {
9095
languageSettings.apply {
91-
apiVersion = "1.8"
92-
languageVersion = "1.8"
96+
val apiVersion: String by project
97+
val languageVersion: String by project
98+
this.apiVersion = apiVersion
99+
this.languageVersion = languageVersion
93100
progressiveMode = true
94101
}
95102
}
96103

97-
val commonMain by getting {
104+
getByName("commonMain") {
98105
dependencies {
99106
implementation(project(":firebase-common"))
100107
}
101108
}
102109

103-
val androidMain by getting {
110+
val commonTest by getting
111+
112+
getByName("androidMain") {
113+
dependencies {
114+
api("com.google.firebase:firebase-common-ktx")
115+
}
116+
}
117+
118+
getByName("androidInstrumentedTest") {
104119
dependencies {
105-
api("com.google.firebase:firebase-common")
120+
dependsOn(commonTest)
106121
}
107122
}
108123

@@ -114,8 +129,6 @@ kotlin {
114129
val iosSimulatorArm64Test by getting
115130
iosSimulatorArm64Test.dependsOn(iosTest)
116131
}
117-
118-
val jsMain by getting
119132
}
120133
}
121134

firebase-app/firebase_app.podspec

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
Pod::Spec.new do |spec|
2+
spec.name = 'firebase_app'
3+
spec.version = '1.8.1'
4+
spec.homepage = ''
5+
spec.source = { :http=> ''}
6+
spec.authors = ''
7+
spec.license = ''
8+
spec.summary = ''
9+
spec.vendored_frameworks = 'build/cocoapods/framework/firebase_app.framework'
10+
spec.libraries = 'c++'
11+
12+
13+
14+
spec.pod_target_xcconfig = {
15+
'KOTLIN_PROJECT_PATH' => ':firebase-app',
16+
'PRODUCT_MODULE_NAME' => 'firebase_app',
17+
}
18+
19+
spec.script_phases = [
20+
{
21+
:name => 'Build firebase_app',
22+
:execution_position => :before_compile,
23+
:shell_path => '/bin/sh',
24+
:script => <<-SCRIPT
25+
if [ "YES" = "$OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED" ]; then
26+
echo "Skipping Gradle build task invocation due to OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED environment variable set to \"YES\""
27+
exit 0
28+
fi
29+
set -ev
30+
REPO_ROOT="$PODS_TARGET_SRCROOT"
31+
"$REPO_ROOT/../gradlew" -p "$REPO_ROOT" $KOTLIN_PROJECT_PATH:syncFramework \
32+
-Pkotlin.native.cocoapods.platform=$PLATFORM_NAME \
33+
-Pkotlin.native.cocoapods.archs="$ARCHS" \
34+
-Pkotlin.native.cocoapods.configuration="$CONFIGURATION"
35+
SCRIPT
36+
}
37+
]
38+
39+
end

firebase-app/src/androidMain/AndroidManifest.xml

Lines changed: 0 additions & 1 deletion
This file was deleted.

firebase-app/src/commonTest/kotlin/dev/gitlive/firebase/firebase.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package dev.gitlive.firebase
22

3-
import dev.gitlive.firebase.Firebase
4-
import dev.gitlive.firebase.initialize
53
import kotlin.test.Test
64

75
expect val context: Any

0 commit comments

Comments
 (0)