Skip to content

Use es modules #418

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
49 changes: 8 additions & 41 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 All @@ -123,11 +89,12 @@ subprojects {
"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")
"androidUnitTestImplementation"(kotlin("test-junit"))
"androidInstrumentedTestImplementation"(kotlin("test-junit"))
"androidInstrumentedTestImplementation"("junit:junit:4.13.2")
"androidInstrumentedTestImplementation"("androidx.test:core:1.4.0")
"androidInstrumentedTestImplementation"("androidx.test.ext:junit:1.1.3")
"androidInstrumentedTestImplementation"("androidx.test:runner:1.4.0")
}
}

Expand Down
8 changes: 7 additions & 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 Expand Up @@ -106,12 +106,18 @@ kotlin {
implementation(project(":firebase-common"))
}
}
val commonTest by getting

val androidMain by getting {
dependencies {
api("com.google.firebase:firebase-common")
}
}
val androidInstrumentedTest by getting {
dependencies {
dependsOn(commonTest)
}
}

val jvmMain by getting {
kotlin.srcDir("src/androidMain/kotlin")
Expand Down
31 changes: 0 additions & 31 deletions firebase-app/package.json

This file was deleted.

12 changes: 9 additions & 3 deletions firebase-auth/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ android {
manifest.srcFile("src/androidMain/AndroidManifest.xml")
}
getByName("androidTest") {
java.srcDir(file("src/androidAndroidTest/kotlin"))
manifest.srcFile("src/androidAndroidTest/AndroidManifest.xml")
java.srcDir(file("src/androidInstrumentedTest/kotlin"))
manifest.srcFile("src/androidInstrumentedTest/AndroidManifest.xml")
}
}
testOptions {
Expand Down Expand Up @@ -92,7 +92,7 @@ kotlin {
}

js {
useCommonJs()
useEsModules()
nodejs {
testTask {
useKarma {
Expand Down Expand Up @@ -133,12 +133,18 @@ kotlin {
implementation(project(":firebase-common"))
}
}
val commonTest by getting

val androidMain by getting {
dependencies {
api("com.google.firebase:firebase-auth")
}
}
val androidInstrumentedTest by getting {
dependencies {
dependsOn(commonTest)
}
}

val jvmMain by getting {
kotlin.srcDir("src/androidMain/kotlin")
Expand Down
31 changes: 0 additions & 31 deletions firebase-auth/package.json

This file was deleted.

13 changes: 9 additions & 4 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 All @@ -24,8 +24,8 @@ android {
manifest.srcFile("src/androidMain/AndroidManifest.xml")
}
getByName("androidTest") {
java.srcDir(file("src/androidAndroidTest/kotlin"))
manifest.srcFile("src/androidAndroidTest/AndroidManifest.xml")
java.srcDir(file("src/androidInstrumentedTest/kotlin"))
manifest.srcFile("src/androidInstrumentedTest/AndroidManifest.xml")
}
}
testOptions {
Expand Down Expand Up @@ -70,7 +70,7 @@ kotlin {
}

js {
useCommonJs()
useEsModules()
nodejs {
testTask {
useKarma {
Expand Down Expand Up @@ -117,6 +117,11 @@ kotlin {
api("com.google.firebase:firebase-common")
}
}
val androidInstrumentedTest by getting {
dependencies {
dependsOn(commonTest)
}
}

if (supportIosTarget) {
val iosMain by getting
Expand Down
31 changes: 0 additions & 31 deletions firebase-common/package.json

This file was deleted.

10 changes: 8 additions & 2 deletions firebase-config/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ android {
manifest.srcFile("src/androidMain/AndroidManifest.xml")
}
getByName("androidTest"){
java.srcDir(file("src/androidAndroidTest/kotlin"))
java.srcDir(file("src/androidInstrumentedTest/kotlin"))
}
}
testOptions {
Expand Down Expand Up @@ -94,7 +94,7 @@ kotlin {
}

js {
useCommonJs()
useEsModules()
browser {
testTask {
useKarma {
Expand All @@ -120,12 +120,18 @@ kotlin {
implementation(project(":firebase-common"))
}
}
val commonTest by getting

val androidMain by getting {
dependencies {
api("com.google.firebase:firebase-config")
}
}
val androidInstrumentedTest by getting {
dependencies {
dependsOn(commonTest)
}
}

val jvmMain by getting {
kotlin.srcDir("src/androidMain/kotlin")
Expand Down
31 changes: 0 additions & 31 deletions firebase-config/package.json

This file was deleted.

10 changes: 8 additions & 2 deletions firebase-crashlytics/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ android {
manifest.srcFile("src/androidMain/AndroidManifest.xml")
}
getByName("androidTest") {
java.srcDir(file("src/androidAndroidTest/kotlin"))
manifest.srcFile("src/androidAndroidTest/AndroidManifest.xml")
java.srcDir(file("src/androidInstrumentedTest/kotlin"))
manifest.srcFile("src/androidInstrumentedTest/AndroidManifest.xml")
}
}
testOptions {
Expand Down Expand Up @@ -94,12 +94,18 @@ kotlin {
implementation(project(":firebase-common"))
}
}
val commonTest by getting

val androidMain by getting {
dependencies {
api("com.google.firebase:firebase-crashlytics")
}
}
val androidInstrumentedTest by getting {
dependencies {
dependsOn(commonTest)
}
}

// val jvmMain by getting {
// kotlin.srcDir("src/androidMain/kotlin")
Expand Down
Loading