Skip to content

Instantly share code, notes, and snippets.

@RageshAntony
Last active September 20, 2022 13:18
Show Gist options
  • Select an option

  • Save RageshAntony/1c84bbc916b4b1bcb7f4b07f26aacb87 to your computer and use it in GitHub Desktop.

Select an option

Save RageshAntony/1c84bbc916b4b1bcb7f4b07f26aacb87 to your computer and use it in GitHub Desktop.
Adding JS target to KMM project
Caused by: org.gradle.api.UnknownDomainObjectException: Extension with name 'kotlinNodeJs' does not exist.
Currently registered extension names: [ext, _internalAndroidGradlePluginDependencyCheckerRegistered]
buildscript {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10")
classpath("com.android.tools.build:gradle:7.2.1")
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
tasks.register("clean", Delete::class) {
delete(rootProject.buildDir)
}
plugins {
kotlin("multiplatform")
kotlin("native.cocoapods")
id("com.android.library")
}
version = "1.0"
kotlin {
android()
iosX64()
iosArm64()
iosSimulatorArm64()
js(IR) { // JS Target
binaries.executable()
browser{
}
}
cocoapods {
summary = "Some description for the Shared Module"
homepage = "Link to the Shared Module homepage"
ios.deploymentTarget = "14.1"
podfile = project.file("../FullTariosApp/Podfile")
framework {
baseName = "shared"
}
}
sourceSets {
val commonMain by getting
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
}
}
val androidMain by getting
val androidTest by getting
val iosX64Main by getting
val iosArm64Main by getting
val iosSimulatorArm64Main by getting
val iosMain by creating {
dependsOn(commonMain)
iosX64Main.dependsOn(this)
iosArm64Main.dependsOn(this)
iosSimulatorArm64Main.dependsOn(this)
}
val iosX64Test by getting
val iosArm64Test by getting
val iosSimulatorArm64Test by getting
val iosTest by creating {
dependsOn(commonTest)
iosX64Test.dependsOn(this)
iosArm64Test.dependsOn(this)
iosSimulatorArm64Test.dependsOn(this)
}
val jsMain by getting // JS deps
val jsTest by getting {
dependencies {
// you don't need this if you already have
// kotlin("test") as your `commonTest` dependency
implementation(kotlin("test-js"))
}
}
}
}
android {
compileSdk = 32
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
defaultConfig {
minSdk = 21
targetSdk = 32
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment