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

Use Kotlin multiplatform plugin rather than JS #14

Merged
merged 5 commits into from
Oct 10, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Add multiplatform plugin rather than JS
  • Loading branch information
gchristov committed Oct 9, 2022
commit 275ce4f468819398f6796e3864ee7c521d63f0e6
2 changes: 1 addition & 1 deletion appJs/appJs/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {

kotlin {
sourceSets {
val main by getting {
val commonMain by getting {
dependencies {
implementation(npm("firebase", "9.10.0"))
implementation(npm("firebase-admin", "11.0.1"))
Expand Down
2 changes: 1 addition & 1 deletion appJs/module-a/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {

kotlin {
sourceSets {
val main by getting {
val commonMain by getting {
dependencies {
implementation(projects.kmpModuleB)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ package com.gchristov.thecodinglove.gradleplugins

import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.kotlin
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension

@Suppress("unused")
class JavascriptApplicationPlugin : JavascriptPlatformPlugin() {
Expand All @@ -25,8 +23,8 @@ abstract class JavascriptPlatformPlugin : Plugin<Project> {
}

private fun Project.configureJavascript() {
plugins.apply("org.jetbrains.kotlin.js")
extensions.configure(KotlinJsProjectExtension::class.java) {
plugins.apply("org.jetbrains.kotlin.multiplatform")
extensions.configure(KotlinMultiplatformExtension::class.java) {
js(IR) {
nodejs()
}
Expand All @@ -35,18 +33,17 @@ private fun Project.configureJavascript() {

private fun Project.configureJavascriptApplication() {
plugins.apply("dev.petuska.npm.publish")
extensions.configure(KotlinJsProjectExtension::class.java) {
extensions.configure(KotlinMultiplatformExtension::class.java) {
js(IR) {
binaries.library()
}
}
}

private fun Project.configureTests() {
// Add dependencies after plugins are set to avoid missing "implementation" errors
afterEvaluate {
dependencies {
add("testImplementation", kotlin("test"))
extensions.configure(KotlinMultiplatformExtension::class.java) {
sourceSets.maybeCreate("commonMain").dependencies {
implementation(kotlin("test"))
}
}
}