Skip to content

Commit

Permalink
upgrade kotlin to 1.9.10
Browse files Browse the repository at this point in the history
remove manual npm module creation
drop legacy js compiler
produce es modules instead of commonjs
  • Loading branch information
nbransby committed Sep 3, 2023
1 parent 220e8f9 commit b173a5f
Show file tree
Hide file tree
Showing 24 changed files with 27 additions and 393 deletions.
38 changes: 2 additions & 36 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ repositories {
}

plugins {
kotlin("multiplatform") version "1.8.20" apply false
kotlin("native.cocoapods") version "1.8.20" apply false
kotlin("multiplatform") version "1.9.10" apply false
kotlin("native.cocoapods") version "1.9.10" apply false
id("base")
id("com.github.ben-manes.versions") version "0.42.0"
}
Expand All @@ -32,23 +32,6 @@ buildscript {
val targetSdkVersion by extra(32)
val minSdkVersion by extra(19)

tasks {
val updateVersions by registering {
dependsOn(
"firebase-app:updateVersion", "firebase-app:updateDependencyVersion",
"firebase-auth:updateVersion", "firebase-auth:updateDependencyVersion",
"firebase-common:updateVersion", "firebase-common:updateDependencyVersion",
"firebase-config:updateVersion", "firebase-config:updateDependencyVersion",
"firebase-database:updateVersion", "firebase-database:updateDependencyVersion",
"firebase-firestore:updateVersion", "firebase-firestore:updateDependencyVersion",
"firebase-functions:updateVersion", "firebase-functions:updateDependencyVersion",
"firebase-installations:updateVersion", "firebase-installations:updateDependencyVersion",
"firebase-perf:updateVersion", "firebase-perf:updateDependencyVersion",
"firebase-storage:updateVersion", "firebase-storage:updateDependencyVersion"
)
}
}

subprojects {

group = "dev.gitlive"
Expand Down Expand Up @@ -85,23 +68,6 @@ subprojects {
)
}
}

if (skipPublishing) return@tasks

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

val updateDependencyVersion by registering(Copy::class) {
mustRunAfter("updateVersion")
val from = file("package.json")
from.writeText(
from.readText()
.replace("version\": \"([^\"]+)".toRegex(), "version\": \"${project.property("${project.name}.version")}")
.replace("firebase-common\": \"([^\"]+)".toRegex(), "firebase-common\": \"${project.property("firebase-common.version")}")
.replace("firebase-app\": \"([^\"]+)".toRegex(), "firebase-app\": \"${project.property("firebase-app.version")}")
)
}
}

afterEvaluate {
Expand Down
2 changes: 1 addition & 1 deletion firebase-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ kotlin {
}

js {
useCommonJs()
useEsModules()
nodejs {
testTask {
useKarma {
Expand Down
31 changes: 0 additions & 31 deletions firebase-app/package.json

This file was deleted.

2 changes: 1 addition & 1 deletion firebase-auth/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ kotlin {
}

js {
useCommonJs()
useEsModules()
nodejs {
testTask {
useKarma {
Expand Down
31 changes: 0 additions & 31 deletions firebase-auth/package.json

This file was deleted.

4 changes: 2 additions & 2 deletions firebase-common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ version = project.property("firebase-common.version") as String
plugins {
id("com.android.library")
kotlin("multiplatform")
kotlin("plugin.serialization") version "1.8.20"
kotlin("plugin.serialization") version "1.9.10"
}

android {
Expand Down Expand Up @@ -70,7 +70,7 @@ kotlin {
}

js {
useCommonJs()
useEsModules()
nodejs {
testTask {
useKarma {
Expand Down
31 changes: 0 additions & 31 deletions firebase-common/package.json

This file was deleted.

2 changes: 1 addition & 1 deletion firebase-config/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ kotlin {
}

js {
useCommonJs()
useEsModules()
browser {
testTask {
useKarma {
Expand Down
31 changes: 0 additions & 31 deletions firebase-config/package.json

This file was deleted.

31 changes: 0 additions & 31 deletions firebase-crashlytics/package.json

This file was deleted.

15 changes: 13 additions & 2 deletions firebase-database/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile

/*
* Copyright (c) 2020 GitLive Ltd. Use of this source code is governed by the Apache 2.0 license.
*/
Expand All @@ -8,7 +10,7 @@ plugins {
id("com.android.library")
kotlin("native.cocoapods")
kotlin("multiplatform")
kotlin("plugin.serialization") version "1.8.20"
kotlin("plugin.serialization") version "1.9.10"
}

repositories {
Expand Down Expand Up @@ -80,8 +82,10 @@ kotlin {
}

js {
useCommonJs()
useEsModules()
binaries.library()
nodejs {

testTask {
useKarma {
useChromeHeadless()
Expand All @@ -97,6 +101,13 @@ kotlin {
}
}

// Enables ES6 classes generation
tasks.withType<KotlinJsCompile>().configureEach {
kotlinOptions {
useEsClasses = true
}
}

sourceSets {
all {
languageSettings.apply {
Expand Down
31 changes: 0 additions & 31 deletions firebase-database/package.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
@file:JsModule("firebase/database")
@file:JsNonModule

package dev.gitlive.firebase.database.externals

import dev.gitlive.firebase.*
Expand Down
4 changes: 2 additions & 2 deletions firebase-firestore/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
id("com.android.library")
kotlin("native.cocoapods")
kotlin("multiplatform")
kotlin("plugin.serialization") version "1.8.20"
kotlin("plugin.serialization") version "1.9.10"
}

android {
Expand Down Expand Up @@ -81,7 +81,7 @@ kotlin {
}

js {
useCommonJs()
useEsModules()
nodejs {
testTask {
useKarma {
Expand Down
31 changes: 0 additions & 31 deletions firebase-firestore/package.json

This file was deleted.

Loading

0 comments on commit b173a5f

Please sign in to comment.